Skip to main content

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

NameTypeDescription
iduint256ID of the asset
toaddressAddress of the user to whom the asset is minted
amountuint256Amount 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

NameTypeDescription
iduint256ID of the asset
fromaddressAddress of the user from whom the asset is burned
amountuint256Amount of the asset burned
proofbytes

AccountFreezeStatusChanged

event AccountFreezeStatusChanged(address account, bool status)

Event that is emitted when an account is frozen or unfrozen.

Parameters

NameTypeDescription
accountaddressAddress of the account
statusboolTrue 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

NameTypeDescription
toaddressAddress of the user to whom the asset is to be minted.
amountuint256Amount 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

NameTypeDescription
newURIstringNew URI of the assets.
iduint256ID 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

NameTypeDescription
iduint256ID of the asset to be burned.
fromaddress[]Array of addresses from which the asset is to be burned.
amountuint256[]Array of amounts of the asset to be burned.
proofbytesProof of the reason for burning the asset.

burn

function burn(uint256 id, uint256 amount) external

Function to burn assets.

Parameters

NameTypeDescription
iduint256ID of the asset to be burned.
amountuint256Amount 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

NameTypeDescription
accountaddressAddress of the account to freeze or unfreeze.
statusboolTrue 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

NameTypeDescription
accountaddressAddress of the account to check.

Return Values

NameTypeDescription
[0]boolTrue if the account is frozen, false otherwise.