ERC-20 Token Contract APIs
You can use the following methods related to token functionality in ERC-20 token contracts.
Token Configuration Methods
__ERC20Token_init- This method is called when a token contract is deployed. This method can be called only by a
Token Admin. initializeERC20Token- This method initializes an ERC-20 token. This method can be called only by a
Token Admin. getToken- This method gets an ERC-20 token. This method can be called only by a
Token Admin,Token Auditor,Org Admin, orOrg Auditor. decimals- This method returns the number of decimals places that were configured for a token. This method can be called only by a
Token Admin,Token Auditor,Org Admin, orOrg Auditor. cap- This method returns the cap value (the maximum total supply) for an ERC-20 token. This method can be called only by a
Token Admin,Token Auditor,Org Admin, orOrg Auditor. balanceOf- This method returns the current token balance for a specified user. This method can be called only by a
Token AdminorToken Auditor, or theOrg AdminorOrg Auditorof the specified organization.
Token Behavior Methods - Mintable Behavior
mint- This method mints ERC-20 tokens. This method can be called by any user with the minter role.
requestMint- This method can be called by any user with the minter role to send a request to the notary to create a specified amount of tokens.
approveMint- This method can be called by an approver with the notary role to approve a mint request for ERC-20 tokens.
rejectMint- This method can be called by an approver with the notary role to reject a mint request for ERC-20 tokens.
Token Behavior Methods - Burnable Behavior
burn- This method burns ERC-20 tokens. This method can be called by any user with the burner role.
burnFrom- This method can be called by any user with a delegated allowance.
requestBurn- This method can be called by any user with a burner role to approve a burn request for ERC-20 tokens.
approveBurn- This method can be called by an approver with the notary role to approve a burn request for ERC-20 tokens.
rejectBurn- This method can be called by an approver with the notary role to reject a burn request for ERC-20 tokens.
Token Behavior Methods - Transferable Behavior
transfer- This method can be called by any user with tokens to transfer them to another user.
batchTransfer- This method can be called by any user with tokens to transfer them in batches to other users.
Token Behavior Methods - Delegable Behavior
allowance- This method can be called by any user who owns tokens to delegate another user to spend them.
approve- This method can be called by any user who owns tokens to set the amount that a delegated spender can spend.
transferFrom- This method can be called by a user with a delegated allowance to transfer tokens to another user.
Token Behavior Methods - Pausable Behavior
paused- This method checks whether a contract is paused. This method can be called only by a
Token Admin,Token Auditor,Org Admin, orOrg Auditor. pause- This method pauses a contract. This method can be called only by a
Token Admin. unpause- This method starts a paused contract. This method can be called only by a
Token Admin.
Token Behavior Methods - Holdable Behavior
hold- This method can be called by any user with tokens to request a token transfer.
holdFrom- This method can be called by a delegated user with an allowance to hold tokens from another user's wallet address. This method requires the delegable behavior.
executeHold- This method can be called by an approver with the notary role to approve a hold request.
releaseHold- This method can be called by an approver with the notary role to reject a hold request.
updateNotary- This method can be called by an approver with the notary role to update the notary for a specified request.
getOnHoldBalanceWithOperationId- This method gets the hold balance for a specified operation ID. This method can be called only by a
Token AdminorToken Auditor,Org AdminorOrg Auditorof the specified organization, or by a transaction participant (sender, recipient, notary). getOnHoldDetailsWithOperationId- This method gets the hold details for a specified operation ID. This method can be called only by a
Token AdminorToken Auditor,Org AdminorOrg Auditorof the specified organization, or by a transaction participant (sender, recipient, notary). getAccountOnHoldBalance- This method gets the hold balance for a specified account. This method can be called only by a
Token AdminorToken Auditor,Org AdminorOrg Auditorof the specified organization, or by a transaction participant (sender, recipient, notary).
Token Behavior Methods - Multi-Level Approval Behavior
createOrupdateAccountPolicy- This method can be called by a
Token AdminorOrg Adminto create or update a policy for a specified account. getAccountPolicyById- This method gets account policy details for a specified policy ID. This method can be called by a
Token AdminorToken Auditor, orOrg AdminorOrg Auditorof the organization whose account policy will be fetched. getAccountPolicyById- This method gets account policy details for a specified user. This method can be called by any user.
deleteAccountPolicyById- This method deletes a policy for a specified policy ID. This method can be called by a
Token Admin, orOrg Adminof the organization that includes the user whose account policy will be deleted. createOrupdateApprovalPolicy- This method can be called by a
Token Admin. getApprovalPolicyById- This method gets approval policy details for a specified policy ID. This method can be called by a
Token AdminorToken Auditor. deleteApprovalPolicy- This method deletes a policy for a specified policy ID. This method can be called by a
Token Admin. getApprovalTransactionsById- This method gets the on-hold balance for a specified account. This method can be called by a
Token Admin,Token Auditor,Org Admin, orOrg Auditor. getApprovalStatusByOperationId- This method gets approval details for a specified hold request. This method can be called by a
Token Admin,Token Auditor,Org Admin, orOrg Auditor. approveTransaction- An approver can use this method to approve a hold transaction.
rejectTransaction- A notary can use this method to reject a hold transaction.
getTransferRestriction- This method returns the current transfer restriction configuration, including the lower and upper transaction limits. This method can be called by a
Token AdminorToken Auditor. setOrupdateTransferRestriction- This method updates the transfer restriction configuration by setting new lower and upper transaction limits. This method can be called by a
Token Admin.
Context Management Methods
setTokenContext- This method sets the token contract address for the account contract. This method can be called only by a
Token Admin. getTokenContext- This method gets the token contract address for the account contract. This method can be called by any user.
setGovernanceContext- This method sets the governance contract to use to manage the governance life cycle for the account contract. This method can be called only by a
Token Admin. getGovernanceContext- This method gets the govnerance context details. This method can be called by any user.
isDeploymentActive- This method checks whether the deployment is active. This method can be called by any user.