Timelock guide (relevant to admin only) - percent-finance/percent-dev GitHub Wiki
This page is relevant to users who have access to admin account only (i.e. for multi-signer only).
Overview
To create a timelock transaction, we need to:
- Queue a transaction
- Execute the queued transaction after 48 hours
In this guide we will try to transfer 1 PCT from the timelock account to our multi-sig account as an example.
1. Queue a transaction
- To queue the transaction for transferring 1 PCT from the timelock account to our multi-sig account, what we need to do is to call the
queueTransaction
function in the timelock contract. The params will be like this:- target:
0xbc16da9df0A22f01A16BC0620a27e7D6d6488550
- value:
0
- signature:
transfer(address,uint256)
- data:
0x000000000000000000000000c34c24ac7117354b484d9dcde2f8789249d008d60000000000000000000000000000000000000000000000000de0b6b3a7640000
- eta:
1603106634
- target:
- Explanation:
- target: The contract address of the transaction. In this example, it is the PCT Token contract.
- value: The ETH value to send in the transaction. In this example, it is 0 because we don't need to send any ETH.
- signature: Signature of the function to call. In this example, it is the signature of the transfer function.
- data: Abi encoded params for the function. In this example, it is the encoded value of our multi-sig account and the amount to transfer. An easy way to get the encoded value is to use the online abi encoder (https://abi.hashex.org/), what you need to do is simply filling in the params, copy the encoded string and replace the first 8 characters with
0x
. - eta: The estimated time of arrival in epoch timestamp format, it must be at least 48 hours from the time of transaction execution.
2. Execute the queued transaction after 48 hours
- To execute a queued transaction is easy, first you need to make sure the current time is later than the eta time of the queued transaction, then you simply need to call the
executeTransaction
in the timelock contract with the same params as you use when you queued that transaction. In this example, the params are:- target:
0xbc16da9df0A22f01A16BC0620a27e7D6d6488550
- value:
0
- signature:
transfer(address,uint256)
- data:
0x000000000000000000000000c34c24ac7117354b484d9dcde2f8789249d008d60000000000000000000000000000000000000000000000000de0b6b3a7640000
- eta:
1603106634
- target: