-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add time-lock functionality - IO1-2302 #181
base: main
Are you sure you want to change the base?
Conversation
This reverts commit c9141d2.
* naming changes * create views contract and libraries for Operator, Network, and Cluster * update tests, refactor libraries * deploy & upgrade test cases, upgrade scripts * update README * use underscore notation * cleanup, add deploy tests
…into contract-v3
add slither to CI pipeline
…into contract-v3
Allow to change max number of validators per operator via upgrade process
…into contract-v3
contracts/SSVNetwork.sol
Outdated
uint64 releaseTime = uint64(block.timestamp) + TIMELOCK_PERIOD; | ||
_timelocks[fnData] = releaseTime; | ||
|
||
emit FunctionLocked(selector, releaseTime, msg.sender); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msg.sender redundant
if (shrunkAmount > dao_.networkBalance(network.networkFee)) { | ||
revert InsufficientBalance(); | ||
} | ||
if(shrunkAmount > dao_.networkBalance(network.networkFee)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please just double check that dao_.networkBalance(network.networkFee) is returning a shrunk amount not expanded.
@mtabasco @andrew-blox |
Done |
TIMELOCK.md
Outdated
|
||
## How it works | ||
|
||
1. The contract owner calls the time-locked fucntion with the required parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fucntion - change to function
] | ||
|
||
// Decode data parameters passed to updateNetworkFee call | ||
const functionData = ssvNetwork.interface.decodeFunctionData('updateNetworkFee', decodedLog.functionData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am prob wrong but do we need any dependencies to run this code? For example we have decodeFunctionData
and i dont see any requires here other then the abi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, its included with ethers library. When you instantiate a contract with ethers, you can access Interface class to interact with the ABI. More info here: Intrerface
The interface can be also instantiated passing the ABI but for this case its more easy to access this way.
I have added ethers
import in the example.
* use Ownable2StepUpgradeable to support 2-step transfer
Implementation of time-locked functionality to these functions:
UpdateNetworkFee
WithdrawNetworkEarnings
UpdateLiquidationThresholdPeriod
How it works:
owner
calls one of these functions with a specific parameter.FunctionLocked
is emitted.owner
calls the function with the same parameter before the release time, the transaction is reverted with theFunctionLocked
error.owner
.There could be multiple locked executions at the same time, for example:
UpdateNetworkFee(200000000)
at Tue 7 Feb, 1:40UpdateNetworkFee(350000000)
at Tue 8 Feb, 11:20...
Every request for execution will have its own release time.
As this functionality is expected to be used by authorized accounts and consumed after scheduled, there is no implementation for deleting unused time-locked schedules.