AtomicSolverV3

Git Source

Inherits: IAtomicSolver, Auth

Author: crispymangoes

State Variables

eETH

ERC20 internal constant eETH = ERC20(0x35fA164735182de50811E8e2E824cFb9B6118ac2);

weETH

ERC20 internal constant weETH = ERC20(0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee);

Functions

constructor

constructor(address _owner, Authority _authority) Auth(_owner, _authority);

p2pSolve

Solver wants to exchange p2p share.asset() for withdraw queue shares.

Solver should approve this contract to spend share.asset().

function p2pSolve(
    AtomicQueue queue,
    ERC20 offer,
    ERC20 want,
    address[] calldata users,
    uint256 minOfferReceived,
    uint256 maxAssets
)
    external
    requiresAuth;

redeemSolve

Solver wants to redeem withdraw offer shares, to help cover withdraw.

offer MUST be an ERC4626 vault.

function redeemSolve(
    AtomicQueue queue,
    ERC20 offer,
    ERC20 want,
    address[] calldata users,
    uint256 minimumAssetsOut,
    uint256 maxAssets,
    TellerWithMultiAssetSupport teller
)
    external
    requiresAuth;

finishSolve

Implement the finishSolve function WithdrawQueue expects to call.

nonReentrant is not needed on this function because it is impossible to reenter, because the above solve functions have the nonReentrant modifier. The only way to have the first 2 checks pass is if the msg.sender is the queue, and this contract is msg.sender of Queue.solve(), which is only called in the above functions.

function finishSolve(
    bytes calldata runData,
    address initiator,
    ERC20 offer,
    ERC20 want,
    uint256 offerReceived,
    uint256 wantApprovalAmount
)
    external
    requiresAuth;

_p2pSolve

Helper function containing the logic to handle p2p solves.

function _p2pSolve(
    address queue,
    bytes memory runData,
    ERC20 offer,
    ERC20 want,
    uint256 offerReceived,
    uint256 wantApprovalAmount
)
    internal;

_redeemSolve

Helper function containing the logic to handle redeem solves.

function _redeemSolve(
    address queue,
    bytes memory runData,
    ERC20 offer,
    ERC20 want,
    uint256 offerReceived,
    uint256 wantApprovalAmount
)
    internal;

Errors

AtomicSolverV3___WrongInitiator

error AtomicSolverV3___WrongInitiator();

AtomicSolverV3___AlreadyInSolveContext

error AtomicSolverV3___AlreadyInSolveContext();

AtomicSolverV3___FailedToSolve

error AtomicSolverV3___FailedToSolve();

AtomicSolverV3___SolveMaxAssetsExceeded

error AtomicSolverV3___SolveMaxAssetsExceeded(uint256 actualAssets, uint256 maxAssets);

AtomicSolverV3___P2PSolveMinSharesNotMet

error AtomicSolverV3___P2PSolveMinSharesNotMet(uint256 actualShares, uint256 minShares);

AtomicSolverV3___BoringVaultTellerMismatch

error AtomicSolverV3___BoringVaultTellerMismatch(address vault, address teller);

Enums

SolveType

The Solve Type, used in finishSolve to determine the logic used.

P2P Solver wants to swap share.asset() for user(s) shares

REDEEM Solver needs to redeem shares, then can cover user(s) required assets.

enum SolveType {
    P2P,
    REDEEM
}