🇺🇲
Protocolink
  • 🔮Overview
  • 🌟Why Protocolink?
  • 💡Use Cases
    • Flash Loans
    • Permit2 Amplifier
    • Zap-in & Zap-out
    • Position Management
    • Multi-Action Bundling
  • 📋Networks & Protocols
  • 🛡️Security & Audits
  • 💎Fees
  • ❓FAQ
  • Protocolink API
    • 🔮Overview
      • Swap & Supply (Example)
    • 📗Swagger
      • Request Protocols
      • Request Tokens
      • Request Quote
      • Estimate Logics Result
      • Request Transaction Data
  • Protocolink SDK
    • 🔮Overview
    • 1️⃣Install SDK
    • 2️⃣Build Logics
    • 3️⃣Estimate Router Data
    • 4️⃣Send Router Transaction
    • ⚒️API SDK Interfaces
      • Global Types
      • FlashLoan Logic
      • Aave V2
      • Aave V3
      • Balancer V2
      • Compound V3
      • Iolend
      • Magicsea
      • Morphoblue
      • OpenOcean V2
      • ParaSwap V5
      • Permit2
      • Spark
      • Stargate
      • Stargate V2
      • SyncSwap
      • Uniswap V3
      • Utility
      • Wagmi
      • ZeroEx V4
    • ⚒️Common SDK Interfaces
      • Constants
      • Network
      • Token
      • Web3Toolkit
      • Utility Functions
  • Lending SDK
    • 🔮Overview
    • ✳️SDK
      • Open By Collateral
      • Open By Debt
      • Close
      • Leverage By Collateral
      • Leverage By Debt
      • Deleverage
      • Collateral swap
      • Debt swap
      • Zap supply
      • Zap withdraw
      • Zap repay
      • Zap borrow
  • Smart Contract
    • 🔮Overview
      • Router
      • Agent
      • Callback
      • Fees
      • Utility
      • Data Type
      • ERC721/ERC1155 Support
    • 📑Deployment Addresses
    • 🧑‍💻Security Review Details
  • COMPOUND KIT
    • 🔮Overview
    • ✳️SDK
      • Leverage
      • Deleverage
      • Collateral Swap
      • Zap Supply
      • Zap Withdraw
      • Zap Repay
      • Zap Borrow
    • 📗API
  • Video Tutorials
    • 1. Introducing Protocolink
    • 2. Lending SDK
    • 3. Protocolink Q&A
  • Social medias
    • Twitter
  • Support
Powered by GitBook
On this page
  1. Smart Contract
  2. Overview

Data Type

The structures and enumerations used in Protocolink contracts.

PreviousUtilityNextERC721/ERC1155 Support

Last updated 1 year ago

enum WrapMode {
    NONE,
    WRAP_BEFORE,
    UNWRAP_AFTER
}
  • NONE: Do not wrap the native token when Protocolink executes the protocol operation.

  • WRAP_BEFORE: Wrap the native token before Protocolink executes the protocol operation.

  • UNWRAP_AFTER: Unwrap the token after Protocolink executes the protocol operation.

struct Input {
    address token;
    uint256 balanceBps;
    uint256 amountOrOffset;
}
  • token: The address of the input token.

  • balanceBps: The value represents how much percentage of the token balance will be used. The base is 10_000 which means 7_000 represents 70% of the token balance. If you want to use a fixed amount instead, set this value to 0.

  • amountOrOffset: The value represents the fixed token amount in use when balanceBps is set to 0. Otherwise, it represents the byte offset for replacing the amount value in the Logic.data. If the amount value does not need to be replaced, set amountOrOffset to .

struct Logic {
    address to;
    bytes data;
    Input[] inputs;
    WrapMode wrapMode;
    address approveTo;
    address callback;
}
  • to: The contract address that Protocolink interacts with.

  • data: The transaction data to execute.

  • inputs: The token addresses and amounts expected to be used in the transaction.

  • wrapMode: Specifies whether the native tokens need to be wrapped (e.g., ETH to WETH). If the native tokens need to be wrapped, set it to WRAP_BEFORE. If the tokens need to be unwrapped after the transaction data is executed, set it to UNWRAP_AFTER. Otherwise, set it to NONE.

  • callback: The callback address is provided to a flash loan contract to execute subsequent operations.

struct ExecutionDetails {
    bytes[] permit2Datas;
    Logic[] logics;
    address[] tokensReturn;
    uint256 nonce;
    uint256 deadline;
}
  • permit2Datas: The Permit2 data for pulling tokens from the user address.

  • logics: The operations for Protocolink to interact with other protocols.

  • tokensReturn: The specified tokens should be sent back to the user address at the end of the transaction.

  • nonce: A one-time used value to prevent signature replay attack.

  • deadline: The signature expiration time.

struct Fee {
    address token;
    uint256 amount;
    bytes32 metadata;
}
  • token: The fee token address.

  • amount: The fee amount.

  • metadata: The fee source that is used only for events.

struct LogicBatch {
    Logic[] logics;
    Fee[] fees;
    bytes32[] referrals;
    uint256 deadline;
}
  • logics: The operations for Protocolink to interact with other protocols.

  • fees: The fees that are charged by Protocolink.

  • referrals: The receivers of the fees and the fee rates.

  • deadline: The signature expiration time.

struct ExecutionBatchDetails {
    bytes[] permit2Datas;
    LogicBatch logicBatch;
    address[] tokensReturn;
    uint256 nonce;
    uint256 deadline;
}
  • permit2Datas: The Permit2 data for pulling tokens from the user address.

  • logicBatch: The operations for Protocolink to interact with other protocols.

  • tokensReturn: The specified tokens should be sent back to the user address at the end of the transaction.

  • nonce: A one-time used value to prevent signature replay attack.

  • deadline: The signature expiration time.

struct DelegationDetails {
    address delegatee;
    uint128 expiry;
    uint128 nonce;
    uint256 deadline;
}
  • delegatee: The delegatee address.

  • expiry: The delegation expiration time.

  • nonce: A one-time used value to prevent signature replay attack.

  • deadline: The signature expiration time.

struct PackedDelegation {
    uint128 expiry;
    uint128 nonce;
}
  • expiry: The delegation expiration time.

  • nonce: A one-time used value to prevent signature replay attack.

Check more details at .

approveTo: Authorize a contract address, such as , that does not equal the to address. If the approveTo address equals the to address, fill in the approveTo address with address(0).

🔮
WrapMode
Input
1<<255
Logic
Paraswap TokenTransferProxy
ExecutionDetails
Fee
LogicBatch
ExecutionBatchDetails
DelegationDetails
PackedDelegation
#execute-transactions-with-balancelink