Endpoint

EndPoint contract

Contract entry point for operation executing by executor to destination protocol Also contract contain GOV-protocol logic for adding and verify new protocols and transmitters

Endpoint__InvalidProtocolId

error Endpoint__InvalidProtocolId(bytes32)

Endpoint__ExecutorIsNotAllowed

error Endpoint__ExecutorIsNotAllowed(bytes32, address, address)

Endpoint__ExecutorIsAlreadyAllowed

error Endpoint__ExecutorIsAlreadyAllowed(bytes32, address)

Endpoint__ProtocolIsNotAllowed

error Endpoint__ProtocolIsNotAllowed(bytes32, address)

Endpoint__ProtocolIsNotAdded

error Endpoint__ProtocolIsNotAdded(bytes32)

Endpoint__OpIsNotApproved

error Endpoint__OpIsNotApproved(uint256)

Endpoint__OpIsAlreadyExecuted

error Endpoint__OpIsAlreadyExecuted(uint256)

Endpoint__OpIsNotForThisChain

error Endpoint__OpIsNotForThisChain(uint256)

Endpoint__IsNotAllowedProposer

error Endpoint__IsNotAllowedProposer(address)

Endpoint__ZeroTransmittersCount

error Endpoint__ZeroTransmittersCount(bytes32)

Endpoint__AddrTooBig

error Endpoint__AddrTooBig(bytes32)

Endpoint__SelectorTooBig

error Endpoint__SelectorTooBig(bytes32)

Endpoint__ParamsTooBig

error Endpoint__ParamsTooBig(bytes32)

ProposalExecuted

event ProposalExecuted(uint256 opHash, bool success, bytes ret)

Propose

event Propose(bytes32 protocolId, bool inOrder, uint256 nonce, uint256 dstChainId, bytes protocolAddress, bytes functionSelector, bytes params)

ADMIN

bytes32 ADMIN

GOV

bytes32 GOV

govProtocolId

bytes32 govProtocolId

Signature

struct Signature {
  uint8 v;
  bytes32 r;
  bytes32 s;
}

AllowedProtocolInfo

struct AllowedProtocolInfo {
  bool isCreated;
  uint256 consensusTargetRate;
}

numberOfAllowedTransmitters

mapping(bytes32 => uint256) numberOfAllowedTransmitters

allowedTransmitters

mapping(bytes32 => mapping(address => bool)) allowedTransmitters

executors

mapping(bytes32 => mapping(address => bool)) executors

allowedProposers

mapping(bytes32 => mapping(address => bool)) allowedProposers

allowedProtocolInfo

mapping(bytes32 => struct EndPoint.AllowedProtocolInfo) allowedProtocolInfo

protocol info map

protocolAddressToProtocolId

mapping(address => bytes32) protocolAddressToProtocolId

map of protocol contract address to protocol id

opExecutedMap

mapping(uint256 => bool) opExecutedMap

map of executed operations

rateDecimals

uint256 rateDecimals

10000 = 100%

masterSmartContract

bytes masterSmartContract

eobChainId

uint256 eobChainId

globalNonce

uint256 globalNonce

protocolNonce

mapping(bytes32 => uint256) protocolNonce

_isAllowedExecutorInternal

function _isAllowedExecutorInternal(bytes _protocolAddr) internal view

END of VARS *

isAllowedExecutor

modifier isAllowedExecutor(bytes _protocolAddr)

_isAllowedProtocolInternal

function _isAllowedProtocolInternal(bytes _protocolAddr) internal view

isAllowedProtocol

modifier isAllowedProtocol(bytes _protocolAddr)

_isAllowedProposerInternal

function _isAllowedProposerInternal(bytes32 protocolId) internal view

isAllowedProposer

modifier isAllowedProposer(bytes32 protocolId)

_isValidProtocol

function _isValidProtocol(bytes32 _protocolId) internal view

isValidProtocol

modifier isValidProtocol(bytes32 _protocolId)

initialize

function initialize(address[1] initAddr, uint256 _eobChainId) public

_authorizeUpgrade

function _authorizeUpgrade(address) internal

__chainId

function __chainId() internal view returns (uint256 id)

addGov

function addGov(address govAddress, uint256 consensusTargetRate, address[] govTransmitters, address[] govExecutors, address _masterSmartContract) external

Adding gov contract and first gov transmitters

Parameters

NameTypeDescription

govAddress

address

gov contract address

consensusTargetRate

uint256

consensus target rate for gov protocol

govTransmitters

address[]

initial gov transmitters addresses

govExecutors

address[]

initial gov executors addresses

_masterSmartContract

address

address of Master Smart Contract

