Allow withdrawal at set time intervals

I have an address and I would like to prevent the owner from withdrawing before a month has past from last withdrawal. In short, he can only withdraw monthly.

Can anyone give me an idea on how to implement this? Some sample code to start with would be great! Thanks!!

Check out some timelocks in order to stop withdrawals from happening by a certain user at a certain time.

Alternatively you can make your own code that captures the current block time when deploying the contract, then when he goes to withdraw compare the deployed block time with the current block time. If the comparison shows that the block time has been 1 month, then allow him to withdraw.

You should inform the owner of this and have some sort of bool function that tells if he can withdraw without error before he tries.

2 Likes

The following issue may have some suggestions on vesting: https://github.com/OpenZeppelin/openzeppelin-contracts/issues/1214