IProvisioner
Last updated
Last updated
Interface for the contract that can mint and burn vault units in exchange for tokens
Deposit tokens directly into the vault
MUST revert if tokensIn is 0, minUnitsOut is 0, or sync deposits are disabled
function deposit(IERC20 token, uint256 tokensIn, uint256 minUnitsOut) external returns (uint256 unitsOut);
Parameters
token
IERC20
The token to deposit
tokensIn
uint256
The amount of tokens to deposit
minUnitsOut
uint256
The minimum amount of units expected
Returns
unitsOut
uint256
The amount of shares minted to the receiver
Mint exact amount of units by depositing required tokens
function mint(IERC20 token, uint256 unitsOut, uint256 maxTokensIn) external returns (uint256 tokensIn);
Parameters
token
IERC20
The token to deposit
unitsOut
uint256
The exact amount of units to mint
maxTokensIn
uint256
Maximum amount of tokens willing to deposit
Returns
tokensIn
uint256
The amount of tokens used to mint the requested shares
Refund a deposit within the refund period
Only callable by authorized addresses
function refundDeposit(address sender, IERC20 token, uint256 tokenAmount, uint256 unitsAmount, uint256 refundableUntil)
external;
Parameters
sender
address
The original depositor
token
IERC20
The deposited token
tokenAmount
uint256
The amount of tokens deposited
unitsAmount
uint256
The amount of units minted
refundableUntil
uint256
Timestamp until which refund is possible
Refund an expired deposit or redeem request
Can only be called after request deadline has passed
function refundRequest(IERC20 token, Request calldata request) external;
Parameters
token
IERC20
The token involved in the request
request
Request
The request to refund
Create a new deposit request to be solved by solvers
function requestDeposit(
IERC20 token,
uint256 tokensIn,
uint256 minUnitsOut,
uint256 solverTip,
uint256 deadline,
uint256 maxPriceAge,
bool isFixedPrice
) external;
Parameters
token
IERC20
The token to deposit
tokensIn
uint256
The amount of tokens to deposit
minUnitsOut
uint256
The minimum amount of units expected
solverTip
uint256
The tip offered to the solver
deadline
uint256
Duration in seconds for which the request is valid
maxPriceAge
uint256
Maximum age of price data that solver can use
isFixedPrice
bool
Whether the request is a fixed price request
Create a new redeem request to be solved by solvers
function requestRedeem(
IERC20 token,
uint256 unitsIn,
uint256 minTokensOut,
uint256 solverTip,
uint256 deadline,
uint256 maxPriceAge,
bool isFixedPrice
) external;
Parameters
token
IERC20
The token to receive
unitsIn
uint256
The amount of units to redeem
minTokensOut
uint256
The minimum amount of tokens expected
solverTip
uint256
The tip offered to the solver
deadline
uint256
Duration in seconds for which the request is valid
maxPriceAge
uint256
Maximum age of price data that solver can use
isFixedPrice
bool
Whether the request is a fixed price request
Solve multiple requests using vault's liquidity
Only callable by authorized addresses
function solveRequestsVault(IERC20 token, Request[] calldata requests) external;
Parameters
token
IERC20
The token for which to solve requests
requests
Request[]
Array of requests to solve
Solve multiple requests using solver's own liquidity
function solveRequestsDirect(IERC20 token, Request[] calldata requests) external;
Parameters
token
IERC20
The token for which to solve requests
requests
Request[]
Array of requests to solve
Update token parameters
function setTokenDetails(IERC20 token, TokenDetails calldata tokensDetails) external;
Parameters
token
IERC20
The token to update
tokensDetails
TokenDetails
The new token details
Removes token from provisioner
function removeToken(IERC20 token) external;
Parameters
token
IERC20
The token to be removed
Update deposit parameters
function setDepositDetails(uint256 depositCap_, uint256 depositRefundTimeout_) external;
Parameters
depositCap_
uint256
New maximum total value that can be deposited
depositRefundTimeout_
uint256
New time window for deposit refunds
Return maximum amount that can still be deposited
function maxDeposit() external view returns (uint256);
Returns
<none>
uint256
Amount of deposit capacity remaining
Check if a user's units are currently locked
function areUserUnitsLocked(address user) external view returns (bool);
Parameters
user
address
The address to check
Returns
<none>
bool
True if user's units are locked, false otherwise
Computes the hash for a sync deposit
function getDepositHash(address user, IERC20 token, uint256 tokenAmount, uint256 unitsAmount, uint256 refundableUntil)
external
pure
returns (bytes32);
Parameters
user
address
The address making the deposit
token
IERC20
The token being deposited
tokenAmount
uint256
The amount of tokens to deposit
unitsAmount
uint256
Minimum amount of units to receive
refundableUntil
uint256
The timestamp until which the deposit is refundable
Returns
<none>
bytes32
The hash of the deposit
Computes the hash for a generic request
function getRequestHash(IERC20 token, Request calldata request) external pure returns (bytes32);
Parameters
token
IERC20
The token involved in the request
request
Request
The request struct
Returns
<none>
bytes32
The hash of the request
Emitted when a user deposits tokens directly into the vault
event Deposited(address indexed user, IERC20 indexed token, uint256 tokensIn, uint256 unitsOut, bytes32 depositHash);
Parameters
user
address
The address of the depositor
token
IERC20
The token being deposited
tokensIn
uint256
The amount of tokens deposited
unitsOut
uint256
The amount of units minted
depositHash
bytes32
Unique identifier for this deposit
Emitted when a deposit is refunded
event DepositRefunded(bytes32 indexed depositHash);
Parameters
depositHash
bytes32
The hash of the deposit being refunded
Emitted when a direct (sync) deposit is refunded
event DirectDepositRefunded(bytes32 indexed depositHash);
Parameters
depositHash
bytes32
The hash of the deposit being refunded
Emitted when a user creates a deposit request
event DepositRequested(
address indexed user,
IERC20 indexed token,
uint256 tokensIn,
uint256 minUnitsOut,
uint256 solverTip,
uint256 deadline,
uint256 maxPriceAge,
bool isFixedPrice,
bytes32 depositRequestHash
);
Parameters
user
address
The address requesting the deposit
token
IERC20
The token being deposited
tokensIn
uint256
The amount of tokens to deposit
minUnitsOut
uint256
The minimum amount of units expected
solverTip
uint256
The tip offered to the solver in deposit token terms
deadline
uint256
Timestamp until which the request is valid
maxPriceAge
uint256
Maximum age of price data that solver can use
isFixedPrice
bool
Whether the request is a fixed price request
depositRequestHash
bytes32
The hash of the deposit request
Emitted when a user creates a redeem request
event RedeemRequested(
address indexed user,
IERC20 indexed token,
uint256 minTokensOut,
uint256 unitsIn,
uint256 solverTip,
uint256 deadline,
uint256 maxPriceAge,
bool isFixedPrice,
bytes32 redeemRequestHash
);
Parameters
user
address
The address requesting the redemption
token
IERC20
The token requested in return for units
minTokensOut
uint256
The minimum amount of tokens the user expects to receive
unitsIn
uint256
The amount of units being redeemed
solverTip
uint256
The tip offered to the solver in redeem token terms
deadline
uint256
The timestamp until which this request is valid
maxPriceAge
uint256
Maximum age of price data that solver can use
isFixedPrice
bool
Whether the request is a fixed price request
redeemRequestHash
bytes32
The hash of the redeem request
Emitted when a deposit request is solved successfully
event DepositSolved(bytes32 indexed depositHash);
Parameters
depositHash
bytes32
The unique identifier of the deposit request that was solved
Emitted when a redeem request is solved successfully
event RedeemSolved(bytes32 indexed redeemHash);
Parameters
redeemHash
bytes32
The unique identifier of the redeem request that was solved
Emitted when an unrecognized async deposit hash is used
event InvalidRequestHash(bytes32 indexed depositHash);
Parameters
depositHash
bytes32
The deposit hash that was not found in async records
Emitted when async deposits are disabled and a deposit request cannot be processed
event AsyncDepositDisabled(uint256 indexed index);
Parameters
index
uint256
The index of the deposit request that was rejected
Emitted when async redeems are disabled and a redeem request cannot be processed
event AsyncRedeemDisabled(uint256 indexed index);
Parameters
index
uint256
The index of the redeem request that was rejected
Emitted when the price age exceeds the maximum allowed for a request
event PriceAgeExceeded(uint256 indexed index);
Parameters
index
uint256
The index of the request that was rejected
Emitted when a deposit exceeds the vault's configured deposit cap
event DepositCapExceeded(uint256 indexed index);
Parameters
index
uint256
The index of the request that was rejected
Emitted when there are not enough tokens to cover the required solver tip
event InsufficientTokensForTip(uint256 indexed index);
Parameters
index
uint256
The index of the request that was rejected
Emitted when the output units are less than the amount requested
event AmountBoundExceeded(uint256 indexed index, uint256 amount, uint256 bound);
Parameters
index
uint256
The index of the request that was rejected
amount
uint256
The actual amount
bound
uint256
The minimum amount
Emitted when a redeem request is refunded due to expiration or cancellation
event RedeemRefunded(bytes32 indexed redeemHash);
Parameters
redeemHash
bytes32
The unique identifier of the redeem request that was refunded
Emitted when the vault's deposit limits are updated
event DepositDetailsUpdated(uint256 depositCap, uint256 depositRefundTimeout);
Parameters
depositCap
uint256
The new maximum total value that can be deposited into the vault
depositRefundTimeout
uint256
The new time window during which deposits can be refunded
Emitted when a token's deposit/withdrawal settings are updated
event TokenDetailsSet(IERC20 indexed token, TokenDetails tokensDetails);
Parameters
token
IERC20
The token whose settings are being updated
tokensDetails
TokenDetails
The new token details
Emitted when a token is removed from the provisioner
event TokenRemoved(IERC20 indexed token);
Parameters
token
IERC20
The token that was removed
error Aera__SyncDepositDisabled();
error Aera__AsyncDepositDisabled();
error Aera__AsyncRedeemDisabled();
error Aera__DepositCapExceeded();
error Aera__MinUnitsOutNotMet();
error Aera__TokensInZero();
error Aera__UnitsInZero();
error Aera__UnitsOutZero();
error Aera__MinUnitsOutZero();
error Aera__MaxTokensInZero();
error Aera__MaxTokensInExceeded();
error Aera__MaxDepositRefundTimeoutExceeded();
error Aera__DepositHashNotFound();
error Aera__HashNotFound();
error Aera__RefundPeriodExpired();
error Aera__DeadlineInPast();
error Aera__DeadlineTooFarInFuture();
error Aera__DeadlineInFutureAndUnauthorized();
error Aera__MinTokenOutZero();
error Aera__HashCollision();
error Aera__ZeroAddressPriceAndFeeCalculator();
error Aera__ZeroAddressMultiDepositorVault();
error Aera__DepositMultiplierTooLow();
error Aera__DepositMultiplierTooHigh();
error Aera__RedeemMultiplierTooLow();
error Aera__RedeemMultiplierTooHigh();
error Aera__DepositCapZero();
error Aera__PriceAndFeeCalculatorVaultPaused();
error Aera__AutoPriceSolveNotAllowed();
error Aera__FixedPriceSolverTipNotAllowed();
error Aera__TokenCantBePriced();
error Aera__CallerIsVault();
error Aera__InvalidToken();