Initializes the contract with name, symbol, decimal, and roles. Called after deployment, only can be called once.
name - the token namesymbol - the token symboldecimal - the token decimalsadmin - address of the adminsupply_controller - address of the supply controllerpauser - address of the pauserasset_protector - address of the asset protectorrebase_admin - address of the rebase adminrebaser - address of the rebaserfn initialize(
env: soroban_sdk::Env,
name: soroban_sdk::String,
symbol: soroban_sdk::String,
decimal: u32,
admin: soroban_sdk::Address,
supply_controller: soroban_sdk::Address,
pauser: soroban_sdk::Address,
asset_protector: soroban_sdk::Address,
rebase_admin: soroban_sdk::Address,
rebaser: soroban_sdk::Address,
)
Returns the total rebase shares in the contract.
fn get_total_rebase_shares(env: soroban_sdk::Env) -> i128
Returns the total fixed shares in the contract.
fn get_total_fixed_shares(env: soroban_sdk::Env) -> i128
Returns the multiplier effective before the increase time.
fn get_before_multiplier(env: soroban_sdk::Env) -> i128
Returns the multiplier effective after the increase time.
fn get_after_multiplier(env: soroban_sdk::Env) -> i128
Returns the time at which the multiplier changes from before_incr_mult to after_incr_mult.
fn get_mult_incr_time(env: soroban_sdk::Env) -> u64
Returns the rebasing period to increment mult_incr_time.
fn get_rebase_period(env: soroban_sdk::Env) -> u64
Returns the max rate increase between before_incr_mult -> after_incr_mult.
fn get_max_rebase_rate(env: soroban_sdk::Env) -> i128
Returns the active rebase multiplier.
fn get_active_multiplier(env: soroban_sdk::Env) -> i128
Returns the total supply of the token.
fn get_total_supply(env: soroban_sdk::Env) -> i128
Returns the rebase shares of the address.
addr - address to get the shares forfn get_rebase_shares(env: soroban_sdk::Env, addr: soroban_sdk::Address) -> i128
Returns the fixed shares of the address.
addr - address to get the shares forfn get_fixed_shares(env: soroban_sdk::Env, addr: soroban_sdk::Address) -> i128
Returns true if the address is blocked. A blocked address cannot submit approvals or transfers (from & to). A blocked address will not receive rebase payouts.
addr - address to checkfn is_addr_blocked(env: soroban_sdk::Env, addr: soroban_sdk::Address) -> bool
Returns true if the address is blocked from receiving the token. An address blocked from receiving will still receive rebase payouts.
addr - address to checkfn is_addr_blocked_from_receiving(
env: soroban_sdk::Env,
addr: soroban_sdk::Address,
) -> bool
Increases the total supply by minting the specified number of tokens. Converts to underlying rebase shares and checks if results in overflow for total supply. Restricted to SUPPLY_CONTROLLER role.
minter - address of the minterto - address to mint the tokens toamount - amount of tokens to mintfn mint(
env: soroban_sdk::Env,
minter: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
Sets the rebase period. Restricted to REBASE_ADMIN role.
rebase_admin - address of the rebase adminrebase_period - rebase period to setfn set_rebase_period(
env: soroban_sdk::Env,
rebase_admin: soroban_sdk::Address,
rebase_period: u64,
)
Sets the max rebase rate. Restricted to REBASE_ADMIN role.
rebase_admin - address of the rebase adminmax_rebase_rate - max rebase rate to setfn set_max_rebase_rate(
env: soroban_sdk::Env,
rebase_admin: soroban_sdk::Address,
max_rebase_rate: i128,
)
Sets the next rebase multiplier and increase time. Restricted to REBASE_ADMIN role. Used in the following scenarios:
rebase_admin - address of the rebase adminnext_multiplier - next multiplier to setmult_incr_time - increase time to setexpected_total_supply - expected total supply after the multiplier changefn set_next_multiplier(
env: soroban_sdk::Env,
rebase_admin: soroban_sdk::Address,
next_multiplier: i128,
mult_incr_time: u64,
expected_total_supply: i128,
)
Increases the next multiplier and sets the increase time. Restricted to REBASE role.
rebaser - address of the rebaserrebase_rate - rate of increase for the multiplierexpected_total_supply - expected total supply after the multiplier changefn increase_rebase_multiplier(
env: soroban_sdk::Env,
rebaser: soroban_sdk::Address,
rebase_rate: i128,
expected_total_supply: i128,
)
Restricted to ASSET_PROTECTION role. This function intentionally does not include the require_no_pending_multiplier() check since blocking addresses is a critical operation and should not be delayed. As a result, the overall payout amount would be less than originally expected for a pending multiplier since the blocked addresses would not receive the payout.
asset_protector - address of the asset protectoraddrs - addresses to blockfn block_addrs(
env: soroban_sdk::Env,
asset_protector: soroban_sdk::Address,
addrs: soroban_sdk::Vec,
)
Blocks multiple addresses at once from receiving funds. Restricted to ASSET_PROTECTION role.
asset_protector - address of the asset protectoraddrs - addresses to blockfn block_addrs_from_receiving(
env: soroban_sdk::Env,
asset_protector: soroban_sdk::Address,
addrs: soroban_sdk::Vec,
)
Batch unblock addresses. Restricted to ASSET_PROTECTION role.
asset_protector - address of the asset protectoraddrs - addresses to unblockfn unblock_addrs(
env: soroban_sdk::Env,
asset_protector: soroban_sdk::Address,
addrs: soroban_sdk::Vec,
)
Batch unblock addresses, to enable receiving the token. Restricted to ASSET_PROTECTION role.
asset_protector - address of the asset protectoraddrs - addresses to unblockfn unblock_addrs_from_receiving(
env: soroban_sdk::Env,
asset_protector: soroban_sdk::Address,
addrs: soroban_sdk::Vec,
)
Wipes the balance of a blocked address, and burns the tokens. Restricted to ASSET_PROTECTION role.
asset_protector - address of the asset protectoraddrs - blocked address to wipe.fn wipe_blocked_addr(
env: soroban_sdk::Env,
asset_protector: soroban_sdk::Address,
addr: soroban_sdk::Address,
)
Upgrade the contract with the new wasm hash. Restricted to the admin.
new_wasm_hash - new wasm hash to upgrade tofn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
fn allowance(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
spender: soroban_sdk::Address,
) -> i128
fn approve(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
spender: soroban_sdk::Address,
amount: i128,
expiration_ledger: u32,
)
fn balance(env: soroban_sdk::Env, addr: soroban_sdk::Address) -> i128
fn transfer(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
fn transfer_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
fn burn(env: soroban_sdk::Env, from: soroban_sdk::Address, amount: i128)
fn burn_from(
env: soroban_sdk::Env,
supply_controller: soroban_sdk::Address,
from: soroban_sdk::Address,
amount: i128,
)
fn decimals(env: soroban_sdk::Env) -> u32
fn name(env: soroban_sdk::Env) -> soroban_sdk::String
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
fn is_initialized(env: soroban_sdk::Env) -> bool
fn admin(env: soroban_sdk::Env) -> soroban_sdk::Address
fn pending_admin(env: soroban_sdk::Env) -> soroban_sdk::Address
fn grant_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
account: soroban_sdk::Address,
)
fn revoke_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
account: soroban_sdk::Address,
)
fn has_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
account: soroban_sdk::Address,
) -> bool
fn start_admin_transfer(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
fn accept_admin_transfer(env: soroban_sdk::Env)
fn pause(env: soroban_sdk::Env, pauser: soroban_sdk::Address)
fn unpause(env: soroban_sdk::Env, pauser: soroban_sdk::Address)
fn is_paused(env: soroban_sdk::Env) -> bool