-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCommands.sol
122 lines (103 loc) · 4.41 KB
/
Commands.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.20;
// Based on https://github.com/Uniswap/universal-router/blob/main/contracts/libraries/Commands.sol
library Commands {
bytes1 internal constant COMMAND_TYPE_MASK = 0x3f;
/**
* Transfers tokens from msg.sender to the Router.
* (address token, uint256 value)
*/
uint256 constant TRANSFER_FROM = 0x00;
/**
* Transfers tokens from msg.sender to the Router with a permit.
* (address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
*/
uint256 constant TRANSFER_FROM_WITH_PERMIT = 0x01;
/**
* Transfers tokens from the Router to a recipient.
* (address token, address recipient, uint256 value)
*/
uint256 constant TRANSFER = 0x02;
/**
* Performs a swap on Curve.
* (address pool, uint256 i, uint256 j, uint256 amountIn, uint256 minAmountOut, address recipient)
*/
uint256 constant CURVE_SWAP = 0x03;
/**
* Deposits an ERC20 underlying into an ERC4626 IBT
* ibt represents the target IBT and assets represents the amount of underlying to deposit
* (address ibt, uint256 assets, address recipient)
*/
uint256 constant DEPOSIT_ASSET_IN_IBT = 0x04;
/**
* Deposits an ERC20 underlying into a PT
* assets represents the amount of underlying to deposit
* (address pt, uint256 assets, address ptRecipient, address ytRecipient, uint256 minShares)
*/
uint256 constant DEPOSIT_ASSET_IN_PT = 0x05;
/**
* Deposits an ERC4626 IBT into a PT
* ibts represents the amount of IBT to deposit
* (address pt, uint256 ibts, address ptRecipient, address ytRecipient, uint256 minShares)
*/
uint256 constant DEPOSIT_IBT_IN_PT = 0x06;
/**
* Redeems an ERC4626 IBT for the corresponding ERC20 underlying
* ibt represents the target IBT and shares represents the amount of IBT to redeem
* (address ibt, uint256 shares, address recipient)
*/
uint256 constant REDEEM_IBT_FOR_ASSET = 0x07;
/**
* Redeems a PT:YT pair for the corresponding ERC20 underlying
* shares represents the amount of PT to redeem
* (address pt, uint256 shares, address recipient, uint256 minAssets)
*/
uint256 constant REDEEM_PT_FOR_ASSET = 0x08;
/**
* Redeems a PT:YT pair for the corresponding ERC4626 IBT
* shares represents the amount of PT to redeem
* (address pt, uint256 shares, address recipient, uint256 minIbts)
*/
uint256 constant REDEEM_PT_FOR_IBT = 0x09;
/**
* Performs a flash loan
* data represents the sequence of commands and inputs to be executed during the loan
* (address lender, address token, uint256 amount, bytes calldata data)
*/
uint256 constant FLASH_LOAN = 0x0a;
/**
* Split liquidity between IBT and PT before depositing in a Curve pool
* ibts represents the amount of IBT to split between IBT and PT before depositing in the pool
* recipient represents the address that will receive the IBT/PT
* ytRecipient represents the address that will receive the YTs generated by the split
* (address pool, uint256 ibts, address recipient, address ytRecipient, uint256 minPTShares)
*/
uint256 constant CURVE_SPLIT_IBT_LIQUIDITY = 0x0b;
/**
* Deposit coins into a Curve pool
* amounts includes the amounts of IBT and PT to deposit in the pool
* min_mint_amount represents the minimum amount of LP tokens to mint
* (address pool, uint256[] amounts, uint256 min_mint_amount, address recipient)
*/
uint256 constant CURVE_ADD_LIQUIDITY = 0x0c;
/**
* Withdraw coins from a Curve pool
* lps represents the amount of LP tokens to burn
* min_amounts represents the minimum amount of coins to receive
* (address pool, uint256 lps, uint256[] min_amounts, address recipient)
*/
uint256 constant CURVE_REMOVE_LIQUIDITY = 0x0d;
/**
* Withdraw a single coin from a Curve pool
* lps represents the amount of LP tokens to burn
* i represents the index of the coin to withdraw
* min_amount represents the minimum amount of coin to receive
* (address pool, uint256 lps, uint256 i, uint256 min_amount, address recipient)
*/
uint256 constant CURVE_REMOVE_LIQUIDITY_ONE_COIN = 0x0e;
/**
* Performs a minimum balance check.
* (address token, address owner, uint256 minValue)
*/
uint256 constant ASSERT_MIN_BALANCE = 0x0f;
}