Skip to content
Verified contractExactMIT

EmergencyZkLighterDecoderAndSanitizer

Address0x6b62643504bc1665a00ea94f3127d55f2eaf7df6
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.21

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.21+commit.d9974bed
Language
solidity
Optimization
Yes, 200 runs
EVM version
shanghai
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
25,948,309
Creation transaction
0x900f0c7076…ddb3b3daa0

src/base/DecodersAndSanitizers/hyperwave/aprimeusd/EmergencyZkLighterDecoderAndSanitizer.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import {BaseDecoderAndSanitizer} from "src/base/DecodersAndSanitizers/BaseDecoderAndSanitizer.sol";

contract EmergencyZkLighterDecoderAndSanitizer is BaseDecoderAndSanitizer {
    // ========================================= ERRORS =========================================
    error EmergencyZkLighterDecoderAndSanitizer__InvalidPubKey();

    constructor(address _boringVault) BaseDecoderAndSanitizer(_boringVault) {}

    // @desc Burn shares from a ZkLighter public pool to unwind a position.
    function burnShares(
        uint48 /*_accountIndex*/,
        uint48 /*_publicPoolIndex*/,
        uint64 /*_shareAmount*/
    ) external pure returns (bytes memory addressesFound) {
        return addressesFound;
    }

    // @desc Rotate the signing key for the vault's ZkLighter account.
    function changePubKey(
        uint48 /*_accountIndex*/,
        uint8 /*_apiKeyIndex*/,
        bytes calldata _pubKey
    ) external pure returns (bytes memory addressesFound) {
        // Only allow rotating to the fixed 40-byte sentinel pubkey (first byte 0x10 followed by 39
        // zero bytes) that removes the account's API key, for the emergency case.
        if (
            keccak256(_pubKey)
                != keccak256(hex"10000000000000000000000000000000000000000000000000000000000000000000000000000000")
        ) {
            revert EmergencyZkLighterDecoderAndSanitizer__InvalidPubKey();
        }
        return addressesFound;
    }
}

src/base/DecodersAndSanitizers/BaseDecoderAndSanitizer.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

// solhint-disable-next-line no-unused-import
import { DecoderCustomTypes } from "src/interfaces/DecoderCustomTypes.sol";

contract BaseDecoderAndSanitizer {
    //============================== IMMUTABLES ===============================

    /**
     * @notice The BoringVault contract address.
     */
    address public immutable boringVault;

    error BaseDecoderAndSanitizer__FunctionNotImplemented(bytes _calldata);

    constructor(address _boringVault) {
        boringVault = _boringVault;
    }

    // @desc The spender address to approve
    // @tag spender:address
    function approve(address spender, uint256) external pure returns (bytes memory addressesFound) {
        addressesFound = abi.encodePacked(spender);
    }

    function acceptOwnership() external pure returns (bytes memory addressesFound) {
        // Nothing to decode
    }


    // @desc The new owner address
    // @tag newOwner:address
    function transferOwnership(address newOwner) external pure returns (bytes memory addressesFound) {
        addressesFound = abi.encodePacked(newOwner);
    }

    fallback() external {
        revert BaseDecoderAndSanitizer__FunctionNotImplemented(msg.data);
    }
}

src/interfaces/DecoderCustomTypes.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

