Request form
Cookbook may introduce a token in the future. Share and contribute to be eligible for future airdrops.
close icon
relevant tag icon
UMA Deposit and Voting Bridge
copy icon
UMA
• version 1.0.0
Bridge
Voting
Audited

UMA Deposit and Voting Bridge

Audited

Facilitates deposits, creation and voting of deposit proposals, and deposit executions.

*Visit desktop site to download or deploy

Version

1.0.0

Creator

UMA

Last Publish

11/5/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
_onlyAdminOrRelayer() :
This function checks if the sender of the message has either the DEFAULT_ADMIN_ROLE or the RELAYER_ROLE. If the sender does not have either of these roles, the function will throw an error. This function is used to ensure that only users with the appropriate roles can access certain functions. (autogenerated documentation)
_onlyAdmin() :
This function is a private view function that checks if the sender of the message has the default admin role. If the sender does not have the default admin role, an error message is thrown. This function is used to ensure that only users with the default admin role can access certain functions. (autogenerated documentation)
_onlyRelayers() :
This function is a private view function that checks if the sender has the relayer role. It does this by calling the hasRole() function, which checks if the sender has the specified role. If the sender does not have the relayer role, an error is thrown. (autogenerated documentation)
isRelayer(address) :
This function checks if a given address has the role of a relayer. It does this by calling the hasRole() function, which checks if the given address has the specified role. If the address has the role, the function returns true, otherwise it returns false. (autogenerated documentation)
renounceAdmin(address) :
This function allows an admin to renounce their admin role and grant the admin role to a new address. It does this by calling the grantRole() and renounceRole() functions, which are used to grant and revoke roles respectively. The DEFAULT_ADMIN_ROLE is a constant that defines the admin role. The function can only be called by an admin, as specified by the onlyAdmin modifier. (autogenerated documentation)
adminPauseTransfers() :
This function pauses all transfers of the token contract. It can only be called by an admin, and it works by calling the internal _pause() function. (autogenerated documentation)
adminUnpauseTransfers() :
This function is used to unpause the transfers of tokens on the blockchain. It is an external function that can only be called by an admin. It works by calling the internal _unpause() function which will enable the transfers of tokens on the blockchain. (autogenerated documentation)
adminChangeRelayerThreshold(uint256) :
This function allows an admin to change the relayer threshold of the contract. The relayer threshold is a value that determines the minimum amount of tokens that must be held by a relayer in order to be eligible to receive rewards for relaying transactions. The function takes in a new threshold value as an argument and sets the relayer threshold to this new value. It then emits an event to notify other users of the change. (autogenerated documentation)
adminAddRelayer(address) :
This function allows an admin to add a relayer to the system. It checks to make sure that the address provided does not already have the relayer role, and if it does not, it grants the relayer role to the address and emits an event to notify that the relayer has been added. It also increments the total number of relayers. (autogenerated documentation)
adminRemoveRelayer(address) :
This function allows an admin to remove a relayer from the system. It first checks that the address provided has the relayer role, and if so, revokes the role and emits an event to signal that the relayer has been removed. It then decrements the total number of relayers. (autogenerated documentation)
adminSetResource(address,bytes32,address) :
This function allows an admin to set a resource ID and its associated token address. It does this by first mapping the resource ID to the handler address in the _resourceIDToHandlerAddress mapping. It then calls the setResource() function on the IERCHandler contract, passing in the resource ID and token address as parameters. This function sets the resource ID and token address in the IERCHandler contract, allowing users to interact with the resource. (autogenerated documentation)
adminSetGenericResource(address,bytes32,address,bytes4,bytes4) :
This function allows an admin to set a generic resource in the system. It takes in the address of the handler contract, a resource ID, the address of the contract to be set, the signature of the deposit function, and the signature of the execute function. It then stores the handler address in a mapping and calls the setResource function on the handler contract, passing in the resource ID, contract address, deposit function signature, and execute function signature. (autogenerated documentation)
adminSetBurnable(address,address) :
This function allows an admin to set a token as burnable. It does this by taking in two parameters, the address of the handler contract and the address of the token contract. It then creates an instance of the IERCHandler contract using the handler address and calls the setBurnable() function, passing in the token address as a parameter. This function sets the token as burnable, allowing it to be burned. (autogenerated documentation)
getProposal(uint8,uint64,bytes32) :
This function retrieves a Proposal from the _proposals mapping. The _proposals mapping is a mapping of uint72 (which is a combination of the originChainID and the depositNonce) to a mapping of bytes32 (the dataHash) to a Proposal. The function takes in the originChainID, depositNonce, and dataHash as parameters and returns the Proposal associated with the given parameters. (autogenerated documentation)
adminChangeFee(uint256) :
This function allows an admin to change the fee associated with the contract. It takes in a uint256 value as an argument, which is the new fee. The function first checks to make sure that the new fee is not the same as the current fee, and then sets the _fee variable to the new fee. (autogenerated documentation)
adminWithdraw(address,address,address,uint256) :
This function allows an admin to withdraw a specified amount of a token from the IERC Handler contract. It takes in four parameters: the address of the IERC Handler contract, the address of the token to be withdrawn, the address of the recipient, and the amount or token ID to be withdrawn. The function then calls the withdraw function of the IERC Handler contract, passing in the token address, recipient address, and amount or token ID as parameters. The withdraw function then transfers the specified amount of the token from the IERC Handler contract to the recipient address. (autogenerated documentation)
deposit(uint8,bytes32) :
This function allows users to deposit funds to a specific destination chain. It requires a fee to be paid, and the resourceID and data associated with the deposit to be provided. The function then checks that the fee is correct and that the resourceID is mapped to a handler address. It then increments the deposit count for the destination chain and stores the data associated with the deposit. Finally, it calls the deposit function on the handler address, passing in the resourceID, destination chain, deposit nonce, sender address, and data. An event is then emitted to indicate that the deposit was successful. (autogenerated documentation)
voteProposal(uint8,uint64,bytes32,bytes32) :
This function is used to vote on a proposal. It takes in the chainID, depositNonce, resourceID, and dataHash as parameters. It first checks to make sure that there is a handler for the resourceID, that the proposal has not already been passed/executed/cancelled, and that the sender has not already voted on the proposal. If the proposal is active, it adds the sender to the list of yes votes. If the proposal has expired, it sets the status to cancelled. If the proposal is still active, it checks to see if the number of yes votes is greater than or equal to the relayer threshold. If so, it sets the status to passed. Finally, it emits an event (autogenerated documentation)
cancelProposal(uint8,uint64,bytes32) :
This function allows an admin or relayer to cancel a proposal. It takes three parameters: the chain ID, the deposit nonce, and the data hash. It first creates a nonceAndID variable by combining the deposit nonce and the chain ID. It then looks up the proposal in the _proposals mapping using the nonceAndID and dataHash parameters. It then checks that the proposal has not already been cancelled and that the block number is greater than the expiry threshold. If these checks pass, the proposal status is set to Cancelled and a ProposalEvent is emitted. (autogenerated documentation)
executeProposal(uint8,uint64,bytes32) :
This function is used to execute a proposal that has been passed by the relayers. It takes in the chainID, depositNonce, data, and resourceID as parameters. It first checks that the proposal is active and has been passed, and that the data matches the dataHash stored in the proposal. It then sets the proposal status to Executed and calls the executeProposal function on the depositHandler associated with the resourceID. Finally, it emits a ProposalEvent with the chainID, depositNonce, proposal status, resourceID, and dataHash. (autogenerated documentation)
transferFunds(address,uint256[]) :
This function is used to transfer funds from the contract to a list of addresses. It takes two parameters, an array of addresses and an array of amounts. It then iterates through the arrays, sending the corresponding amount to each address. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i uma-voting-bridge
copy icon

Last Publish

11/5/2022

Version

1.0.0

Creator

UMA

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.