Please see our Understanding ReleaseGold docs.
The Celo Rosetta service exposes 3 types of ReleaseGold balances on the /account/balance
endpoint.
This type corresponds to the total amount of gold that has released up to the current timestamp. Crucially, it does not account for any withdrawals that have already taken place and simply calculates the aggregate released amount according to the schedule.
You can refer to the contract function getCurrentReleasedTotalAmount()
This type simply corresponds to the contract's locked gold balance, including the sum of any pending withdrawals. The unvested modifier is misleading.
You can refer to the contract function getRemainingLockedBalance()
This type simply corresponds to the unlocked gold balance in the contract. The unvested modifier is misleading.
You can refer to the contract function getRemainingUnlockedBalance()
The ReleaseGold.withdraw
operation on the /construction/metadata
endpoint is the transaction builder for the contract function withdraw(uint256 amount)
.
There are a few invariants that must be satisfied for a successful withdrawal:
ReleaseGoldVested >= totalWithdrawn + amount
maxDistribution >= totalWithdrawn + amount
ReleaseGoldUnvestedUnlocked >= amount