KAP-20
The following standard outlines a smart contract interface and logic for fungible tokens on KUB that supports an adminTransfer function designed to create transactions on behalf of token holders if they have been a victim of a fraudulent transaction. It is proposed by deriving the ERC-20 standard of Ethereum with additional functions related to adminTransfer.
Token Interface
IAdminProjectRouter
isSuperAdmin
Check whether _addr is the Super Admin role in _project.
function isSuperAdmin(address _addr, string calldata _project) external view returns (bool)isAdmin
Check whether _addr is the Admin role in _project.
function isAdmin(address _addr, string calldata _project) external view returns (bool)IKYCBitkubChain
kycsLevel
Returns the KYC Level of _addr
function kycsLevel(address _addr) external view returns (uint256)IKAP20
totalSupply
Returns the total token supply.
decimals
Returns the number of decimals the token uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation.
NOTE: This method is optional in ERC-20. In KAP-20, this is a required method.
symbol
Returns the symbol of the token. E.g. "HIX".
NOTE: This method is optional in ERC-20. In KAP-20, this is a required method.
name
Returns the name of the token - e.g."MyToken".
NOTE: This method is optional in ERC-20. In KAP-20, this is a required method.
balanceOf
Returns the account balance of another account with address account.
NOTE: This method is optional in ERC-20. In KAP-20, this is a required method.
transfer
Transfers amount amount of tokens to address recipient, and MUST fire the Transfer event. The function SHOULD throw if the message caller's account balance does not have enough tokens to spend.
NOTE: Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event.
allowance
Returns the amount which spender is still allowed to withdraw from owner.
approve
Allows spender to withdraw from your account multiple times, up to the amount amount. If this function is called again, it overwrites the current allowance with amount.
NOTE: To prevent attack vectors, clients SHOULD make sure to create user interfaces in such a way that they set the allowance first to 0 before setting it to another value for the same spender. THOUGH The contract itself shouldn't enforce it, to allow backwards compatibility with contracts deployed before
adminApprove
Allows spender to withdraw from owner account multiple times, up to the amount amount. If this function is called again it overwrites the current allowance with amount. This method works similarly to the approve method.
NOTE: This function can only be called by the Admin and Super Admin. This function is designed to create transactions automatically on behalf of token holders if they have been a victim of a fraudulent transaction.
transferFrom
Transfers amount amount of tokens from address sender to address recipient, and MUST fire the Transfer event.
The transferFrom method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf. This can be used for example, to allow a contract to transfer tokens on your behalf and/or to charge fees in sub-currencies. The function SHOULD throw unless the sender account has deliberately authorized the sender of the message via some mechanism.
NOTE: Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event.
adminTransfer
Transfers amount amount of tokens from address sender to address recipient, and MUST fire the Transfer event.
NOTE: This function can only be called by the Committee address required in the constructor. This function is designed to create transactions automatically on behalf of token holders if they have been victims of a fraudulent transaction. This method works similarly to the transferFrom method.
Events
Transfer
MUST trigger when tokens are transferred, including zero value transfers.
A token contract which creates new tokens SHOULD trigger a Transfer event with the from address set to 0x0 when tokens are created.
Approval
MUST trigger on any successful call to approve(address spender, uint256 value).
IKToken
internalTransfer
Transfers amount amount of tokens to address recipient internally from sender, and MUST fire the Transfer event. The function SHOULD throw if the message caller's account balance does not have enough tokens to spend. Tokens can be transferred between internal addresses that have completed KYC for both the sender and the recipient using the internalTransfer function.
NOTE: This function can only be called by the Super Admin and the Transfer Router.
externalTransfer
Transfers amount amount of tokens to address recipient externally from sender, and MUST fire the Transfer event. The function SHOULD throw if the message caller's account balance does not have enough tokens to spend. The function externalTransfer allows tokens to be transferred between addresses that have only passed the sender's KYC verification process.
NOTE: This function can only be called by the Super Admin and the Transfer Router.
Last updated