addAllowedProtocol

function addAllowedProtocol(bytes32 _protocolId, uint256 _consensusTargetRate, address[] _transmitters) external

Adding protocol to whitelist

Parameters

NameTypeDescription

_protocolId

bytes32

protocol Id

_consensusTargetRate

uint256

consensus target rate

_transmitters

address[]

initial array of transmitters

addAllowedProtocolAddress

function addAllowedProtocolAddress(bytes32 _protocolId, address _protocolAddress) external

Adding protocol contract address to whitelist

Parameters

NameTypeDescription

_protocolId

bytes32

protocol id

_protocolAddress

address

protocol contract address

removeAllowedProtocolAddress

function removeAllowedProtocolAddress(bytes32 _protocolId, address _protocolAddress) external

Removing protocol contract address from whitelist

Parameters

NameTypeDescription

_protocolId

bytes32

protocol id

_protocolAddress

address

protocol contract address

addAllowedProposer

function addAllowedProposer(bytes32 _protocolId, address _proposer) external

Adding proposer to whitelist

Parameters

NameTypeDescription

_protocolId

bytes32

_proposer

address

address of proposer to add

removeAllowedProposer

function removeAllowedProposer(bytes32 _protocolId, address _proposer) external

Removing proposer to whitelist

Parameters

NameTypeDescription

_protocolId

bytes32

_proposer

address

address of proposer to remove

addExecutor

function addExecutor(bytes32 _protocolId, address _executor) external

Adding executor to whitelist

Parameters

NameTypeDescription

_protocolId

bytes32

protocol id

_executor

address

address of executor to add

removeExecutor

function removeExecutor(bytes32 _protocolId, address _executor) external

Removing executor from whitelist

Parameters

NameTypeDescription

_protocolId

bytes32

protocol address

_executor

address

address of executor to remove

addTransmitters

function addTransmitters(bytes32 _protocolId, address[] _transmitters) external payable

Adding transmitters to whitelist (payable is cheaper in gas cost)

Parameters

NameTypeDescription

_protocolId

bytes32

protocol id

_transmitters

address[]

array with addresses of transmitters to add

removeTransmitters

function removeTransmitters(bytes32 _protocolId, address[] _transmitters) external payable

Removing transmitters from whitelist (payable is cheaper in gas cost)

Parameters

NameTypeDescription

_protocolId

bytes32

protocol address

_transmitters

address[]

array with addresses of transmitters to remove

setConsensusTargetRate

function setConsensusTargetRate(bytes32 _protocolId, uint256 rate) external

Setting of target rate

Parameters

NameTypeDescription

_protocolId

bytes32

protocol id

rate

uint256

target rate

checkOperationsExecuteStatus

function checkOperationsExecuteStatus(uint256[] opHashArray) public view returns (bool[] resultArray)

Get array of opHashes, check it was executed and returns array of result

Parameters

NameTypeDescription

opHashArray

uint256[]

array of operation hashes

Return Values

NameTypeDescription

resultArray

bool[]

array of bool values indicates that operation was executed or not

executeOperation

function executeOperation(struct OperationLib.OperationData opData, struct EndPoint.Signature[] transmitterSigs) external payable

execute approved operation

Parameters

NameTypeDescription

opData

struct OperationLib.OperationData

1

transmitterSigs

struct EndPoint.Signature[]

2

checkProposeData

function checkProposeData(bytes32 protocolId, uint256 protocolAddressLen, uint256 functionSelectorLen, uint256 paramsLen) internal pure

propose

function propose(bytes32 protocolId, uint256 dstChainId, bytes protocolAddress, bytes functionSelector, bytes params) external

function of emitting event Propose for catching by transmitters

Parameters

NameTypeDescription

protocolId

bytes32

protocol id to interact

dstChainId

uint256

dest chain id

protocolAddress

bytes

dest protocol address is bytes32 cause dstChainId may be non-EVM

functionSelector

bytes

dest protocol function id, for EVM is encoded abi func selector, for non-EVM may be func signature or whole func name

params

bytes

function params for dest protocol function

proposeInOrder

function proposeInOrder(bytes32 protocolId, uint256 dstChainId, bytes protocolAddress, bytes functionSelector, bytes params) external

function of emitting event Propose with order for catching by transmitters

Parameters

NameTypeDescription

protocolId

bytes32

protocol id to interact

dstChainId

uint256

dest chain id

protocolAddress

bytes

dest protocol address is bytes32 cause dstChainId may be non-EVM

functionSelector

bytes

dest protocol function id, for EVM is encoded abi func selector, for non-EVM may be func signature or whole func name

params

bytes

function params for dest protocol function

Last updated