ApyUSDRateOracle
Inherits: Initializable, AccessManagedUpgradeable, UUPSUpgradeable, EInvalidAmount, EInvalidAddress
Title: ApyUSDRateOracle
Provides the exchange rate of apyUSD for a Curve Stableswap-NG pool.
Reads convertToAssets(1e18) from the apyUSD ERC-4626 vault and multiplies
by a configurable adjustment. Called by the Curve pool via staticcall to rate().
The full call chain is read-only; standard ERC-4626 vaults satisfy this requirement.
State Variables
MIN_ADJUSTMENT
Minimum allowed adjustment (90% — discounts apyUSD by up to 10%)
uint256 public constant MIN_ADJUSTMENT = 0.9e18
MAX_ADJUSTMENT
Maximum allowed adjustment (110% — premiums apyUSD by up to 10%)
uint256 public constant MAX_ADJUSTMENT = 1.1e18
STORAGE_LOCATION
bytes32 private constant STORAGE_LOCATION = 0x7c3fd745b6b17d3e08ed287c3401ed4dbb5b9270e485a2fb2e22ca2d91e6e000
Functions
_getStorage
function _getStorage() private pure returns (ApyUSDRateOracleStorage storage $);
constructor
Note: oz-upgrades-unsafe-allow: constructor
constructor() ;
initialize
Initializes the oracle with neutral adjustment (1e18) and the apyUSD vault address.
function initialize(address initialAuthority, address vault_) external initializer;
Parameters
| Name | Type | Description |
|---|---|---|
initialAuthority | address | The AccessManager address. |
vault_ | address | The apyUSD ERC-4626 vault address. |
rate
Returns the current rate fed to the Curve pool.
function rate() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The apyUSD redemption rate multiplied by adjustment, in 1e18 precision. |
adjustment
Returns the current adjustment value.
function adjustment() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The current adjustment in 1e18 precision (1e18 = neutral). |
vault
Returns the apyUSD ERC-4626 vault address this oracle reads from.
function vault() external view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The apyUSD vault address. |
setAdjustment
Sets the adjustment value. Must be within [MIN_ADJUSTMENT, MAX_ADJUSTMENT].
function setAdjustment(uint256 newAdjustment) external restricted;
Parameters
| Name | Type | Description |
|---|---|---|
newAdjustment | uint256 | New adjustment value in 1e18 precision. |
_authorizeUpgrade
function _authorizeUpgrade(address newImplementation) internal override restricted;
Events
AdjustmentUpdated
event AdjustmentUpdated(uint256 oldAdjustment, uint256 newAdjustment);
Structs
ApyUSDRateOracleStorage
Note: storage-location: erc7201:apyx.storage.ApyUSDRateOracle
struct ApyUSDRateOracleStorage {
uint256 adjustment;
address vault;
}