Payout Vaults
Last updated
Last updated
A Payout Vault is a way to manage distributions of slashed Safety Module assets to a set of addresses via an off-chain Merkle tree.
The PayoutVaultFactory's deployPayoutVault
function can be used to deploy a Payout Vault:
The owner_
is the manager of the Payout Vault that will be responsible for registering new payout assets, setting the Merkle tree root, and withdrawing assets once payouts have been processed.
The assets_
argument is a list of registered assets (see for more details).
All assets that will eventually be distributed need to be registered with the Payout Vault. In most cases, these assets are simply a Safety Module's reserve assets. The owner can register new assets by calling PayoutVault.registerPayoutAssets
.
Each address claiming payout assets is entitled to a claimableShare
of each registered asset's balance in the Payout Vault (represented as a WAD, so 50% is 0.5e18).
It is assumed an off-chain Merkle tree of all eligible addresses has been computed, where each leaf represents a single eligible user encoded as:
To set the Merkle tree root, the owner can call PayoutVault.setRoot
.
The owner also sets a deadline by which all users must claim by calling PayoutVault.setClaimsDeadline
.
The preferred way to initialize claims is by the owner calling:
Note that this call sets the Merkle root and the claims deadline. It also takes a snapshot of the PayoutVault's balances of all registered assets. These balances are the total amounts of each asset that are eventually paid out to users.
Once the PayoutVault.claimsDeadline
has passed, the owner can withdraw any remaining assets in the vault by calling PayoutVault.withdraw
.
In case of an emergency, the owner can also pause claims, by calling PayoutVault.pause
.
An address that wishes to claim payouts from the vault must call:
where proof_
is the appropriate Merkle tree proof and claimableShare_
is that address's appropriate share of the vault assets. It is assumed that an off-chain service will help users generate these values for them given the Merkle tree.
Payouts must be claimed by the PayoutVault.claimsDeadline
or they may be withdrawn.