OCPOmniTokenManager

OCPOmniTokenManager

This contract is deployed on the source chain It is used by the router to create OmniTokens and mint/burn tokens It is also used by the timelock to add source tokens and update the router

createOmniToken: create a new OmniToken

omniMint: mint OmniTokens

omniBurn: burn OmniTokens

the settings can only be updated by the timelock

the timelock can call the following functions:

requestAddSourceTokens: add a source token

approveSourceTokens: approve a source token

updateRouter: update the router

updateTimeLock: update the timelock

This contract is used to manage the OmniTokens It is used by the router to create OmniTokens and mint/burn tokens

router

address router

timeLock

address timeLock

constructor

constructor() public

omniTokens

mapping(address => mapping(uint16 => address)) omniTokens

sourceTokens

mapping(address => mapping(uint16 => address)) sourceTokens

TokenCreated

event TokenCreated(address srcToken, uint16 srcChainId, address token)

onlyRouter

modifier onlyRouter()

onlyTimeLock

modifier onlyTimeLock()

createOmniToken

function createOmniToken(struct Structs.MintObj _mintParams, address _lzEndpoint, uint16 _srcChainId) external returns (address token)

_Create a new OmniToken

Requirements:

_mintParams.srcToken cannot be the zero address

_mintParams.srcChainId cannot be the zero address

_mintParams.name cannot be the zero address

_mintParams.symbol cannot be the zero address

_mintParams.amount cannot be the zero address

_mintParams.to cannot be the zero address

_lzEndpoint cannot be the zero address

_srcChainId cannot be the zero address_

Parameters

NameTypeDescription

_mintParams

struct Structs.MintObj

The mint parameters

_lzEndpoint

address

The endpoint of the Lazynode

_srcChainId

uint16

The source chain id

Return Values

NameTypeDescription

token

address

The address of the new OmniToken

omniMint

function omniMint(address _srcToken, uint16 _dstChainId, uint256 _amount, address _to) external returns (address token)

_Mint OmniTokens

Requirements:

_srcToken cannot be the zero address

_dstChainId cannot be the zero address

_amount cannot be the zero address

_to cannot be the zero address

only the router can call this function_

Parameters

NameTypeDescription

_srcToken

address

The address of the source token

_dstChainId

uint16

The destination chain id

_amount

uint256

The amount to mint

_to

address

The address to mint to

Return Values

NameTypeDescription

token

address

The address of the new OmniToken

omniBurn

function omniBurn(address _omniToken, uint256 _amount, address _from) external

_Burn OmniTokens

Requirements:

_omniToken cannot be the zero address

_amount cannot be the zero address

_from cannot be the zero address

only the router can call this function_

Parameters

NameTypeDescription

_omniToken

address

The address of the OmniToken

_amount

uint256

The amount to burn

_from

address

The address to burn from

requestAddSourceTokens

function requestAddSourceTokens(address[] _srcTokens, uint16[] _srcChainIds, address _omniToken) external

_Add a source token

Requirements:

_srcToken cannot be the zero address

_srcChainId cannot be the zero address

_omniToken cannot be the zero address

only the timelock can call this function_

Parameters

NameTypeDescription

_srcTokens

address[]

The address of the source token

_srcChainIds

uint16[]

The source chain id

_omniToken

address

The address of the OmniToken

approveSourceTokens

function approveSourceTokens(address[] _omniTokens, uint16 _srcChainId, address[] _srcTokens) external

_Approve a source token

Requirements:

_omniTokens cannot be the zero address

_srcChainId cannot be the zero address

_srcTokens cannot be the zero address

only the timelock can call this function_

Parameters

NameTypeDescription

_omniTokens

address[]

The address of the OmniToken

_srcChainId

uint16

The source chain id

_srcTokens

address[]

The address of the source token

updateRouter

function updateRouter(address _router) external

_Update the router

Requirements:

_router cannot be the zero address

only the timelock can call this function_

Parameters

NameTypeDescription

_router

address

The address of the router

updateTimeLock

function updateTimeLock(address _timeLock) external

_Update the timelock

Requirements:

_timeLock cannot be the zero address

only the timelock can call this function_

Parameters

NameTypeDescription

_timeLock

address

The address of the timelock