Asynchronous Vault
SageVaultOpenTrade.sol
An asynchronous implementation of the SageVault to interoperate with OpenTrade. The SageVault works in tandem with a History and HoldingContract to facillitate user deposits and redemptions from a schedule-based pool contract. This contract passes USDC deposits for all users from the HoldingContract as a lump sum to the underlying pool and issues stUSDC shares representing its collateral plus interest. Likewise, the vault requests redemptions of stUSDC on for Sage protocol users as a lump sum and passes the returned USDC to the HoldingContract for individual distribution.
If configured, SageVaultOpenTrade can optionally charge a fee on withdrawal.
Inherits: OpenZeppelin ERC4626Upgradeable , OpenZeppelin Math
SageHistory.sol
The accounting contract for tracking user deposits, mint, withdraws and redeems by epoch. This contract also tracks the protocol's transfer state with its asynchronous upstream pool--when shares have been requested for redemption, but the protocol is awaiting receiving its USDC assets. This portion of the contract is read-only.
Inherits: OpenZeppelin Math
SageHistoryController.sol
This contract contains the writeable methods for the SageHistory contract and is inherited. This contract allows the SageHoldingContract to update the user's deposit/withdraw state and the protocol's own state compared to the upstream pool. This contract also provides a function used by the Multi contract to check for claimable USDC or stUSDC since the user's latest claimed epoch.
Inherits: OpenZeppelin OwnableUpgradeable
SageHoldingContract.sol
This contract is the main point of interaction between users and the Sage Protocol. Users interact with this contract to asynchronously to deposit, mint, request redeem, request withdraw, and claim stUSDC shares or claim USDC collateral.
This contract authorizes 2 contracts to operate on the user’s behalf:
SageHoldingContractMulti: a public contract that is globally authorized to perform batch checkpoints and claims on behalf of the user
Delegated contract: this is any private contract that a user may delegate to perform Sage actions on their behalf, such as claiming USDC collateral over a bridge
Modifiers:
isAllowed
checks that a caller of a function on behalf of another address is either the provided “behalfOf” address or a previously set delegate addressprotocolCheckpointRequired
checks that protocol has performed the netRedeem action for the provided epochuserCheckpointRequired
checks that the user has checkpointed their address for its redemption rate before attempting to withdraw USDC from SagenotTransferOutWindow
checks the protocol is not between states of requesting redemption from the upstream pool and receiving back USDC collateral
Inherits: OpenZeppelin SafeERC20, OpenZeppelin Math
SageHoldingContractController.sol
The abstract base contract for the SageHoldingContract. This contract is the main point of interaction between admin addresses, such as a multisig, and the Sage Protocol to call the epoch accounting and pool functions.
This contract also provides a protected method to pause the protocol.
Inherits: OpenZeppelin PausableUpgradeable, OpenZeppelin Math
SageHoldingContractMulti.sol
A contract that allows batching multiple checkpoints or claims across multiple consecutive epochs. This contract is permissioned to call 2 protected methods on the SageHoldingContract.
Inherits: OpenZeppelin PauseableUpgradeable
Last updated