Deposit and Withdrawal Flows

These are the flows of how CELO is deposited and withdrawn from the protocol, detailing specific contract functions that need to be called.

Deposit flow

  • Call Manager.deposit, setting msg.value to the amount of CELO one wants to deposit. stCELO is minted to the user, and Manager schedules votes according to the voting strategy.

At some point, Account.activateAndVote should be called for each validator group that has had votes scheduled recently. Note that this does not need to be called for every deposit call, but ideally should be called before the epoch during which the deposit was made ends. This is because voting CELO doesn't start receiving epoch rewards until the next epoch after it was used for voting. The function can be called by any address, whether or not it had previously deposited into the protocol (in particular, there could be a bot that calls it once a day per validator group).

Withdrawal flow

  • Call Manager.withdraw. stCELO is burned from the user, and Manager schedules withdrawals according to the voting strategy. The following steps are necessary to unlock Account's CELO from the LockedGold contract and actually distribute them to the user.

  • Call Account.withdraw for each group that was scheduled to be withdrawn from in the previous step (can be called by anyone, e.g. a bot). Some CELO might be available for immediate withdrawal, if it hadn't yet been locked and used for voting, and will be transferred to the user. For the rest of the withdrawal amount, it will be unvoted from the specified group and the LockedGold unlocking process will begin.

  • After the 3 day unlocking period has passed, Account.finishPendingWithdrawal should be called (can be called by anyone, e.g. a bot), specifying the pending withdrawal that was created in the previous step. This will finalize the LockedGold withdrawal and return the remaining CELO to the user.

Last updated