Initializes the ScorerFactory contract with the initial manager (scorer_creator)
env - The Soroban environmentscorer_creator - The address that will be set as both the factory creator and initial managerscorer_wasm_hash - The hash of the Wasm binary for the scorer contractfn initialize(
env: soroban_sdk::Env,
scorer_creator: soroban_sdk::Address,
scorer_wasm_hash: soroban_sdk::BytesN<32>,
)
Checks if the contract has been initialized
env - The Soroban environmentbool - True if the contract is initialized, false otherwisefn is_initialized(env: soroban_sdk::Env) -> bool
Verifies if the provided address is the scorer factory creator
env - The Soroban environmentaddress - The address to checkbool - True if the address is the scorer factory creator, false otherwisefn is_scorer_factory_creator(
env: soroban_sdk::Env,
address: soroban_sdk::Address,
) -> bool
Checks if the provided address is a manager
env - The Soroban environmentaddress - The address to checkbool - True if the address is a manager, false otherwisefn is_manager(env: soroban_sdk::Env, address: soroban_sdk::Address) -> bool
Deploy a new scorer contract
env - The Soroban environmentdeployer - The address that will deploy the scorer contractsalt - A unique value to ensure unique contract addressesinit_fn - The initialization function name to call on the deployed contractinit_args - Arguments to pass to the initialization function, must include:Address - The address of the newly deployed scorer contractError::Unauthorized)Error::InvalidInitArgs)fn create_scorer(
env: soroban_sdk::Env,
deployer: soroban_sdk::Address,
salt: soroban_sdk::BytesN<32>,
init_fn: soroban_sdk::Symbol,
init_args: soroban_sdk::Vec,
) -> soroban_sdk::Address
Returns a map of all scorer contracts created by this factory
env - The Soroban environmentMap<Address, (String, String, String)> - A map where keys are scorer contract addresses and values are tuples containing
(scorer_name, scorer_description, scorer_icon)Error::ScorersWereNotFound)fn get_scorers(
env: soroban_sdk::Env,
) -> soroban_sdk::Map<
soroban_sdk::Address,
(soroban_sdk::String, soroban_sdk::String, soroban_sdk::String),
>
Adds a new manager to the contract
env - The Soroban environmentcaller - The address that will authenticate the addition of the new managermanager - The address to be added as a managerError::Unauthorized)Error::ManagerAlreadyExists)fn add_manager(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
manager: soroban_sdk::Address,
)
Removes a manager from the contract
env - The Soroban environmentcaller - The address that will authenticate the removal of the managermanager - The address to be removed as a managerError::Unauthorized)Error::ManagerNotFound)Error::CannotRemoveLastManager)fn remove_manager(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
manager: soroban_sdk::Address,
)
Retrieves all the managers from the contract.
env - The Soroban environmentVec<Address> - A vector of all manager addressesError::ManagersNotFound)fn get_managers(env: soroban_sdk::Env) -> soroban_sdk::Vec
Retrieves the address of the contract creator.
env - The Soroban environmentAddress - The address of the scorer factory creatorError::ContractCreatorNotFound)fn get_contract_creator(env: soroban_sdk::Env) -> soroban_sdk::Address
Removes a scorer contract from the factory's registry
env - The Soroban environmentcaller - The address that will authenticate the removal of the scorerscorer_address - The address of the scorer contract to be removed() - Returns unit type on successError::Unauthorized)Error::ScorerNotFound)fn remove_scorer(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
scorer_address: soroban_sdk::Address,
)