Account
Account.sol
This contract sets up an account in the core Accounts contract, enabling it to lock CELO and vote in validator elections. The system's pool of CELO is held by this contract. This contract needs to be interacted with to lock/vote/activate votes, as assigned to validator groups according to Manager's strategy, and to finalize withdrawals of CELO, after the unlocking period of LockedGold has elapsed.
Mainnet Deployment:
0x4aAD04D41FD7fd495503731C5a2579e19054C432Alfajores Testnet Deployment:
0xd11CC172D802c1a94e81c5F432471bD34d1828A1
Methods
initialize
_registry The address of the Celo registry.
_manager The address of the Manager contract.
_owner The address of the contract owner.
function initialize(
address _registry,
address _manager,
address _owner
) external initializer {
__UsingRegistry_init(_registry);
__Managed_init(_manager);
_transferOwnership(_owner);
// Create an account so this contract can vote.
if (!getAccounts().createAccount()) {
revert AccountCreationFailed();
}
}
scheduleVotes
Deposits CELO sent via msg.value as unlocked CELO intended as votes for groups. Only callable by the Manager contract, which must restrict which groups are valid.
scheduleWithdrawals
Schedule a list of withdrawals to be refunded to a beneficiary.
withdraw
Starts withdrawal of CELO from `group`. If there is any unlocked CELO for the group, that CELO is used for immediate withdrawal. Otherwise, CELO is taken from pending and active votes, which are subject to the unlock period of LockedGold.sol.
activateAndVote
Activates any activatable pending votes for group, and locks & votes any unlocked CELO for group. Callable by anyone. In practice, this is expected to be called near the end of each epoch by an off-chain agent.
finishPendingWithdrawal
Finishes a pending withdrawal created as a result of a `Account.withdraw` call, claiming CELO after the `unlockingPeriod` defined in LockedGold.sol. Callable by anyone, but ultimately the withdrawal goes to `beneficiary`. The pending withdrawal info found in both Account.sol and LockedGold must match to ensure that the beneficiary is claiming the appropriate pending withdrawal.
getTotalCelo
Gets the total amount of CELO this contract controls. This is the unlocked CELO balance of the contract plus the amount of LockedGold for this contract, which includes unvoting and voting LockedGold.
Returns the total amount of CELO this contract controls, including LockedGold.
getPendingWithdrawals
Returns the pending withdrawals for a beneficiary.
getNumberPendingWithdrawals
Returns the number of pending withdrawals for a beneficiary.
getPendingWithdrawal
Returns a pending withdrawal for a beneficiary.
getCeloForGroup
Returns the total amount of CELO directed towards `group`. This is the Unlocked CELO balance for `group` plus the combined amount in pending and active votes made by this contract.
scheduledVotesForGroup
Returns the total amount of CELO that's scheduled to vote for a group.
scheduledWithdrawalsForGroup
Returns the total amount of CELO that's scheduled to be withdrawn for a group.
scheduledWithdrawalsForGroupAndBeneficiary
Returns the total amount of CELO that's scheduled to be withdrawn for a group scoped by a beneficiary.
revokeVotes
Revokes votes from a validator group. It first attempts to revoke pending votes, and then active votes if necessary. Reverts if `revokeAmount` exceeds the total number of pending and active votes for the group from this contract.
validatePendingWithdrawalRequest
Validates a local pending withdrawal matches a given beneficiary and LockedGold pending withdrawal. See finishPendingWithdrawal.
Last updated