Contracts
Solidity API
Assets
This contract is used to manage tokenization of real world assets for Graphia Platform.
tokenCounter
uint256 tokenCounter
Token counter, used for generating unique token IDs
frozen
mapping(address => bool) frozen
Mapping that keeps track of froozen accounts
Created
event Created(uint256 id, address to, uint256 amount)
Event that is emitted when a new asset is created. To be more clear than Transfer events from ERC1155.
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | ID of the asset |
to | address | Address of the user to whom the asset is minted |
amount | uint256 | Amount of the asset minted |
Burned
event Burned(uint256 id, address from, uint256 amount, bytes proof)
Event that is emitted when an asset is burned. To be more clear than Transfer events from ERC1155.
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | ID of the asset |
from | address | Address of the user from whom the asset is burned |
amount | uint256 | Amount of the asset burned |
proof | bytes |
AccountFreezeStatusChanged
event AccountFreezeStatusChanged(address account, bool status)
Event that is emitted when an account is frozen or unfrozen.
Parameters
Name | Type | Description |
---|---|---|
account | address | Address of the account |
status | bool | True if the account is frozen, false if the account is unfrozen |
SenderIsFrozen
error SenderIsFrozen()
RecipientIsFrozen
error RecipientIsFrozen()
constructor
constructor(string initialURI, address initialOwner) public
supportsInterface
function supportsInterface(bytes4 interfaceId) public view returns (bool)
create
function create(address to, uint256 amount) external
Function to create a new asset.
Only admin can call this function.
Parameters
Name | Type | Description |
---|---|---|
to | address | Address of the user to whom the asset is to be minted. |
amount | uint256 | Amount of the asset to be minted. |
setURI
function setURI(string newURI, uint256 id) external
Function to set the URI after creating new asset.
Only admin can call this function.
Parameters
Name | Type | Description |
---|---|---|
newURI | string | New URI of the assets. |
id | uint256 | ID of the asset that caused the URI change. |
burnWithProof
function burnWithProof(uint256 id, address[] from, uint256[] amount, bytes proof) external
Function that allows admin to burn assets that are expired, fraudulent or any other reason.
Only admin can call this function.
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | ID of the asset to be burned. |
from | address[] | Array of addresses from which the asset is to be burned. |
amount | uint256[] | Array of amounts of the asset to be burned. |
proof | bytes | Proof of the reason for burning the asset. |
burn
function burn(uint256 id, uint256 amount) external
Function to burn assets.
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | ID of the asset to be burned. |
amount | uint256 | Amount of the asset to be burned. |
safeTransferFrom
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes data) public
See {IERC1155-safeTransferFrom}.
safeBatchTransferFrom
function safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] values, bytes data) public
See {IERC1155-safeBatchTransferFrom}.
setAccountFreezeStatus
function setAccountFreezeStatus(address account, bool status) external
Function to freeze or unfreeze an account.
Only admin can call this function.
Parameters
Name | Type | Description |
---|---|---|
account | address | Address of the account to freeze or unfreeze. |
status | bool | True to freeze the account, false to unfreeze the account. |
isFrozen
function isFrozen(address account) external view returns (bool)
Function to check if an account is frozen.
Parameters
Name | Type | Description |
---|---|---|
account | address | Address of the account to check. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | True if the account is frozen, false otherwise. |