ODCdataManagersomnichainERC20

OmnichainERC20DataManager

Contract for managing an Omnichain ERC20 token using a Omnichain Fungible Token Data Object

_This contract is used to manage an Omnichain ERC20 token where a Data Object contract is used to store the token data on that chain.

 NOTE: This contract and the Data Object contract MUST be approved in the Data Index contract to interact with the given
 Data Point
 For the correct functioning of this contract, it must be registered as a handler in the Omnichain Fungible
 Fractions Data Object through the registerOmnichainIncreaseBalanceHandler function._

WrongParameters

error WrongParameters()

Error thrown when the parameters are wrong

NotRegisteredAsOmnichainIncreaseBalanceHandler

error NotRegisteredAsOmnichainIncreaseBalanceHandler()

Error thrown when the contract is not registered as an Omnichain Increase Balance handler

UnauthorizedCaller

error UnauthorizedCaller()

Error thrown when the caller is not the Fungible Token Data Object

_datapoint

DataPoint _datapoint

The Data Point identifier for the Fungible Token Data Object

omnichainFungibleDO

contract IDataObject omnichainFungibleDO

The Fungible Token Data Object

dataIndex

contract IDataIndex dataIndex

The Data Index implementation

_isRegisteredAsOmnichainIncreaseBalanceHandler

bool _isRegisteredAsOmnichainIncreaseBalanceHandler

Variable to know if the contract is registered as an Omnichain Increase Balance handler

constructor

constructor(bytes32 datapoint_, address _dataIndex, address _fungibleDO, string name_, string symbol_) public

registerOmnichainIncreaseBalanceHandler

function registerOmnichainIncreaseBalanceHandler() external

Function to register this contract as an omnichain increase balance handler NOTE: This function must be called after the contract is deployed

totalSupply

function totalSupply() public view returns (uint256)

Returns the value of tokens in existence.

balanceOf

function balanceOf(address account) public view returns (uint256)

Returns the value of tokens owned by account.

afterOmnichainFungibleTokenIncreaseBalanceOnTargetChain

function afterOmnichainFungibleTokenIncreaseBalanceOnTargetChain(OmnichainAddress from, address to, uint256 amount) external virtual returns (bool)

Function called after a token transfer on target chain

Parameters

NameTypeDescription
fromOmnichainAddressThe address from which the token was transferred
toaddressThe address to which the token was transferred
amountuint256The amount of the token transferred

Return Values

NameTypeDescription
[0]boolbool True if the callback was successful, false otherwise

_checkMinter

function _checkMinter() internal view

SHOULD throw an error if the sender is not allowed to mint

_writeSingleChainTransfer

function _writeSingleChainTransfer(address from, address to, uint256 amount) internal

_writeOmnichainTransfer

function _writeOmnichainTransfer(address from, OmnichainAddress to, uint256 amount, address payable refundAddress) internal