Closed peterpolman closed 2 years ago
Example implementation of timelocked wallets: https://github.com/thxprotocol/thx/pull/2
@valeriagrazzini Maybe you want to come up with an approach first and then discuss it before the implementation? Happy to jump on a call and discuss it a bit.
Here are some basic timelock wallet contract examples, we could start with something simple and then add more features if is required.
https://github.com/jklepatch/eattheblocks/blob/master/screencast/354-timelock-contract/contracts/Timelock.sol https://github.com/radek1st/time-locked-wallets/blob/master/contracts/TimeLockedWallet.sol
Question: will the contract accept any kind of erc20 token of only one specific token address?
Also, another options different from the timelock wallet could be a timelock token with an override of the transfers function but I think it is not very transparent to the customer
Looking at the logic in those contracts I'm seeing a lot of overlap with our existing withdraw modules. Maybe this feature should be simplified to passing an unlockDate
parameter in the proposeWithdraw()
method and pass it to the _createWithdrawPoll()
method over here:
https://github.com/thxprotocol/modules-solidity/blob/main/contracts/05-Withdraw/Withdraw.sol#L38-L46
https://github.com/thxprotocol/modules-solidity/blob/main/contracts/05-Withdraw/Withdraw.sol#L79-L107
With that we can store the unlockDate
in the withdrawPoll storage library and require now > unlockDate
when withdrawPollFinalize()
is called by the beneficiary of the withdrawal over here:
https://github.com/thxprotocol/modules-solidity/blob/main/contracts/05-Withdraw/WithdrawPoll.sol#L129
That should timelock withdrawals in a similar manner while introducing less code.
@peterpolman I have created a branch but I don't have push permissions I guess
@valeriagrazzini Should be good now!
@valeriagrazzini
npx hardhat node
and specify its RPC in the API projects .env. 2. You can deploy the contracts on the node with sh scripts/deploy-export.sh
npm pack
(see docs on how to reference it from package.json in the api project)
Clients let us know that they would not necessarily want beneficiaries of token rewards to be able to start transferring tokens right away
Maybe Timelocked Wallets could help out with setting up a feature that disallows beneficiaries to transfer tokens after receiving them.