ERC-7425 Tokenized reserve
Draft · Vaults & DeFi · created 2023-06-30
A standard for transparently holding an organization's emergency fund (reserve) in a smart contract and ensuring that withdrawals only occur through an open proposal with stakeholder participation.
Why it is needed
Real-world organizations keep a reserve in case funds run short, and members agree on the conditions under which it can be drawn down. Recreating this on the blockchain requires two things: a record anyone can verify showing where funds came from and where they went, and a participatory mechanism that prevents the owner from withdrawing funds at will. Existing token vault standards (ERC-4626) define only basic functions such as deposits, withdrawals, and balance queries, leaving no defined way to audit the assets held in the vault or involve stakeholders. This standard extends ERC-4626 to record every fund movement as a proposal and defines a structure in which stakeholders support proposals by depositing.
What to implement
function ownerTime(uint256 count) external view returns (uint256);: Queries, by deposit count number, the time at which the owner's deposit or withdrawal occurred. Returns it in block.timestamp format.function ownerDeposit(uint256 count, uint256 proposal) external view returns(uint256);: Queries the amount the owner deposited into the reserve, by deposit count and proposal number.function ownerWithdrawals(uint256 proposal) external view returns(uint256);: Queries the amount the owner withdrew for an open proposal.function tokenDeposit(uint256 count) external view returns(address);: Queries, by deposit count, the type of token (ERC-20 address) the owner deposited into the reserve.function tokenWithdrawal(uint256 proposal) external view returns(address);: Queries the type of token (ERC-20 address) the owner withdrew from an open proposal.function userDeposit(address user, uint256 proposal) external view returns(uint256);: Queries the ERC-20 amount a user deposited into a specific proposal in order to receive shares.function userWithdrawals(address user, uint256 proposal) public view returns(uint256);: Queries the amount a user withdrew from a specific proposal.function proposalDeposit(uint256 assets, address receiver, uint256 proposal) external returns(uint256);: Deposits into a proposal using ERC-4626's deposit() and mints new shares. The proposal must be open and not yet closed, and the function returns the number of shares issued.function proposalWithdraw(uint256 assets, address receiver, address owner, uint256 proposal)external returns(uint256);: Burns shares using ERC-4626's withdraw() and returns the underlying token at one-to-one value. userDeposit must be greater than or equal to userWithdrawal.function openProposal(address token, uint256 amount, address receiver) external returns (uint256);: The owner issues a new policy (proposal). It must create a new policy number, record the withdrawal amount in the accounting, and be the only way to withdraw ERC-20 tokens owned by the reserve.function closeProposal(address token, uint256 proposal, uint256 amount, bool close) external returns (bool);: The owner deposits into an open proposal or closes it. The amount received is recorded in the accounting, and the function returns true if the proposal is closed.function depositReserve(address token, address sender, uint256 amount) external;: Records, in the accounting, tokens the owner deposits into the reserve. No shares are issued and no refund is made, and withdrawal is only possible via openProposal.
In depth
ERC-4626 extension structure and constructor fields
This standard is an extension that inherits the ERC-4626 vault interface. The constructor takes five parameters. name and ticker are the name and ticker of the ERC-20 token used for shares, asset is the underlying ERC-20 address of the ERC-4626 vault, rAuth is the authorized user for cases where there are multiple owners or owner withdrawals are restricted, and rOwner is the owner of the reserve. In the term definitions, reserve refers to assets held by the contract excluding the ERC-4626 underlying token, and proposal refers to what the owner or stakeholders create to request a withdrawal.
Tokens cannot leave without a proposal
To send tokens out of the reserve, a proposal MUST first be open. Opening a proposal MAY be requested by a stakeholder or the owner. Every new proposal SHOULD be recorded and its information retrievable via query functions, and the proposal's amount and address are REQUIRED recorded fields. Admitting new stakeholders requires criteria set by the owner, and onboarding uses the ERC-4626 vault's underlying asset.
Stakeholder participation: proposalDeposit and proposalWithdraw
Once a proposal is open, stakeholders MUST signal support via proposalDeposit. This function uses ERC-4626's deposit() to issue shares and SHOULD be the only way to deposit into the vault. The source notes that using ERC-4626's deposit() directly means the assets are not accounted for against the proposal. proposalWithdraw burns shares via ERC-4626's withdraw() and returns one-to-one value; userDeposit MUST be greater than or equal to userWithdrawal, and it SHOULD be the only way to withdraw the underlying token.
Owner actions: openProposal, closeProposal, depositReserve
openProposal MUST only be callable by the owner, MUST create a new policy number and record the withdrawal amount in the accounting, and MUST be the only way to withdraw ERC-20 tokens owned by the reserve, excluding share tokens deposited into proposals. closeProposal is called only by the owner, records the received amount in the accounting, and uses the close argument to choose whether to close the proposal. depositReserve is a function that records tokens the owner deposits into the reserve; no shares are issued, no refund is possible, and no proposal is opened. Both functions SHOULD emit the proposals and depositR events respectively.
Rationale for the share design
Each reserve uses the ERC-20 standard for shares and ERC-4626 for share creation. The underlying token can be called the reserve token, and the share token is issued by the ERC-4626 vault. Shares represent the stakeholders participating in a proposal, and a reserve MUST have stakeholder representation. How representation is handled as users enter and exit the vault is left to implementers. For example, the source gives the example that preventing the same reserve token from being used across multiple proposals allows for fair allocation of shares. Conditions not covered in the specification are designed to be handled case by case.
Proposal in Draft status
This document is a proposal in Draft status, created on June 30, 2023. As it has not yet been finalized, its content may change or progress may stall, so the latest status should be checked before implementation.
Things to watch out for
- Vault does not protect against owner withdrawal: Stakeholders SHOULD be aware that the underlying asset held in the contract can be withdrawn by the owner without any restriction from an approving entity such as rAuth. Depending on how approval is implemented, the owner may still be able to withdraw the asset.
- Recommended implementation approach: openProposal MUST explicitly restrict transfers of the underlying asset. If the underlying asset is owned by the reserve rather than the vault (inside the proposal), the reserve MUST account for the difference to avoid user asset loss.
- Security considerations shared with ERC-20 and ERC-4626: Tokenized reserves share the same security considerations as ERC-20 and ERC-4626.