View Source: contracts/governance/Timelock.sol
↗ Extends: ErrorDecoder, ITimelock ↘ Derived Contracts: Administered, TimelockHarness
Constants & Variables
uint256 public constant GRACE_PERIOD;
uint256 public constant MINIMUM_DELAY;
uint256 public constant MAXIMUM_DELAY;
address public admin;
address public pendingAdmin;
uint256 public delay;
mapping(bytes32 => bool) public queuedTransactions;
Events
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint256 indexed newDelay);
event CancelTransaction(bytes32 indexed txHash, address indexed target, uint256 value, string signature, bytes data, uint256 eta);
event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint256 value, string signature, bytes data, uint256 eta);
event QueueTransaction(bytes32 indexed txHash, address indexed target, uint256 value, string signature, bytes data, uint256 eta);
- delay()
- GRACE_PERIOD()
- acceptAdmin()
- queuedTransactions(bytes32 hash)
- queueTransaction(address target, uint256 value, string signature, bytes data, uint256 eta)
- cancelTransaction(address target, uint256 value, string signature, bytes data, uint256 eta)
- executeTransaction(address target, uint256 value, string signature, bytes data, uint256 eta)
- constructor(address admin_, uint256 delay_)
- constructor()
- setDelay(uint256 delay_)
- acceptAdmin()
- setPendingAdmin(address pendingAdmin_)
- queueTransaction(address target, uint256 value, string signature, bytes data, uint256 eta)
- cancelTransaction(address target, uint256 value, string signature, bytes data, uint256 eta)
- executeTransaction(address target, uint256 value, string signature, bytes data, uint256 eta)
- getBlockTimestamp()
function delay() external view
returns(uint256)
Source Code
function delay() external view returns (uint256);
function GRACE_PERIOD() external view
returns(uint256)
Source Code
function GRACE_PERIOD() external view returns (uint256);
⤿ Overridden Implementation(s): ITimelock.acceptAdmin,Timelock.acceptAdmin
function acceptAdmin() external nonpayable
Source Code
function acceptAdmin() external;
function queuedTransactions(bytes32 hash) external view
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
hash | bytes32 |
Source Code
function queuedTransactions(bytes32 hash) external view returns (bool);
⤿ Overridden Implementation(s): ITimelock.queueTransaction,Timelock.queueTransaction
function queueTransaction(address target, uint256 value, string signature, bytes data, uint256 eta) external nonpayable
returns(bytes32)
Arguments
Name | Type | Description |
---|---|---|
target | address | |
value | uint256 | |
signature | string | |
data | bytes | |
eta | uint256 |
Source Code
function queueTransaction(
address target,
uint256 value,
string calldata signature,
bytes calldata data,
uint256 eta
) external returns (bytes32);
⤿ Overridden Implementation(s): ITimelock.cancelTransaction,Timelock.cancelTransaction
function cancelTransaction(address target, uint256 value, string signature, bytes data, uint256 eta) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
target | address | |
value | uint256 | |
signature | string | |
data | bytes | |
eta | uint256 |
Source Code
function cancelTransaction(
address target,
uint256 value,
string calldata signature,
bytes calldata data,
uint256 eta
) external;
⤿ Overridden Implementation(s): ITimelock.executeTransaction,Timelock.executeTransaction
function executeTransaction(address target, uint256 value, string signature, bytes data, uint256 eta) external payable
returns(bytes)
Arguments
Name | Type | Description |
---|---|---|
target | address | |
value | uint256 | |
signature | string | |
data | bytes | |
eta | uint256 |
Source Code
function executeTransaction(
address target,
uint256 value,
string calldata signature,
bytes calldata data,
uint256 eta
) external payable returns (bytes memory);
Function called on instance deployment of the contract.
function (address admin_, uint256 delay_) public nonpayable
Arguments
Name | Type | Description |
---|---|---|
admin_ | address | Governance contract address. |
delay_ | uint256 | Time to wait for queued transactions to be executed. |
Source Code
tor(address admin_, uint256 delay_) public {
require(
delay_ >= MINIMUM_DELAY,
"Timelock::constructor: Delay must exceed minimum delay."
);
require(
delay_ <= MAXIMUM_DELAY,
"Timelock::setDelay: Delay must not exceed maximum delay."
);
admin = admin_;
delay = delay_;
}
/*
Fallback function is to react to receiving value (rBTC).
function () external payable
Source Code
() external payable {}
/*
Set a new delay when executing the contract calls.
function setDelay(uint256 delay_) public nonpayable
Arguments
Name | Type | Description |
---|---|---|
delay_ | uint256 | The amount of time to wait until execution. |
Source Code
setDelay(uint256 delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(
delay_ <= MAXIMUM_DELAY,
"Timelock::setDelay: Delay must not exceed maximum delay."
);
delay = delay_;
emit NewDelay(delay);
}
/*
⤾ overrides ITimelock.acceptAdmin
Accept a new admin for the timelock.
function acceptAdmin() public nonpayable
Source Code
acceptAdmin() public {
require(
msg.sender == pendingAdmin,
"Timelock::acceptAdmin: Call must come from pendingAdmin."
);
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
/*
Set a new pending admin for the timelock.
function setPendingAdmin(address pendingAdmin_) public nonpayable
Arguments
Name | Type | Description |
---|---|---|
pendingAdmin_ | address | The new pending admin address. |
Source Code
setPendingAdmin(address pendingAdmin_) public {
require(
msg.sender == address(this),
"Timelock::setPendingAdmin: Call must come from Timelock."
);
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
/*
⤾ overrides ITimelock.queueTransaction
Queue a new transaction from the governance contract.
function queueTransaction(address target, uint256 value, string signature, bytes data, uint256 eta) public nonpayable
returns(bytes32)
Arguments
Name | Type | Description |
---|---|---|
target | address | The contract to call. |
value | uint256 | The amount to send in the transaction. |
signature | string | The stanndard representation of the function called. |
data | bytes | The ethereum transaction input data payload. |
eta | uint256 | Estimated Time of Accomplishment. The timestamp that the proposal will be available for execution, set once the vote succeeds. |
Source Code
queueTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public returns (bytes32) {
require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
require(
eta >= getBlockTimestamp().add(delay),
"Timelock::queueTransaction: Estimated execution block must satisfy delay."
);
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
/*
⤾ overrides ITimelock.cancelTransaction
Cancel a transaction.
function cancelTransaction(address target, uint256 value, string signature, bytes data, uint256 eta) public nonpayable
Arguments
Name | Type | Description |
---|---|---|
target | address | The contract to call. |
value | uint256 | The amount to send in the transaction. |
signature | string | The stanndard representation of the function called. |
data | bytes | The ethereum transaction input data payload. |
eta | uint256 | Estimated Time of Accomplishment. The timestamp that the proposal will be available for execution, set once the vote succeeds. |
Source Code
cancelTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public {
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
/*
⤾ overrides ITimelock.executeTransaction
Executes a previously queued transaction from the governance.
function executeTransaction(address target, uint256 value, string signature, bytes data, uint256 eta) public payable
returns(bytes)
Arguments
Name | Type | Description |
---|---|---|
target | address | The contract to call. |
value | uint256 | The amount to send in the transaction. |
signature | string | The stanndard representation of the function called. |
data | bytes | The ethereum transaction input data payload. |
eta | uint256 | Estimated Time of Accomplishment. The timestamp that the proposal will be available for execution, set once the vote succeeds. |
Source Code
executeTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public payable returns (bytes memory) {
require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
require(
queuedTransactions[txHash],
"Timelock::executeTransaction: Transaction hasn't been queued."
);
require(
getBlockTimestamp() >= eta,
"Timelock::executeTransaction: Transaction hasn't surpassed time lock."
);
require(
getBlockTimestamp() <= eta.add(GRACE_PERIOD),
"Timelock::executeTransaction: Transaction is stale."
);
queuedTransactions[txHash] = false;
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call.value(value)(callData);
if (!success) {
if (returnData.length <= ERROR_MESSAGE_SHIFT) {
revert("Timelock::executeTransaction: Transaction execution reverted.");
} else {
revert(_addErrorMessage("Timelock::executeTransaction: ", string(returnData)));
}
}
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
/*
A function used to get the current Block Timestamp.
function getBlockTimestamp() internal view
returns(uint256)
Source Code
getBlockTimestamp() internal view returns (uint256) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
}
- Address
- Administered
- AdminRole
- AdvancedToken
- AdvancedTokenStorage
- Affiliates
- AffiliatesEvents
- ApprovalReceiver
- BProPriceFeed
- CheckpointsShared
- Constants
- Context
- DevelopmentFund
- DummyContract
- EnumerableAddressSet
- EnumerableBytes32Set
- EnumerableBytes4Set
- ERC20
- ERC20Detailed
- ErrorDecoder
- Escrow
- EscrowReward
- FeedsLike
- FeesEvents
- FeeSharingCollector
- FeeSharingCollectorProxy
- FeeSharingCollectorStorage
- FeesHelper
- FourYearVesting
- FourYearVestingFactory
- FourYearVestingLogic
- FourYearVestingStorage
- GenericTokenSender
- GovernorAlpha
- GovernorVault
- IApproveAndCall
- IChai
- IContractRegistry
- IConverterAMM
- IERC1820Registry
- IERC20_
- IERC20
- IERC777
- IERC777Recipient
- IERC777Sender
- IFeeSharingCollector
- IFourYearVesting
- IFourYearVestingFactory
- IFunctionsList
- ILiquidityMining
- ILiquidityPoolV1Converter
- ILoanPool
- ILoanToken
- ILoanTokenLogicBeacon
- ILoanTokenLogicModules
- ILoanTokenLogicProxy
- ILoanTokenModules
- ILoanTokenWRBTC
- ILockedSOV
- IMoCState
- IModulesProxyRegistry
- Initializable
- InterestUser
- IPot
- IPriceFeeds
- IPriceFeedsExt
- IProtocol
- IRSKOracle
- ISovryn
- ISovrynSwapNetwork
- IStaking
- ISwapsImpl
- ITeamVesting
- ITimelock
- IV1PoolOracle
- IVesting
- IVestingFactory
- IVestingRegistry
- IWrbtc
- IWrbtcERC20
- LenderInterestStruct
- LiquidationHelper
- LiquidityMining
- LiquidityMiningConfigToken
- LiquidityMiningProxy
- LiquidityMiningStorage
- LoanClosingsEvents
- LoanClosingsLiquidation
- LoanClosingsRollover
- LoanClosingsShared
- LoanClosingsWith
- LoanClosingsWithoutInvariantCheck
- LoanInterestStruct
- LoanMaintenance
- LoanMaintenanceEvents
- LoanOpenings
- LoanOpeningsEvents
- LoanParamsStruct
- LoanSettings
- LoanSettingsEvents
- LoanStruct
- LoanToken
- LoanTokenBase
- LoanTokenLogicBeacon
- LoanTokenLogicLM
- LoanTokenLogicProxy
- LoanTokenLogicStandard
- LoanTokenLogicStorage
- LoanTokenLogicWrbtc
- LoanTokenSettingsLowerAdmin
- LockedSOV
- MarginTradeStructHelpers
- Medianizer
- ModuleCommonFunctionalities
- ModulesCommonEvents
- ModulesProxy
- ModulesProxyRegistry
- MultiSigKeyHolders
- MultiSigWallet
- Mutex
- Objects
- OrderStruct
- OrigingVestingCreator
- OriginInvestorsClaim
- Ownable
- Pausable
- PausableOz
- PreviousLoanToken
- PreviousLoanTokenSettingsLowerAdmin
- PriceFeedRSKOracle
- PriceFeeds
- PriceFeedsLocal
- PriceFeedsMoC
- PriceFeedV1PoolOracle
- ProtocolAffiliatesInterface
- ProtocolLike
- ProtocolSettings
- ProtocolSettingsEvents
- ProtocolSettingsLike
- ProtocolSwapExternalInterface
- ProtocolTokenUser
- Proxy
- ProxyOwnable
- ReentrancyGuard
- RewardHelper
- RSKAddrValidator
- SafeERC20
- SafeMath
- SafeMath96
- setGet
- SharedReentrancyGuard
- SignedSafeMath
- SOV
- sovrynProtocol
- StakingAdminModule
- StakingGovernanceModule
- StakingInterface
- StakingProxy
- StakingRewards
- StakingRewardsProxy
- StakingRewardsStorage
- StakingShared
- StakingStakeModule
- StakingStorageModule
- StakingStorageShared
- StakingVestingModule
- StakingWithdrawModule
- State
- SwapsEvents
- SwapsExternal
- SwapsImplLocal
- SwapsImplSovrynSwap
- SwapsUser
- TeamVesting
- Timelock
- TimelockHarness
- TimelockInterface
- TokenSender
- UpgradableProxy
- USDTPriceFeed
- Utils
- VaultController
- Vesting
- VestingCreator
- VestingFactory
- VestingLogic
- VestingRegistry
- VestingRegistry2
- VestingRegistry3
- VestingRegistryLogic
- VestingRegistryProxy
- VestingRegistryStorage
- VestingStorage
- WeightedStakingModule
- WRBTC