Contract constructor
env - The Soroban environmentscorer_creator - The address of the contract creator who will be the initial managerscorer_badges - The initial set of badges for the contractname - The name of the scorerdescription - The description of the scorericon - The icon URL or identifier for the scorerfn initialize(
env: soroban_sdk::Env,
scorer_creator: soroban_sdk::Address,
scorer_badges: soroban_sdk::Map,
name: soroban_sdk::String,
description: soroban_sdk::String,
icon: soroban_sdk::String,
)
Returns the current version of the contract
u32 - The version number (currently 1)fn contract_version(env: soroban_sdk::Env) -> u32
Upgrades the contract's WASM code to a new version
env - The environment object providing access to the contract's storagenew_wasm_hash - The hash of the new WASM code to upgrade to (32 bytes)fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Adds a new manager to the contract
env - The environment object providing access to the contract's storagesender - The address of the account attempting to add the managernew_manager - The address of the new manager to be addedError::Unauthorized)Error::ManagerAlreadyExists)fn add_manager(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
new_manager: soroban_sdk::Address,
)
Removes a manager from the contract
env - The environment object providing access to the contract's storagesender - The address of the account attempting to remove the managermanager_to_remove - The address of the manager to be removedError::Unauthorized)Error::ManagerNotFound)fn remove_manager(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
manager_to_remove: soroban_sdk::Address,
)
Adds a new user to the contract's user registry
env - The environment object providing access to the contract's storageuser - The address of the user to be addedError::UserAlreadyExist)fn add_user(env: soroban_sdk::Env, user: soroban_sdk::Address)
Removes a user from the contract's user registry
env - The environment object providing access to the contract's storageuser - The address of the user to be removedError::UserDoesNotExist)fn remove_user(env: soroban_sdk::Env, user: soroban_sdk::Address)
Retrieves the complete map of users and their status
env - The environment object providing access to the contract's storageMap<Address, bool> - A map where:fn get_users(env: soroban_sdk::Env) -> soroban_sdk::Map
Retrieves all scorer badges from the contract's storage
env - The environment object providing access to the contract's storageMap<BadgeId, u32> - A map where:fn get_badges(env: soroban_sdk::Env) -> soroban_sdk::Map
Retrieves all the managers from the contract.
env - The environment object providing access to the contract's storageVec<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 environment object providing access to the contract's storageAddress - The address of the scorer creatorError::ScorerCreatorDoesNotExist)fn get_contract_owner(env: soroban_sdk::Env) -> soroban_sdk::Address
Adds a new badge to the contract
env - The environment object providing access to the contract's storagesender - The address of the account attempting to add the badgename - The name of the badgeissuer - The issuer of the badgescore - The score value of the badgeError::Unauthorized)Error::BadgeAlreadyExists)Error::EmptyArg)Error::InvalidScoreRange)fn add_badge(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
name: soroban_sdk::String,
issuer: soroban_sdk::Address,
score: u32,
)
Removes a badge from the contract
env - The environment object providing access to the contract's storagesender - The address of the account attempting to remove the badgename - The name of the badge to removeissuer - The issuer of the badge to removeError::Unauthorized)Error::BadgeNotFound)fn remove_badge(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
name: soroban_sdk::String,
issuer: soroban_sdk::Address,
)
Retrieves contract metadata (name, description, icon)
env - The environment object providing access to the contract's storage(String, String, String) - A tuple containing:fn get_metadata(
env: soroban_sdk::Env,
) -> (soroban_sdk::String, soroban_sdk::String, soroban_sdk::String)