UnstBONE

Link to UnstBONE source code on Ethereum

UnstBONE contract is an ERC721 contract used by the KnBONE contract to manage withdrawal requests.

Variables

address public knBONE; - knBONE contract address. uint256 public tokenIdIndex; - totalSupply value of the contract. Burned NFTs are not taken into account, so it shows how many tokens were minted. mapping(address => uint256[]) public owner2Tokens; - for each address returns an array of tokens that this address owns. mapping(uint256 => uint256) public token2Index; - for each token returns the index in the owner2Tokens array. mapping(address => uint256[]) public address2Approved; - for each address returns an array of tokens that have been approved for this address. Does not take into account approvals via approvalForAll. mapping(uint256 => uint256) public tokenId2ApprovedIndex; - for each approved token returns the index in the returned array address2Approved.

Modifiers

isKnBONE() - requires the function caller to be knBONE.

Methods

initialize

function initialize(
        address _knBONE,
        address _dao
    ) external initializer

- initializer function, not called after initialization.

mint

Mint new token.

tokenID starts from 1, not from 0

burn

Burns the token.

approve

Rewritten 'approval' from ERC721, in addition to what it usually does, it also interacts with address2Approved and tokenId2ApprovedIndex.

isApprovedOrOwner

Shows whether the spender is authorized to use the token (approved or owned). An approve that was made via approvalForAll is taken into account.

setKnBONE

Sets knBONE contract address.

getOwnedTokens

Duplicates owner2Tokens - for each address returns an array of tokens that this address owns.

getApprovedTokens

Duplicates address2Approved - for each address returns an array of tokens that have been approved for this address. Does not take into account approvals via approvalForAll.

togglePause

Switches pause on/off.

Last updated