Struct dao::core_contracts::KycNftContract
source · pub struct KycNftContract { /* private fields */ }
Expand description
NFT contract that tells the system if user is KYC’d. Kyc Owned Nft contract acts like an erc-721 token and derives most of erc-721 standard.
Kyc Owned Nft token is mintable and burnable but the caller needs to have permissions to perform those actions.
Implementations§
source§impl KycNftContract
impl KycNftContract
sourcepub fn init(&mut self, name: String, symbol: String, base_uri: TokenUri)
pub fn init(&mut self, name: String, symbol: String, base_uri: TokenUri)
Contract constructor.
Initializes DaoNft
module.
sourcepub fn propose_new_owner(&mut self, owner: Address)
pub fn propose_new_owner(&mut self, owner: Address)
Changes the ownership of the contract. Transfers ownership to the owner
.
Only the current owner is permitted to call this method.
Read more
sourcepub fn accept_new_owner(&mut self)
pub fn accept_new_owner(&mut self)
Accepts the new owner proposition. This can be called only by the proposed owner.
Read more
sourcepub fn add_to_whitelist(&mut self, address: Address)
pub fn add_to_whitelist(&mut self, address: Address)
Adds a new address to the whitelist.
sourcepub fn remove_from_whitelist(&mut self, address: Address)
pub fn remove_from_whitelist(&mut self, address: Address)
Remove address from the whitelist.
sourcepub fn is_whitelisted(&self, address: Address) -> bool
pub fn is_whitelisted(&self, address: Address) -> bool
Checks whether the given address is added to the whitelist.
sourcepub fn name(&self) -> String
pub fn name(&self) -> String
Returns a descriptive name for a collection of tokens in this contract.
sourcepub fn owner_of(&self, token_id: &TokenId) -> Address
pub fn owner_of(&self, token_id: &TokenId) -> Address
Returns the address of the owner of the token.
If the given token_id
does not exist the None value is returned.
sourcepub fn token_id(&self, address: Address) -> Option<TokenId>
pub fn token_id(&self, address: Address) -> Option<TokenId>
Returns the token id for a given address
.
If the owner
does not own any token the None value is returned.
sourcepub fn balance_of(&self, owner: &Address) -> U256
pub fn balance_of(&self, owner: &Address) -> U256
Returns the number of tokens owned by owner
.
sourcepub fn total_supply(&self) -> Balance
pub fn total_supply(&self) -> Balance
Returns the total number of tokens.
sourcepub fn token_uri(&self, token_id: TokenId) -> TokenUri
pub fn token_uri(&self, token_id: TokenId) -> TokenUri
Returns a distinct Uniform Resource Identifier (URI) for a given asset.
sourcepub fn mint(&mut self, to: Address)
pub fn mint(&mut self, to: Address)
Creates a new token with the next id and transfers it to a new owner.
Increments the total supply and the balance of the to
address.
§Note
Only whitelisted addresses are permitted to call this function.
Each user is entitled to own only one token.
§Errors
UserAlreadyOwnsToken
if theto
address already owns a token.
§Events
Transfer
event when minted successfully.
Trait Implementations§
source§impl Clone for KycNftContract
impl Clone for KycNftContract
source§fn clone(&self) -> KycNftContract
fn clone(&self) -> KycNftContract
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more