Solidity Smart Contract API
Oracle Blockchain Platform Enterprise Edition for Hyperledger Besu provides Solidity methods that you can use to work with Solidity smart contracts.
The API supports tokens based on the ERC-20 standard and the ERC-1155 standard. The ERC-20 and ERC-1155 implementations comprise an account smart contract and a token smart contract. The account smart contract provides identity and access control methods. The token smart contract provides functions specifically related to tokens.
ERC-20 Account Contract Methods
Methods for Account Management
-
createAccount - This method creates an account for a specified user. Accounts track a user's token balance and on-hold balance, and must be created for all users who will have tokens at any point. This method can be called only by a
Token Adminor anOrg Adminof the specified organization. -
deleteAccount - This method deletes the account of a specified user. An account can be deleted only if the token balance is zero. This method can be called only by a
Token Adminor anOrg Adminof the specified organization. -
getAccountStatus - This method gets the current status of the specified account. This method can be called only by a
Token Admin,Token Auditor,Org Adminof the specified organization, or by the specified user. -
getAccountByAddress - This method gets the account information for a specified user. This method can be called only by a
Token Admin,Token Auditor,Org Adminof the specified organization, or by the specified user. -
getAllAccounts - This method gets the account information for all accounts that fall in a specified range. This method can be called only by a
Token AdminorToken Auditor. -
activateAccount - This method activates a user account. This method can be called only by a
Token AdminorOrg Adminof the specified organization. -
suspendAccount - This method suspends a user account. To delete an account, the account balance must be zero. This method can be called only by a
Token AdminorOrg Adminof the specified organization. -
setMaxDailyAmount - This method sets the maximum amount of tokens that can be used in transactions daily. This method can be called only by a
Token AdminorOrg Adminof the specified organization. -
setMaxDailyTransactionCount - This method sets the maximum number of transactions that can be completed daily. This method can be called only by a
Token AdminorOrg Adminof the specified organization.
Methods for Administrator Management
-
addTokenAdmin - This method adds a user as a
Token Admin. This method can be called only by aToken Admin. -
removeTokenAdmin - This method removes a user as a
Token Admin. This method can be called only by aToken Admin. -
getAllTokenAdmins - This method returns a list of all users who are a
Token Admin. This method can be called only by theToken AdminorToken Auditor. -
isTokenAdmin - This method checks whether the specified user is a
Token Admin. This method can be called only by aToken Admin,Token Auditor,Org Admin, orOrg Auditor. -
addOrgAdmin - This method adds a user as a
Org Admin. This method can be called only by aToken AdminorOrg Adminof the specified organization. -
removeOrgAdmin - This method removes a user as an
Org Admin. This method can be called only by aToken AdminorOrg Adminof the specified organization. -
getAllOrgAdmins - This method returns a list of all users who are an
Org Admin. This method can be called only by theToken Admin,Token Auditor,Org Admin, orOrg Auditor. -
isOrgAdmin - This method checks whether the specified user is an
Org Admin. This method can be called only by aToken Admin,Token Auditor,Org Admin, orOrg Auditor.
Methods for Auditor Management
-
addTokenAuditor - This method adds a user as a
Token Auditor. This method can be called only by aToken Admin. -
removeTokenAuditor - This method removes a user as a
Token Auditor. This method can be called only by aToken Admin. -
getAllTokenAuditors - This method returns a list of all users who are a
Token Auditor. This method can be called only by theToken AdminorToken Auditor. -
isTokenAuditor - This method checks whether the specified user is a
Token Auditor. This method can be called by any user. -
addOrgAuditor - This method adds a user as a
Org Auditor. This method can be called only by aToken AdminorOrg Adminof the specified organization. -
removeOrgAuditor - This method removes a user as an
Org Auditor. This method can be called only by aToken AdminorOrg Adminof the specified organization. -
getAllOrgAuditors - This method returns a list of all users who are an
Org Auditor. This method can be called only by theToken Admin,Token Auditor,Org Admin, orOrg Auditor. -
isOrgAuditor - This method checks whether the specified user is an
Org Auditor. This method can be called by any user.
Methods for Role Management
-
addRole - This method adds a role to a specified user. This method can be called only by a
Token AdminorOrg Adminof the specified organization. -
removeRole - This method removes a role from a specified user. This method can be called only by a
Token AdminorOrg Adminof the specified organization. -
accountHasRole - This method checks whether a user has a specified role. This method can be called by any user.
ERC-20 Token Contract Methods
Methods for Token Configuration Management
-
__ERC20Token_init - This method is called when the 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 details for a token. This method can be called only by a
Token Admin,Token Auditor,Org Admin, orOrg Auditor. -
decimals - This method gets the decimal value for a token. This method can be called only by a
Token Admin,Token Auditor,Org Admin, orOrg Auditor.
-
__ERC20Token_init - This method is called when 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 details for a token. This method can be called only by a
Token Admin,Token Auditor,Org Admin, orOrg Auditor. -
cap - This method gets the maximum token supply (cap). This method can be called only by a
Token Admin,Token Auditor,Org Admin, orOrg Auditor. -
balanceOf - This method gets the token balance for the specified user. This method can be called only by a
Token Admin,Token Auditor,Org Admin,Org Auditor, or by the specified user.
-
mint - This method creates (mints) tokens. This method can be called by any user with the minter role.
-
batchMint - This method creates (mints) tokens for more than one user at a time. This method can be called by any user with the minter role.
-
requestMint - This method can be called by a minter to send a request to the notary to create a specified amount of tokens.
-
approveMint - This method can be called by a notary to approve a minting request.
-
rejectMint - This method can be called by a notary to reject a minting request.
Token Behavior Management - Burnable Behavior
-
burn - This method deactivates (burns) tokens. This method can be called by any user with the burner role.
-
batchBurn - This method burns tokens for more than one user at a time. This method can be called by any user with the burner role.
-
requestBurn - This method can be called by a burner to send a request to the notary to burn a specified amount of tokens.
-
approveBurn - This method can be called by a notary to approve a burning request.
-
rejectBurn - This method can be called by a notary to reject a burning request.
Token Behavior Management - Transferable Behavior
-
transfer - This method transfers tokens to a specified user. This method can be called by any user with tokens.
-
batchTransfer - This method transfers tokens to a specified list of users. This method can be called by any user with tokens.
Token Behavior Management - Delegable Behavior
-
allowance - This method delegates token spending to a specified user. This method can be called by any user with tokens.
-
approve - This method approves the amount of tokens for a specified delegated spender. This method can be called by any user with tokens.
-
transferFrom - Delegated spenders use this method to transfer tokens.
Token Behavior Management - Pausable Behavior
-
isPaused - This method checks whether the contract is paused. This method can be called only by a
Token Admin,Token Auditor,Org Admin, orOrg Auditor. -
pause - This method pauses the contract. This method can be called only by a
Token Admin. -
unpause - This method resumes the contract. This method can be called only by a
Token Admin.
Token Behavior Management - Holdable Behavior
-
hold - This method creates a hold on behalf of the token owner. This method can be called by any user with tokens.
-
executeHold - This method approves a hold request. This method can be called only by the previously specified notary.
-
releaseHold - This method rejects a hold request. This method can be called only by the previously specified notary.
-
getOnHoldBalanceWithOperationId - This method returns the on-hold balance for a specified operation ID. This method can be called by a
Token AdminorToken Auditor,Org AdminorOrg Auditorof the specified organization, or by a transaction participant (sender, recipient, notary). -
getAccountOnHoldBalance - This method returns the on-hold balance for a specified account. This method can be called by a
Token AdminorToken Auditor,Org AdminorOrg Auditorof the specified organization, or by a transaction participant (sender, recipient, notary).
ERC-1155 Account Contract Methods
Methods for Account Management
-
createAccount - This method creates an account for a specified user. Accounts track a user's token balance, and must be created for all users who will have tokens at any point. This method can be called only by a
Token Admin. -
deleteAccount - This method deletes the account of a specified user. An account can be deleted only if the token balance is zero. This method can be called only by a
Token Admin. -
getAccountStatus - This method gets the current status of the specified account. This method can be called only by a
Token Adminor by the specified user. -
getAccountByAddress - This method gets the account information for a specified user. This method can be called only by a
Token Adminor by the specified user. -
getAllAccounts - This method gets the account information for all accounts that fall in a specified range. This method can be called only by a
Token Admin. -
activateAccount - This method activates a user account. This method can be called only by a
Token Admin. -
suspendAccount - This method suspends a user account. To delete an account, the account balance must be zero. This method can be called only by a
Token Admin.
Methods for Administrator Management
-
addTokenAdmin - This method adds a user as a
Token Admin. This method can be called only by aToken Admin. -
removeTokenAdmin - This method removes a user as a
Token Admin. This method can be called only by aToken Admin. -
getAllTokenAdmins - This method returns a list of all users who are a
Token Admin. This method can be called only by theToken Admin. -
isTokenAdmin - This method checks whether the specified user is a
Token Admin. This method can be called only by aToken Admin.
Methods for Role Management
-
addRole - This method adds a role to a specified user. This method can be called only by a
Token Admin. -
removeRole - This method removes a role from a specified user. This method can be called only by a
Token AdminorOrg Adminof the specified organization. -
accountHasRole - This method checks whether a user has a specified role. This method can be called by any user.
-
addTokenSysRole - This method adds the
TOKEN_SYS_VAULT_ROLErole to a specified user. This method can be called only by aToken Admin. -
removeTokenSysRole - This method removes the
TOKEN_SYS_VAULT_ROLErole from a specified user. This method can be called only by aToken Admin. -
transferTokenSysRole - This method transfers the
TOKEN_SYS_VAULT_ROLErole from one user to another. This method can be called only by aToken Admin.
ERC-1155 Token Contract Methods
Methods for Token Configuration Management
-
__ERC1155Token_init - This method is called when the token contract is deployed. This method can be called only by a
Token Admin. -
saveNFTClass - This method saves NFT class information to the ledger. This method can be called only by a
Token Admin. -
createNonFungibleToken - This method mints NFTs. This method can be called only by a user with the minter role.
-
createFungibleToken - This method is called when the token contract is deployed. This method can be called only by a
Token Admin. -
getTokenById - This method gets details for a token. This method can be called only by a
Token Adminor token owner. -
geTokenDecimals - This method gets the decimal value for a token. This method can be called only by a
Token Admin.
-
tokenIdOf - This method gets the ID of a token. This method can be called only by a
Token Admin. -
balanceOf - This method gets the token balance for the specified user. This method can be called only by a
Token Adminor by the token owner. -
balanceOfBatch - This method gets the token balance for a list of users. This method can be called only by a
Token Adminor by the token owner. -
exists - This method checks whether a specified token exists. This method can be called only by a
Token Admin. -
totalSupply - This method checks gets the total supply of all tokens in the contract. This method can be called only by a
Token Admin. -
totalSupply - This method checks gets the total supply of a specified token in the contract. This method can be called only by a
Token Admin.
Token Behavior Management - Burnable Behavior
-
burnBatch - This method destroys (burns) ERC-1155 tokens in batch mode. The tokens must be initialized. This method can be called by any user with the burner role.
-
burnNFT - This method destroys (burns) a non-fungible token. The tokens must be initialized. This method can be called by any user with the burner role.
Token Behavior Management - Transferable Behavior
-
safeTransferFrom - This method transfers tokens from a sender to a receiver. This method can be called by any user who holds tokens.
-
safeBatchTransferFrom - This method transfers tokens from a sender to a receiver. This method can be called by any user who holds tokens.
Token Behavior Management - Delegable Behavior
-
setApprovalForAll - This method grants or revokes permission for an operator to transfer the caller's tokens, based on the
approvedparameter. This method can be called by any user who holds tokens. -
isApprovedForAll - This method checks whether an operator is approved to transfer tokens for a specified account. This method can be called by any user who holds tokens.
Token Behavior Management - Pausable Behavior
-
paused - This method checks whether the contract is paused. This method can be called by any user.
-
pause - This method pauses the contract. This method can be called only by a
Token Admin. -
unpause - This method resumes a paused contract. This method can be called only by a
Token Admin.
Token Behavior Management - Lockable Behavior