Hi,
I'm doing exercises to get acquainted with OZ contracts and Defender.
I deployed on Sepolia a DAO/Governor with ERC721 and a Timelock.
I deposited some testETH in the DAO/Timelock (1). How should I use Defender to transfer some testETH from the DAo/Timelock to an EOA? (what target contract, what function, ...)? I seem to be unable to find a way to realise this simple action.
Thanks in advance for any help that can be useful.
Br
W
(1) Am I correct to suppose that the timelock is the address that serves as the DAO's treasury?
Writing this down for myself and anyone stuck on the same question, here is a solution I found (I'm a rookie trying out things, so read and use wisely ):
Preliminary: the following describes the transfer of Matic from a Timelock (deployed on Polygon and supplied with some Matic from another EOA) in which the proposer role has been allocated to an EOA and the executor role to the zero address such that anyone can execute.
1) Schedule the transaction
1.1) Go to your Timelock contract in OZ Defender Admin
1.2) Click on the button "New Proposal" and choose "Admin Action"
1.3) Connect the wallet that has the proposer role
1.4) Fill in the fields as follows(a):
1.4.1) Function: schedule
1.4.2) target: the address to which you want to send the Matic
1.4.3) value: number of Matics to send (in Wei! 1 Matic should be entered as a 1 with 18 zeros)
1.4.4) data: 0x
1.4.5) predecessor: 0x0000000000000000000000000000000000000000000000000000000000000000
1.4.6) salt(b): 0x0000000000000000000000000000000000000000000000000000000000000000
1.4.7) delay(c): 180
1.5) As "Execution strategy", choose EOA and enter the account that has the proposer role
1.6) add your description
1.7) click on "Create admin action"
1.8) In the newly appeared window "pending approval", click on "Approve and Execute".
1.9) sign the transaction in the pop-upped Metamask window (with the wallet that has the proposer role)
Now, your transaction is "scheduled", and the delay countdown begins.
1.10) Don't close the window "Executed", as you will have to reproduce the info you entered in the above fields, which also appears under "Target Function".
2) Execute the transaction (after the delay expired)
2.1) In a new window (as you can't close or use the previous one, see 1.10), go to your Timelock contract in OZ Defender Admin
2.2) Click on the button "New Proposal" and choose "Admin Action".
2.3) Connect a wallet with the executor role: if you set up the Timelock with the executor role allocated to the zero address, then you can connect any wallet; otherwise, connect a wallet that has the executor role.
2.4) Fill in the fields as follows(a):
2.4.1) Function: execute
2.4.2) target: the same address as under 1.4.2, the address to which you want to send the Matic
2.4.3) value: the same value as under 1.4.3, the number of Matics to send (in Wei! 1 Matic should be entered as a 1 with 18 zeros)
2.4.4) data: the same as under 1.4.4, namely 0x
2.4.5) predecessor: the same as under 1.4.5, namely 0x0000000000000000000000000000000000000000000000000000000000000000
2.4.6) salt(b): the same as under 1.4.6, namely 0x0000000000000000000000000000000000000000000000000000000000000000
2.4.7) Value in MATIC: 0.0
2.5) As "Execution strategy", choose EOA and enter the account with the executor role (the wallet you connected under 2.3).
2.6) add your description
2.7) click on "Create admin action"
2.8) In the newly appeared window "pending approval", click on "Approve and Execute".
2.9) sign the transaction in the pop-upped Metamask window (with the wallet that has the executor role)
NOW YOUR TRANSFER IS EXECUTED!! WOOOHAAAAA
PS: I think that -for gas efficiency considerations- the Timelock contract doesn't store the transaction details when "scheduled". I think the Timelock maps just the transaction-id's (transaction hashes) created when scheduling, together with their delay. To execute the transaction when the delay expired, one has to recreate the exact same transaction (with the exact same transaction-id) in order for the transaction to match with the previous mapping and to be executed by the Timelock.
Footnotes:
(a) If I understand correctly, the content of the fields "function", "target", "value", "data", "predecessor", and "salt" (NOT THE DELAY FIELD) are hashed together to get the transaction id number.
(b) the salt field allows to differentiate between two identical transactions. If you used 0x0000000000000000000000000000000000000000000000000000000000000000 in the first transaction, then you can use in the second transaction, for example, 0x0000000000000000000000000000000000000000000000000000000000000001. With this different "salt", the hash -and thus the transaction id-number- of the second transaction will differ from the first.
(c) the delay in seconds during which the transaction can be cancelled and after which the transaction can be executed