contract DecoderCustomTypes {
    // ========================================= BALANCER =========================================
    struct JoinPoolRequest {
        address[] assets;
        uint256[] maxAmountsIn;
        bytes userData;
        bool fromInternalBalance;
    }

    struct ExitPoolRequest {
        address[] assets;
        uint256[] minAmountsOut;
        bytes userData;
        bool toInternalBalance;
    }

    enum SwapKind {
        GIVEN_IN,
        GIVEN_OUT
    }

    struct SingleSwap {
        bytes32 poolId;
        SwapKind kind;
        address assetIn;
        address assetOut;
        uint256 amount;
        bytes userData;
    }

    struct FundManagement {
        address sender;
        bool fromInternalBalance;
        address recipient;
        bool toInternalBalance;
    }

    // ========================================= VELODROME =========================================
    struct VelodromeMintParams {
        address token0;
        address token1;
        int24 tickSpacing;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        address recipient;
        uint256 deadline;
        uint160 sqrtPriceX96;
    }

    // ========================================= UNISWAP V3 =========================================

    struct MintParams {
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        address recipient;
        uint256 deadline;
    }

    struct IncreaseLiquidityParams {
        uint256 tokenId;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    struct DecreaseLiquidityParams {
        uint256 tokenId;
        uint128 liquidity;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    struct CollectParams {
        uint256 tokenId;
        address recipient;
        uint128 amount0Max;
        uint128 amount1Max;
    }

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    // ========================================= MORPHO BLUE =========================================

    struct MarketParams {
        address loanToken;
        address collateralToken;
        address oracle;
        address irm;
        uint256 lltv;
    }

    // ========================================= 1INCH =========================================

    struct SwapDescription {
        address srcToken;
        address dstToken;
        address payable srcReceiver;
        address payable dstReceiver;
        uint256 amount;
        uint256 minReturnAmount;
        uint256 flags;
    }

    // ========================================= KITTENSWAP =========================================
    struct route {
        address from;
        address to;
        bool stable;
    }

    // ========================================= PENDLE =========================================
    struct TokenInput {
        // TOKEN DATA
        address tokenIn;
        uint256 netTokenIn;
        address tokenMintSy;
        // AGGREGATOR DATA
        address pendleSwap;
        SwapData swapData;
    }

    struct TokenOutput {
        // TOKEN DATA
        address tokenOut;
        uint256 minTokenOut;
        address tokenRedeemSy;
        // AGGREGATOR DATA
        address pendleSwap;
        SwapData swapData;
    }

    struct ApproxParams {
        uint256 guessMin;
        uint256 guessMax;
        uint256 guessOffchain; // pass 0 in to skip this variable
        uint256 maxIteration; // every iteration, the diff between guessMin and guessMax will be divided by 2
        // the max eps between the returned result & the correct result, base 1e18. Normally this number
        // will be set to 1e15 (1e18/1000 = 0.1%)
        uint256 eps;
    }

    struct SwapData {
        SwapType swapType;
        address extRouter;
        bytes extCalldata;
        bool needScale;
    }

    struct SwapDataExtra {
        address tokenIn;
        address tokenOut;
        uint256 minOut;
        SwapData swapData;
    }

    enum OrderType {
        SY_FOR_PT,
        PT_FOR_SY,
        SY_FOR_YT,
        YT_FOR_SY
    }

    struct Order {
        uint256 salt;
        uint256 expiry;
        uint256 nonce;
        OrderType orderType;
        address token;
        address YT;
        address maker;
        address receiver;
        uint256 makingAmount;
        uint256 lnImpliedRate;
        uint256 failSafeRate;
        bytes permit;
    }

    struct FillOrderParams {
        Order order;
        bytes signature;
        uint256 makingAmount;
    }

    struct LimitOrderData {
        address limitRouter;
        uint256 epsSkipMarket; // only used for swap operations, will be ignored otherwise
        FillOrderParams[] normalFills;
        FillOrderParams[] flashFills;
        bytes optData;
    }

    enum SwapType {
        NONE,
        KYBERSWAP,
        ONE_INCH,
        // ETH_WETH not used in Aggregator
        ETH_WETH
    }

    struct RedeemYtIncomeToTokenStruct {
        address yt;
        bool doRedeemInterest;
        bool doRedeemRewards;
        address tokenRedeemSy;
        uint256 minTokenRedeemOut;
    }

    // ========================================= KYBERSWAP =========================================
    struct KyberSwapDescriptionV2 {
        address srcToken;
        address dstToken;
        address[] srcReceivers; // transfer src token to these addresses, default
        uint256[] srcAmounts;
        address[] feeReceivers;
        uint256[] feeAmounts;
        address dstReceiver;
        uint256 amount;
        uint256 minReturnAmount;
        uint256 flags;
        bytes permit;
    }

    /// @dev payload of MetaAggregationRouterV2.swap(SwapExecutionParams)
    struct KyberSwapExecutionParams {
        address callTarget; // call this address
        address approveTarget; // approve this address if _APPROVE_FUND set
        bytes targetData;
        KyberSwapDescriptionV2 desc;
        bytes clientData;
    }

    // ========================================= NUCLEUS =========================================

    struct AtomicRequestUCP {
        uint64 deadline; // Timestamp when request expires
        uint96 atomicPrice; // User's limit price in want asset decimals
        uint96 offerAmount; // Amount of offer asset to sell
        address recipient; // Address to receive want assets
    }

    // ========================================= SUPERBRIDGE =========================================
    /// @notice Struct representing a withdrawal transaction.
    /// @custom:field nonce    Nonce of the withdrawal transaction
    /// @custom:field sender   Address of the sender of the transaction.
    /// @custom:field target   Address of the recipient of the transaction.
    /// @custom:field value    Value to send to the recipient.
    /// @custom:field gasLimit Gas limit of the transaction.
    /// @custom:field data     Data of the transaction.
    struct WithdrawalTransaction {
        uint256 nonce;
        address sender;
        address target;
        uint256 value;
        uint256 gasLimit;
        bytes data;
    }

    /// @notice Struct representing the elements that are hashed together to generate an output root
    ///         which itself represents a snapshot of the L2 state.
    /// @custom:field version                  Version of the output root.
    /// @custom:field stateRoot                Root of the state trie at the block of this output.
    /// @custom:field messagePasserStorageRoot Root of the message passer storage trie.
    /// @custom:field latestBlockhash          Hash of the block this output was generated from.
    struct OutputRootProof {
        bytes32 version;
        bytes32 stateRoot;
        bytes32 messagePasserStorageRoot;
        bytes32 latestBlockhash;
    }

    // ========================================= EIGEN LAYER =========================================

    struct QueuedWithdrawalParams {
        // Array of strategies that the QueuedWithdrawal contains
        address[] strategies;
        // Array containing the amount of shares in each Strategy in the `strategies` array
        uint256[] shares;
        // The address of the withdrawer
        address withdrawer;
    }

    struct Withdrawal {
        // The address that originated the Withdrawal
        address staker;
        // The address that the staker was delegated to at the time that the Withdrawal was created
        address delegatedTo;
        // The address that can complete the Withdrawal + will receive funds when completing the withdrawal
        address withdrawer;
        // Nonce used to guarantee that otherwise identical withdrawals have unique hashes
        uint256 nonce;
        // Block number when the Withdrawal was created
        uint32 startBlock;
        // Array of strategies that the Withdrawal contains
        address[] strategies;
        // Array containing the amount of shares in each Strategy in the `strategies` array
        uint256[] shares;
    }

    /// @notice Minimal market data to be provided by the user when setting markets.
    struct MarketData {
        /// @notice Morpho Market ID.
        bytes32 id;
        /// @notice Address of the price feed used to convert the value of the market's loan token to the numeraire.
        address priceFeed;
        /// @notice Indicates whether the price feed value should be inverted (e.g. USD/WETH -> WETH/USD).
        bool invertPrice;
    }

    // ========================================= Sentiment =========================================

    /// @title Operation
    /// @notice Operation type definitions that can be applied to a position
    /// @dev Every operation except NewPosition requires that the caller must be an authz caller or owner
    enum Operation {
        NewPosition, // create2 a new position with a given type, no auth needed
        // the following operations require msg.sender to be authorized
        Exec, // execute arbitrary calldata on a position
        Deposit, // Add collateral to a given position
        Transfer, // transfer assets from the position to a external address
        Approve, // allow a spender to transfer assets from a position
        Repay, // decrease position debt
        Borrow, // increase position debt
        AddToken, // upsert collateral asset to position storage
        RemoveToken // remove collateral asset from position storage
    }

    /// @title Action
    /// @notice Generic data struct to create a common data container for all operation types
    /// @dev target and data are interpreted in different ways based on the operation type
    struct Action {
        // operation type
        Operation op;
        // dynamic bytes data, interpreted differently across operation types
        bytes data;
    }

    // ========================================= hwHYPE =========================================
    /**
     * @notice Stores request information needed to fulfill a users atomic request.
     * @param deadline unix timestamp for when request is no longer valid
     * @param atomicPrice the price in terms of `want` asset the user wants their `offer` assets "sold" at
     * @dev atomicPrice MUST be in terms of `want` asset decimals.
     * @param offerAmount the amount of `offer` asset the user wants converted to `want` asset
     * @param inSolve bool used during solves to prevent duplicate users, and to prevent redoing multiple checks
     */
    struct AtomicRequest {
        uint64 deadline; // deadline to fulfill request
        uint88 atomicPrice; // In terms of want asset decimals
        uint96 offerAmount; // The amount of offer asset the user wants to sell.
        bool inSolve; // Indicates whether this user is currently having their request fulfilled.
        uint256 updateTime; // Indicates time of request update
    }

    // ======================================== NestVaultPredicateProxy =========================================
    /// @notice Struct that bundles together a task's parameters for validation
    struct PredicateMessage {
        // the unique identifier for the task
        string taskId;
        // the Timestamp expiry for the task
        uint256 expireByTime;
        // the operators that have signed the task
        address[] signerAddresses;
        // the signatures of the operators that have signed the task
        bytes[] signatures;
    }
}
Compiler settingsShow
{
  "viaIR": false,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "shanghai",
  "remappings": [
    "@solmate/=lib/solmate/src/",
    "@forge-std/=lib/forge-std/src/",
    "forge-std/=lib/forge-std/src/",
    "@ds-test/=lib/forge-std/lib/ds-test/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@ion-protocol/=lib/ion-protocol/src/",
    "@layerzerolabs/=node_modules/@layerzerolabs/",
    "@axelar-network/=node_modules/@axelar-network/",
    "@balancer-labs/v2-interfaces/=lib/ion-protocol/lib/balancer-v2-monorepo/pkg/interfaces/",
    "@balancer-labs/v2-pool-stable/=lib/ion-protocol/lib/balancer-v2-monorepo/pkg/pool-stable/",
    "@chainlink/=node_modules/@chainlink/",
    "@eth-optimism/=node_modules/@eth-optimism/",
    "@uniswap/v3-core/=lib/ion-protocol/lib/v3-core/",
    "@uniswap/v3-periphery/=lib/ion-protocol/lib/v3-periphery/",
    "balancer-v2-monorepo/=lib/ion-protocol/lib/",
    "chainlink/=lib/ion-protocol/lib/chainlink/",
    "createx/=lib/createx/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-safe/=lib/ion-protocol/lib/forge-safe/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "hardhat-deploy/=node_modules/hardhat-deploy/",
    "ion-protocol/=lib/ion-protocol/",
    "openzeppelin-contracts-upgradeable/=lib/ion-protocol/lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/createx/lib/openzeppelin-contracts/contracts/",
    "pendle-core-v2-public/=lib/ion-protocol/lib/pendle-core-v2-public/contracts/",
    "solady/=lib/ion-protocol/lib/solady/",
    "solarray/=lib/ion-protocol/lib/solarray/src/",
    "solidity-bytes-utils/=node_modules/solidity-bytes-utils/",
    "solidity-stringutils/=lib/ion-protocol/lib/forge-safe/lib/surl/lib/solidity-stringutils/",
    "solmate/=lib/solmate/src/",
    "surl/=lib/ion-protocol/lib/forge-safe/lib/surl/",
    "v3-core/=lib/ion-protocol/lib/v3-core/",
    "v3-periphery/=lib/v3-periphery/contracts/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.