Skip to content

Custodial Ownership (ERC2258)

edag94 edited this page Dec 13, 2021 · 7 revisions

Custodial Ownership Overview

In order to allow tokens to be custodied by an entity (account or contract) such that they cannot be transferred/redeemed for underlying liquidity, yet allow the rightful owner to retain all future benefits (i.e. profit sharing, dividends, etc) and all losses (i.e. shared losses, slashing, etc), a custodial mechanisms is needed. ERC-2258 attempts to standardize that interface, in a similar fashion to ERC-20 allowances.

While the above link does a good job of detailing the the interface and rationale, in brief, by granting an account custodianship of some tokens, one gives the right to transfer those tokens to the custodian, who has sole authority to return such rights.

Thus, the total custody allowance of an account can never be greater than the total amount token it owns. Additionally, an account can only freely transfer the amount of its own token that are not custodied: balanceOf(account) - totalCustodyAllowance(account)

Finally, unlike ERC-20 allowances, only the custodian can reduce the amount they have been granted custody of, on behalf of an account. This is done by the custodian transferring some or all custodied tokens back to the owner. With Maple's platform-specific ERC-2258 implementation, the custodian can only transfer custodianship of tokens back to its rightful owner (here and here).

The first use case for this functionality is to allow users to stake PoolFDTs in the MplRewards contract without changing their PoolFDT ERC-20 balance. This allows them to earn MPL rewards in the MplRewards contract, while simultaneously accruing interest earned by the Pool. This would not have been possible with the original SNX-fork of the liquidity mining contract, since in that implementation, all Pool interest would have been accrued to the MplRewards contract itself, since it would hold a balance of PoolFDTs.

It is expected that this functionality will be applicable in the future for DeFi composability with external protocols.

Maple PoolFDTs and StakeLockerFDTs implement the increaseCustodyAllowance setter function, custodyAllowance and totalCustodyAllowance getters, and transferByCustodian transfer functions. Further, they implement the CustodyTransfer and CustodyAllowanceChanged events. Finally, they additional implement a non-standard TotalCustodyAllowanceUpdated for convenience.