-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathStructGen.sol
More file actions
47 lines (41 loc) · 1.57 KB
/
StructGen.sol
File metadata and controls
47 lines (41 loc) · 1.57 KB
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
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.23 <0.9.0;
import "@pendle/core-v2/contracts/interfaces/IPAllActionV3.sol";
import "@pendle/core-v2/contracts/interfaces/IPMarket.sol";
abstract contract StructGen {
// EmptySwap means no swap aggregator is involved
SwapData public emptySwap;
// EmptyLimit means no limit order is involved
LimitOrderData public emptyLimit;
// DefaultApprox means no off-chain preparation is involved, more gas consuming (~ 180k gas)
ApproxParams public defaultApprox = ApproxParams(0, type(uint256).max, 0, 256, 1e14);
/// @notice create a simple TokenInput struct without using any aggregators. For more info please refer to
/// IPAllActionTypeV3.sol
function createTokenInputStruct(address tokenIn, uint256 netTokenIn) internal view returns (TokenInput memory) {
return TokenInput({
tokenIn: tokenIn,
netTokenIn: netTokenIn,
tokenMintSy: tokenIn,
pendleSwap: address(0),
swapData: emptySwap
});
}
/// @notice create a simple TokenOutput struct without using any aggregators. For more info please refer to
/// IPAllActionTypeV3.sol
function createTokenOutputStruct(
address tokenOut,
uint256 minTokenOut
)
internal
view
returns (TokenOutput memory)
{
return TokenOutput({
tokenOut: tokenOut,
minTokenOut: minTokenOut,
tokenRedeemSy: tokenOut,
pendleSwap: address(0),
swapData: emptySwap
});
}
}