shift
  • Introduction
  • Underlying factors for developing shift
  • Get started
    • How to choose the Vault
    • How to deposit
    • How to withdraw
    • How to shuffle between Vault versions
    • How to track the balance
    • How to review transactions history
    • Emergency situation
  • SHIFT Products
    • Vault
    • DeFi strategy
    • Vault for Financial Institutes
  • Risk Management
    • Overview
    • Risk Assessment and Management Policy
    • Risk Mitigation
  • Developer Resources
    • Ecosystem overview
    • Vault contract
      • Position status logic
    • DEFII
      • Logic contract
      • LocalDefii contract
      • RemoteDefiiPrincipal contract
      • RemoteDefiiAgent contract
      • Instructions
    • OperatorRegistry contract
    • Emergency situations
    • Deployment addresses
  • Vaults
    • USD - Risk Level 3
  • FAQ
    • General
    • Fee terms
    • Platform design
    • Emergency
    • Utility
    • Security
    • Communication
  • Resources
    • Discord
    • Medium
    • Twitter
    • Telegram
    • Github
Powered by GitBook
On this page
  1. Developer Resources
  2. DEFII

Instructions

For users, there are several types of instructions available. Instructions allow users to manage liquidity and protect themselves from attacks related to swaps, minting, and burning LP tokens.

The following instructions exist:

  1. SWAP - token exchange using the 1inch router.

struct SwapInstruction {
        address tokenIn;
        address tokenOut;
        uint256 amountIn;
        uint256 minAmountOut;
        bytes routerCalldata;
    }
Field
Type
Definition

tokenIn

address

Address of the input token for the swap

tokenOut

address

Address of the output token for the swap

amountIn

uint256

Amount of the input token

minAmountOut

uint256

Slippage protection

routerCalldata

bytes

Calldata for the 1inch router

  1. BRIDGE - token bridging instructions from or to the Vault network.

struct BridgeInstruction {
        address token;
        uint256 amount;
        uint256 slippage;
        address bridgeAdapter;
        uint256 value;
        bytes bridgeParams;
    }
Field
Type
Definition

token

address

Token for the bridge

amount

uint256

Amount of tokens

slippage

uint256

Slippage protection

bridgeAdapter

address

Bridge adapter address

value

uint256

Fee value

bridgeParams

bytes

Bridge parameters

  1. SWAP_BRIDGE - a combination of SWAP and BRIDGE instructions.

struct SwapBridgeInstruction {
    address tokenIn;
    address tokenOut;
    uint256 amountIn;
    uint256 minAmountOut;
    bytes routerCalldata;
    address bridgeAdapter;
    uint256 value;
    bytes bridgeParams;
    uint256 slippage;
}
Field
Type
Definition

tokenIn

address

Address of the input token for the swap

tokenOut

address

Address of the output token for the swap

amountIn

uint256

Amount of the input token

minAmountOut

uint256

Slippage protection

routerCalldata

bytes

Calldata for the 1inch router

bridgeAdapter

address

Bridge adapter address

value

uint256

bridgeParams

bytes

Bridge parameters

  1. MIN_LIQUIDITY_DELTA - slippage protection. Specifies how much DEFII LP should be minted in exchange for the provided DEFII liquidity.

  2. MIN_TOKENS_DELTA - specifies how many ERC20 tokens should be received. Indicates how many tokens should be received in exchange for DEFII LP. To use this instruction, you need to pass 2 arrays: 1) a list of all tokens for which you need to check the minimum token amount; 2) a list of all min liquidity delta values.

Last updated 1 year ago