Master Smart Contract
Master Smart Contract is a contract which should collect operations from transmitters with those signatures. Also it has gov functions which can administrate protocols:
allow new protocol
add/remove protocol address to interact on specified chain
add/remove proposer address on specified chain wich can proposing new operations due EndPoint.propose() function.
update transmitters on protocol
add/remove executors on specified chain
set consensus target rate
MasterSmartContract__GovProtocolAlreadyInited
MasterSmartContract__GovProtocolIsNotInited
MasterSmartContract__InvalidProtocolId
MasterSmartContract__ForbiddenOperationWithGovProtocol
MasterSmartContract__DaoIsNotAllowedOnSpecifiedChain
MasterSmartContract__ProtocolIsNotInited
MasterSmartContract__ProtocolIsNotInitedOnChain
MasterSmartContract__ProtocolAlreadyAdded
MasterSmartContract__ProtocolIsNotAllowed
MasterSmartContract__ProtocolAddressAlreadyExist
MasterSmartContract__TransmitterIsAlreadyAdded
MasterSmartContract__TransmitterIsNotAllowed
MasterSmartContract__WatcherIsNotAllowed
MasterSmartContract__OperationIsAlreadyApproved
MasterSmartContract__TransmitterIsAlreadyApproved
MasterSmartContract__WatcherIsAlreadyApproved
MasterSmartContract__OperationDoesNotExist
MasterSmartContract__OpIsNotApproved
MasterSmartContract__OpExecutionAlreadyApproved
MasterSmartContract__SignatureCheckFailed
MasterSmartContract__ProtocolIsPaused
MasterSmartContract__AddrTooBig
MasterSmartContract__SelectorTooBig
MasterSmartContract__ParamsTooBig
AddAllowedProtocol
SetProtocolPause
AddAllowedProtocolAddress
RemoveAllowedProtocolAddress
AddAllowedProposerAddress
RemoveAllowedProposerAddress
UpdateTransmitters
RemoveTransmitter
AddExecutor
RemoveExecutor
SetConsensusTargetRate
NewOperation
NewProof
ProposalApproved
ProposalExecuted
ADMIN
SPOTTER
STAKING_CONTRACTS
govProtocolId
InitOnChainStages
InitOnChainInfo
AllowedProtocolInfo
isInit
allowedTransmitters
allowedTransmitters map of allowed transmitters which can work with this protocol
allowedExecutors
allowedExecutors map of allowed executors addresses which can execute operations on specified protocol on specified chain
allowedProposers
allowedProposers map of allowed proposers addresses which can propose operations on specified protocol on specified chain
operations
map with operations, key: opHash is a uint256(keccak256(OperationData operationData)), value - Operation which need to validate and execute
allowedProtocolInfo
map with allowed protocols info
protocolAddressToProtocolId
map to associate specified protocol contract on specified chain id with protocol id
govContractAddresses
map of gov contract addresses on other chains
rateDecimals
10000 = 100%
allowedWatchers
watcher wich should approve operation execution
numberOfAllowedWatchers
number of allowed watchers
watchersConsensusTargetRate
watchers consensus target rate
endPoint
proposer contract
betManager
transmitters bet manager
externalDeveloperHub
externalDeveloper manager
lastExecutedOpNonceInOrder
last executed ordered operation nonce for specified protocol on specified chain
used for ordered operations to notify executors about last executed operation nonce
_isAllowedTransmitterInternal
END of VARS *
isAllowedTransmitter
_isAllowedWatcherInternal
isAllowedWatcher
_isAllowedProtocolInternal
isAllowedProtocol
__chainId
initialize
Initialize
Parameters
Name | Type | Description |
---|---|---|
initAddr | address[2] |
setContracts
Set contracts addresses
_authorizeUpgrade
getSelector
proposeAddAllowedProtocol
Make proposal to adding allowed protocol to endPoint on specified chain
Parameters
Name | Type | Description |
---|---|---|
protocolId | bytes32 | protocol id |
chainId | uint256 | target chain id |
consensusTargetRate | uint256 | consensus target rate |
transmitters | address[] | protocol transmitters |
proposeAddAllowedProtocolAddress
Make proposal to adding allowed protocol contract address to endPoint on specified chain
Parameters
Name | Type | Description |
---|---|---|
protocolId | bytes32 | protocol id |
chainId | uint256 | target chain id |
protocolAddress | bytes | protocol contract address on specified chain for adding |
proposeRemoveAllowedProtocolAddress
Make proposal to removing allowed protocol contract address from endPoint on specified chain
Parameters
Name | Type | Description |
---|---|---|
protocolId | bytes32 | protocol id |
chainId | uint256 | target chain id |
protocolAddress | bytes | protocol contract address on specified chain for removing |
proposeAddAllowedProposerAddress
Make proposal to adding allowed proposer on specified chain
Parameters
Name | Type | Description |
---|---|---|
protocolId | bytes32 | protocol id |
chainId | uint256 | target chain id |
proposerAddress | bytes | proposer address on specified chain for adding |
proposeRemoveAllowedProposerAddress
Make proposal to removing allowed proposer on specified chain
Parameters
Name | Type | Description |
---|---|---|
protocolId | bytes32 | protocol id |
chainId | uint256 | target chain id |
proposerAddress | bytes | proposer address on specified chain for removing |
proposeAddExecutor
Make proposal to adding allowed executor to specified protocol on specified chain
Parameters
Name | Type | Description |
---|---|---|
protocolId | bytes32 | protocol id |
chainId | uint256 | target chain id |
executor | bytes | executor address or pubkey |
proposeRemoveExecutor
Make proposal to removing allowed executor to specified protocol on specified chain
Parameters
Name | Type | Description |
---|---|---|
protocolId | bytes32 | protocol id |
chainId | uint256 | target chain id |
executor | bytes | executor address or pubkey |
proposeAddTransmitters
Make proposal to adding allowed transmitter to specified protocol on specified chain
Parameters
Name | Type | Description |
---|---|---|
protocolId | bytes32 | protocol id |
chainId | uint256 | target chain id |
transmitters | address[] | transmitters array of evm address to add |
proposeRemoveTransmitters
Make proposal to removing allowed transmitter to specified protocol on specified chain
Parameters
Name | Type | Description |
---|---|---|
protocolId | bytes32 | protocol id |
chainId | uint256 | target chain id |
transmitters | address[] | transmitter array of evm address to remove |
proposeUpdateTransmitters
Make proposal to update allowed transmitter to specified protocol on specified chain
Parameters
Name | Type | Description |
---|---|---|
protocolId | bytes32 | protocol id |
chainId | uint256 | target chain id |
toAdd | address[] | transmitter array of evm addresses to add |
toRemove | address[] | transmitter array of evm addresses to remove |
proposeSetConsensusTargetRate
Make proposal to set consensus target rate
Parameters
Name | Type | Description |
---|---|---|
protocolId | bytes32 | protocol id |
chainId | uint256 | target chain id |
consensusTargetRate | uint256 | consensus target rate |
handleAddAllowedProtocol
Callback function for handle 2nd step of protocol inition on specified chain.
called by EndPoint from specified chain, after addAllowedProtocol processing
Parameters
Name | Type | Description |
---|---|---|
_params | bytes | encoded params |
initGovProtocol
Adding info about GOV protocol
Parameters
Name | Type | Description |
---|---|---|
_consensusTargetRate | uint256 | rate with 10000 decimals |
_transmitters | address[] | array of initial gov transmitters |
addGovProtocolAddress
add gov contract address and executors on specified chain
Parameters
Name | Type | Description |
---|---|---|
_chainId | uint256 | chain id |
_govAddress | bytes | address of gov contract on specified chain |
_executors | bytes[] | address of executors which will be execute operations on specified chain |
addProtocol
Adding new protocol by id
Parameters
Name | Type | Description |
---|---|---|
_protocolId | bytes32 | protocol Id (may be proto short name or number) |
_consensusTargetRate | uint256 | rate with 10000 decimals |
setProtocolPause
Pause/unpause protocol
Parameters
Name | Type | Description |
---|---|---|
_protocolId | bytes32 | protocol id |
_state | bool | true - pause, false - unpause |
addWatcher
Adding watcher to whitelist
Parameters
Name | Type | Description |
---|---|---|
_watcher | address | address of watcher to add |
removeWatcher
Removing watcher from whitelist
Parameters
Name | Type | Description |
---|---|---|
_watcher | address | address of watcher to remove |
setWatchersConsensusTargetRate
Removing watcher from whitelist
Parameters
Name | Type | Description |
---|---|---|
_rate | uint256 | rate |
addAllowedProtocolAddress
Adding chainId and protocol address to whitelist
Parameters
Name | Type | Description |
---|---|---|
_protocolId | bytes32 | protocol id |
_chainId | uint256 | chainId of this address of protocol contract |
_protocolAddress | bytes | protocol address of contract |
removeAllowedProtocolAddress
Removing protocol address from whitelist for specified protocol on specified chain
Parameters
Name | Type | Description |
---|---|---|
_protocolId | bytes32 | protocol id |
_chainId | uint256 | chain id |
_protocolAddress | bytes | protocol address to remove |
addAllowedProposerAddress
Adding proposer to whitelist for specified protocol on specified chain
Parameters
Name | Type | Description |
---|---|---|
_protocolId | bytes32 | protocol id |
_chainId | uint256 | chain id |
_proposerAddress | bytes | proposer address to add |
removeAllowedProposerAddress
Removing proposer from whitelist for specified protocol on specified chain
Parameters
Name | Type | Description |
---|---|---|
_protocolId | bytes32 | protocol id |
_chainId | uint256 | chain id |
_proposerAddress | bytes | proposer address to remove |
addExecutor
Adding executor to specified protocol on specified chain id
Parameters
Name | Type | Description |
---|---|---|
_protocolId | bytes32 | protocol id |
_chainId | uint256 | target chain id |
_executor | bytes | executor address or pubkey |
removeExecutor
Removing executor to specified protocol on specified chain id
Parameters
Name | Type | Description |
---|---|---|
_protocolId | bytes32 | protocol id |
_chainId | uint256 | target chain id |
_executor | bytes | executor address or pubkey |
updateTransmitters
Update transmitters to specified protocol
called by RoundManager and AgentManager
Parameters
Name | Type | Description |
---|---|---|
_protocolId | bytes32 | protocol id |
_newTransmitters | address[] | new selected transmitter's array |
removeTransmitter
Removing transmitters from whitelist called when transmitters was banned or slashed
Parameters
Name | Type | Description |
---|---|---|
_protocolId | bytes32 | protocol id |
_transmitter | address | address of transmitter to remove |
setConsensusTargetRate
Setting of target rate
Parameters
Name | Type | Description |
---|---|---|
_protocolId | bytes32 | protocol id |
_rate | uint256 | target rate with 10000 decimals |
getOpData
getter of operation data
Parameters
Name | Type | Description |
---|---|---|
opHash | uint256 | operation hash id |
Return Values
Name | Type | Description |
---|---|---|
[0] | struct OperationLib.OperationData | Operation Data struct |
getOpSigs
getter of operation proofs
Parameters
Name | Type | Description |
---|---|---|
opHash | uint256 | operation hash id |
Return Values
Name | Type | Description |
---|---|---|
[0] | struct OperationLib.Signature[] | current array of transmitter's signatures |
getProtocolInitStateOnChain
checkOperationsApproveStatus
Get array of opHashes, check it was approved and returns array of result
Parameters
Name | Type | Description |
---|---|---|
opHashArray | uint256[] | array of operation hashes |
Return Values
Name | Type | Description |
---|---|---|
resultArray | bool[] | array of bool values indicates that operation was approved or not |
checkOperationsExecuteStatus
Get array of opHashes, check it was executed and returns array of result
Parameters
Name | Type | Description |
---|---|---|
opHashArray | uint256[] | array of operation hashes |
Return Values
Name | Type | Description |
---|---|---|
resultArray | bool[] | array of bool values indicates that operation was executed or not |
checkOperationSignature
recover and check transmitter's signature
Parameters
Name | Type | Description |
---|---|---|
transmitter | address | transmitter's address |
opHash | bytes32 | hash of signer data |
sig | struct OperationLib.Signature | transmitter's signature |
proposeOperation
proposing an operation/approve an operation/give an operation of status approved
0xe1b3d28a
Parameters
Name | Type | Description |
---|---|---|
opData | struct OperationLib.OperationData | operation data |
sig | struct OperationLib.Signature | transmitter's signature |
approveOperationExecuting
approve operation was executed
Parameters
Name | Type | Description |
---|---|---|
opHash | uint256 | 1 |
isPaused
isInited
getTransmitters
Last updated