@enzymefinance/testutils 4.0.0-next.6 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1548 -0
- package/dist/index.js +3352 -0
- package/dist/index.mjs +3352 -0
- package/package.json +74 -11
- package/CHANGELOG.md +0 -52
- package/dist/declarations/src/assertions.d.ts +0 -4
- package/dist/declarations/src/deployment.d.ts +0 -192
- package/dist/declarations/src/gasRelayer.d.ts +0 -56
- package/dist/declarations/src/helpers.d.ts +0 -16
- package/dist/declarations/src/index.d.ts +0 -6
- package/dist/declarations/src/scaffolding/assets.d.ts +0 -10
- package/dist/declarations/src/scaffolding/chainlink.d.ts +0 -3
- package/dist/declarations/src/scaffolding/common.d.ts +0 -7
- package/dist/declarations/src/scaffolding/core.d.ts +0 -17
- package/dist/declarations/src/scaffolding/extensions/common.d.ts +0 -11
- package/dist/declarations/src/scaffolding/extensions/external-positions/actions.d.ts +0 -35
- package/dist/declarations/src/scaffolding/extensions/external-positions/compound.d.ts +0 -56
- package/dist/declarations/src/scaffolding/extensions/external-positions/index.d.ts +0 -4
- package/dist/declarations/src/scaffolding/extensions/external-positions/mocks.d.ts +0 -53
- package/dist/declarations/src/scaffolding/extensions/external-positions/uniswap-v3-liquidity.d.ts +0 -99
- package/dist/declarations/src/scaffolding/extensions/fees.d.ts +0 -12
- package/dist/declarations/src/scaffolding/extensions/index.d.ts +0 -5
- package/dist/declarations/src/scaffolding/extensions/integrations/aave.d.ts +0 -20
- package/dist/declarations/src/scaffolding/extensions/integrations/compound.d.ts +0 -28
- package/dist/declarations/src/scaffolding/extensions/integrations/curve.d.ts +0 -346
- package/dist/declarations/src/scaffolding/extensions/integrations/idle.d.ts +0 -28
- package/dist/declarations/src/scaffolding/extensions/integrations/index.d.ts +0 -15
- package/dist/declarations/src/scaffolding/extensions/integrations/mock.d.ts +0 -32
- package/dist/declarations/src/scaffolding/extensions/integrations/olympusV2.d.ts +0 -17
- package/dist/declarations/src/scaffolding/extensions/integrations/paraSwapV4.d.ts +0 -23
- package/dist/declarations/src/scaffolding/extensions/integrations/paraSwapV5.d.ts +0 -23
- package/dist/declarations/src/scaffolding/extensions/integrations/poolTogetherV4.d.ts +0 -29
- package/dist/declarations/src/scaffolding/extensions/integrations/synthetix.d.ts +0 -33
- package/dist/declarations/src/scaffolding/extensions/integrations/trackedAssets.d.ts +0 -15
- package/dist/declarations/src/scaffolding/extensions/integrations/uniswapV2.d.ts +0 -46
- package/dist/declarations/src/scaffolding/extensions/integrations/uniswapV3.d.ts +0 -15
- package/dist/declarations/src/scaffolding/extensions/integrations/yearn.d.ts +0 -22
- package/dist/declarations/src/scaffolding/extensions/integrations/zeroExV2.d.ts +0 -12
- package/dist/declarations/src/scaffolding/extensions/policies.d.ts +0 -17
- package/dist/declarations/src/scaffolding/index.d.ts +0 -8
- package/dist/declarations/src/scaffolding/setup.d.ts +0 -77
- package/dist/declarations/src/scaffolding/shares.d.ts +0 -35
- package/dist/declarations/src/scaffolding/vaultCalls.d.ts +0 -32
- package/dist/declarations/src/whales.d.ts +0 -46
- package/dist/enzymefinance-testutils.browser.cjs.js +0 -4369
- package/dist/enzymefinance-testutils.browser.esm.js +0 -4217
- package/dist/enzymefinance-testutils.cjs.d.ts +0 -1
- package/dist/enzymefinance-testutils.cjs.dev.js +0 -4369
- package/dist/enzymefinance-testutils.cjs.js +0 -7
- package/dist/enzymefinance-testutils.cjs.prod.js +0 -4369
- package/dist/enzymefinance-testutils.esm.js +0 -4217
- package/src/assertions.ts +0 -23
- package/src/deployment.ts +0 -285
- package/src/gasRelayer.ts +0 -95
- package/src/helpers.ts +0 -39
- package/src/index.ts +0 -6
- package/src/scaffolding/assets.ts +0 -37
- package/src/scaffolding/chainlink.ts +0 -8
- package/src/scaffolding/common.ts +0 -11
- package/src/scaffolding/core.ts +0 -111
- package/src/scaffolding/extensions/common.ts +0 -30
- package/src/scaffolding/extensions/external-positions/actions.ts +0 -103
- package/src/scaffolding/extensions/external-positions/compound.ts +0 -190
- package/src/scaffolding/extensions/external-positions/index.ts +0 -4
- package/src/scaffolding/extensions/external-positions/mocks.ts +0 -194
- package/src/scaffolding/extensions/external-positions/uniswap-v3-liquidity.ts +0 -290
- package/src/scaffolding/extensions/fees.ts +0 -70
- package/src/scaffolding/extensions/index.ts +0 -5
- package/src/scaffolding/extensions/integrations/aave.ts +0 -78
- package/src/scaffolding/extensions/integrations/compound.ts +0 -94
- package/src/scaffolding/extensions/integrations/curve.ts +0 -1246
- package/src/scaffolding/extensions/integrations/idle.ts +0 -104
- package/src/scaffolding/extensions/integrations/index.ts +0 -15
- package/src/scaffolding/extensions/integrations/mock.ts +0 -116
- package/src/scaffolding/extensions/integrations/olympusV2.ts +0 -71
- package/src/scaffolding/extensions/integrations/paraSwapV4.ts +0 -70
- package/src/scaffolding/extensions/integrations/paraSwapV5.ts +0 -73
- package/src/scaffolding/extensions/integrations/poolTogetherV4.ts +0 -117
- package/src/scaffolding/extensions/integrations/synthetix.ts +0 -130
- package/src/scaffolding/extensions/integrations/trackedAssets.ts +0 -48
- package/src/scaffolding/extensions/integrations/uniswapV2.ts +0 -175
- package/src/scaffolding/extensions/integrations/uniswapV3.ts +0 -55
- package/src/scaffolding/extensions/integrations/yearn.ts +0 -79
- package/src/scaffolding/extensions/integrations/zeroExV2.ts +0 -47
- package/src/scaffolding/extensions/policies.ts +0 -112
- package/src/scaffolding/index.ts +0 -8
- package/src/scaffolding/setup.ts +0 -243
- package/src/scaffolding/shares.ts +0 -80
- package/src/scaffolding/vaultCalls.ts +0 -105
- package/src/types.d.ts +0 -1
- package/src/whales.ts +0 -77
- package/tsconfig.json +0 -5
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { AddressLike } from '@enzymefinance/ethers';
|
|
2
|
-
import type { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
3
|
-
import type { ComptrollerLib, IntegrationManager } from '@enzymefinance/protocol';
|
|
4
|
-
import {
|
|
5
|
-
addTrackedAssetsToVaultArgs,
|
|
6
|
-
IntegrationManagerActionId,
|
|
7
|
-
removeTrackedAssetsFromVaultArgs,
|
|
8
|
-
} from '@enzymefinance/protocol';
|
|
9
|
-
|
|
10
|
-
export function addTrackedAssetsToVault({
|
|
11
|
-
signer,
|
|
12
|
-
comptrollerProxy,
|
|
13
|
-
integrationManager,
|
|
14
|
-
assets,
|
|
15
|
-
}: {
|
|
16
|
-
signer: SignerWithAddress;
|
|
17
|
-
comptrollerProxy: ComptrollerLib;
|
|
18
|
-
integrationManager: IntegrationManager;
|
|
19
|
-
assets: AddressLike[];
|
|
20
|
-
}) {
|
|
21
|
-
return comptrollerProxy
|
|
22
|
-
.connect(signer)
|
|
23
|
-
.callOnExtension(
|
|
24
|
-
integrationManager,
|
|
25
|
-
IntegrationManagerActionId.AddTrackedAssetsToVault,
|
|
26
|
-
addTrackedAssetsToVaultArgs({ assets }),
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function removeTrackedAssetsFromVault({
|
|
31
|
-
signer,
|
|
32
|
-
comptrollerProxy,
|
|
33
|
-
integrationManager,
|
|
34
|
-
assets,
|
|
35
|
-
}: {
|
|
36
|
-
signer: SignerWithAddress;
|
|
37
|
-
comptrollerProxy: ComptrollerLib;
|
|
38
|
-
integrationManager: IntegrationManager;
|
|
39
|
-
assets: AddressLike[];
|
|
40
|
-
}) {
|
|
41
|
-
return comptrollerProxy
|
|
42
|
-
.connect(signer)
|
|
43
|
-
.callOnExtension(
|
|
44
|
-
integrationManager,
|
|
45
|
-
IntegrationManagerActionId.RemoveTrackedAssetsFromVault,
|
|
46
|
-
removeTrackedAssetsFromVaultArgs({ assets }),
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import type { AddressLike, Call, Contract, Send } from '@enzymefinance/ethers';
|
|
2
|
-
import { contract } from '@enzymefinance/ethers';
|
|
3
|
-
import type { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
4
|
-
import type {
|
|
5
|
-
ComptrollerLib,
|
|
6
|
-
IntegrationManager,
|
|
7
|
-
StandardToken,
|
|
8
|
-
UniswapV2ExchangeAdapter,
|
|
9
|
-
UniswapV2LiquidityAdapter,
|
|
10
|
-
VaultLib,
|
|
11
|
-
} from '@enzymefinance/protocol';
|
|
12
|
-
import {
|
|
13
|
-
callOnIntegrationArgs,
|
|
14
|
-
IntegrationManagerActionId,
|
|
15
|
-
lendSelector,
|
|
16
|
-
redeemSelector,
|
|
17
|
-
takeOrderSelector,
|
|
18
|
-
uniswapV2LendArgs,
|
|
19
|
-
uniswapV2RedeemArgs,
|
|
20
|
-
uniswapV2TakeOrderArgs,
|
|
21
|
-
} from '@enzymefinance/protocol';
|
|
22
|
-
import type { BigNumberish } from 'ethers';
|
|
23
|
-
|
|
24
|
-
export interface UniswapV2Factory extends Contract<UniswapV2Factory> {
|
|
25
|
-
createPair: Send<(_token0: AddressLike, _token1: AddressLike) => AddressLike>;
|
|
26
|
-
getPair: Call<(_token0: AddressLike, _token1: AddressLike) => AddressLike>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const UniswapV2Factory = contract<UniswapV2Factory>()`
|
|
30
|
-
function createPair(address,address) returns (address)
|
|
31
|
-
function getPair(address,address) view returns (address)
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
export async function uniswapV2Lend({
|
|
35
|
-
comptrollerProxy,
|
|
36
|
-
vaultProxy,
|
|
37
|
-
integrationManager,
|
|
38
|
-
fundOwner,
|
|
39
|
-
uniswapV2LiquidityAdapter,
|
|
40
|
-
tokenA,
|
|
41
|
-
tokenB,
|
|
42
|
-
amountADesired,
|
|
43
|
-
amountBDesired,
|
|
44
|
-
amountAMin,
|
|
45
|
-
amountBMin,
|
|
46
|
-
minPoolTokenAmount,
|
|
47
|
-
seedFund = false,
|
|
48
|
-
}: {
|
|
49
|
-
comptrollerProxy: ComptrollerLib;
|
|
50
|
-
vaultProxy: VaultLib;
|
|
51
|
-
integrationManager: IntegrationManager;
|
|
52
|
-
fundOwner: SignerWithAddress;
|
|
53
|
-
uniswapV2LiquidityAdapter: UniswapV2LiquidityAdapter;
|
|
54
|
-
tokenA: StandardToken;
|
|
55
|
-
tokenB: StandardToken;
|
|
56
|
-
amountADesired: BigNumberish;
|
|
57
|
-
amountBDesired: BigNumberish;
|
|
58
|
-
amountAMin: BigNumberish;
|
|
59
|
-
amountBMin: BigNumberish;
|
|
60
|
-
minPoolTokenAmount: BigNumberish;
|
|
61
|
-
seedFund?: boolean;
|
|
62
|
-
}) {
|
|
63
|
-
if (seedFund) {
|
|
64
|
-
// Seed the VaultProxy with enough tokenA and tokenB for the tx
|
|
65
|
-
await tokenA.transfer(vaultProxy, amountADesired);
|
|
66
|
-
await tokenB.transfer(vaultProxy, amountBDesired);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const lendArgs = uniswapV2LendArgs({
|
|
70
|
-
amountADesired,
|
|
71
|
-
amountAMin,
|
|
72
|
-
amountBDesired,
|
|
73
|
-
amountBMin,
|
|
74
|
-
minPoolTokenAmount,
|
|
75
|
-
tokenA,
|
|
76
|
-
tokenB,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const callArgs = callOnIntegrationArgs({
|
|
80
|
-
adapter: uniswapV2LiquidityAdapter,
|
|
81
|
-
encodedCallArgs: lendArgs,
|
|
82
|
-
selector: lendSelector,
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const lendTx = comptrollerProxy
|
|
86
|
-
.connect(fundOwner)
|
|
87
|
-
.callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
|
|
88
|
-
await expect(lendTx).resolves.toBeReceipt();
|
|
89
|
-
|
|
90
|
-
return lendTx;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export async function uniswapV2Redeem({
|
|
94
|
-
comptrollerProxy,
|
|
95
|
-
integrationManager,
|
|
96
|
-
fundOwner,
|
|
97
|
-
uniswapV2LiquidityAdapter,
|
|
98
|
-
poolTokenAmount,
|
|
99
|
-
tokenA,
|
|
100
|
-
tokenB,
|
|
101
|
-
amountAMin,
|
|
102
|
-
amountBMin,
|
|
103
|
-
}: {
|
|
104
|
-
comptrollerProxy: ComptrollerLib;
|
|
105
|
-
integrationManager: IntegrationManager;
|
|
106
|
-
fundOwner: SignerWithAddress;
|
|
107
|
-
uniswapV2LiquidityAdapter: UniswapV2LiquidityAdapter;
|
|
108
|
-
poolTokenAmount: BigNumberish;
|
|
109
|
-
tokenA: AddressLike;
|
|
110
|
-
tokenB: AddressLike;
|
|
111
|
-
amountAMin: BigNumberish;
|
|
112
|
-
amountBMin: BigNumberish;
|
|
113
|
-
}) {
|
|
114
|
-
const redeemArgs = uniswapV2RedeemArgs({
|
|
115
|
-
amountAMin,
|
|
116
|
-
amountBMin,
|
|
117
|
-
poolTokenAmount,
|
|
118
|
-
tokenA,
|
|
119
|
-
tokenB,
|
|
120
|
-
});
|
|
121
|
-
const callArgs = callOnIntegrationArgs({
|
|
122
|
-
adapter: uniswapV2LiquidityAdapter,
|
|
123
|
-
encodedCallArgs: redeemArgs,
|
|
124
|
-
selector: redeemSelector,
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const redeemTx = comptrollerProxy
|
|
128
|
-
.connect(fundOwner)
|
|
129
|
-
.callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
|
|
130
|
-
await expect(redeemTx).resolves.toBeReceipt();
|
|
131
|
-
|
|
132
|
-
return redeemTx;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export async function uniswapV2TakeOrder({
|
|
136
|
-
comptrollerProxy,
|
|
137
|
-
vaultProxy,
|
|
138
|
-
integrationManager,
|
|
139
|
-
fundOwner,
|
|
140
|
-
uniswapV2ExchangeAdapter,
|
|
141
|
-
path,
|
|
142
|
-
outgoingAssetAmount,
|
|
143
|
-
minIncomingAssetAmount,
|
|
144
|
-
seedFund = false,
|
|
145
|
-
}: {
|
|
146
|
-
comptrollerProxy: ComptrollerLib;
|
|
147
|
-
vaultProxy: VaultLib;
|
|
148
|
-
integrationManager: IntegrationManager;
|
|
149
|
-
fundOwner: SignerWithAddress;
|
|
150
|
-
uniswapV2ExchangeAdapter: UniswapV2ExchangeAdapter;
|
|
151
|
-
path: StandardToken[];
|
|
152
|
-
outgoingAssetAmount: BigNumberish;
|
|
153
|
-
minIncomingAssetAmount: BigNumberish;
|
|
154
|
-
seedFund?: boolean;
|
|
155
|
-
}) {
|
|
156
|
-
if (seedFund) {
|
|
157
|
-
// Seed the VaultProxy with enough outgoingAsset for the tx
|
|
158
|
-
await path[0].transfer(vaultProxy, outgoingAssetAmount);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const takeOrderArgs = uniswapV2TakeOrderArgs({
|
|
162
|
-
minIncomingAssetAmount,
|
|
163
|
-
outgoingAssetAmount,
|
|
164
|
-
path,
|
|
165
|
-
});
|
|
166
|
-
const callArgs = callOnIntegrationArgs({
|
|
167
|
-
adapter: uniswapV2ExchangeAdapter,
|
|
168
|
-
encodedCallArgs: takeOrderArgs,
|
|
169
|
-
selector: takeOrderSelector,
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
return comptrollerProxy
|
|
173
|
-
.connect(fundOwner)
|
|
174
|
-
.callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
|
|
175
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { AddressLike } from '@enzymefinance/ethers';
|
|
2
|
-
import type { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
3
|
-
import type { ComptrollerLib, IntegrationManager, StandardToken } from '@enzymefinance/protocol';
|
|
4
|
-
import {
|
|
5
|
-
callOnIntegrationArgs,
|
|
6
|
-
IntegrationManagerActionId,
|
|
7
|
-
takeOrderSelector,
|
|
8
|
-
uniswapV3TakeOrderArgs,
|
|
9
|
-
} from '@enzymefinance/protocol';
|
|
10
|
-
import type { BigNumber, BigNumberish } from 'ethers';
|
|
11
|
-
|
|
12
|
-
export async function uniswapV3TakeOrder({
|
|
13
|
-
comptrollerProxy,
|
|
14
|
-
integrationManager,
|
|
15
|
-
fundOwner,
|
|
16
|
-
uniswapV3Adapter,
|
|
17
|
-
pathAddresses,
|
|
18
|
-
pathFees,
|
|
19
|
-
outgoingAssetAmount,
|
|
20
|
-
minIncomingAssetAmount = 1,
|
|
21
|
-
seedFund = false,
|
|
22
|
-
}: {
|
|
23
|
-
comptrollerProxy: ComptrollerLib;
|
|
24
|
-
integrationManager: IntegrationManager;
|
|
25
|
-
fundOwner: SignerWithAddress;
|
|
26
|
-
uniswapV3Adapter: AddressLike;
|
|
27
|
-
pathAddresses: StandardToken[];
|
|
28
|
-
pathFees: BigNumber[];
|
|
29
|
-
outgoingAssetAmount: BigNumberish;
|
|
30
|
-
minIncomingAssetAmount?: BigNumberish;
|
|
31
|
-
seedFund?: boolean;
|
|
32
|
-
}) {
|
|
33
|
-
if (seedFund) {
|
|
34
|
-
// Seed the VaultProxy with enough outgoingAsset for the tx
|
|
35
|
-
const vaultProxy = await comptrollerProxy.getVaultProxy();
|
|
36
|
-
await pathAddresses[0].transfer(vaultProxy, outgoingAssetAmount);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const takeOrderArgs = uniswapV3TakeOrderArgs({
|
|
40
|
-
minIncomingAssetAmount,
|
|
41
|
-
outgoingAssetAmount,
|
|
42
|
-
pathAddresses,
|
|
43
|
-
pathFees,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const callArgs = callOnIntegrationArgs({
|
|
47
|
-
adapter: uniswapV3Adapter,
|
|
48
|
-
encodedCallArgs: takeOrderArgs,
|
|
49
|
-
selector: takeOrderSelector,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
return comptrollerProxy
|
|
53
|
-
.connect(fundOwner)
|
|
54
|
-
.callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
|
|
55
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import type { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
2
|
-
import type { ComptrollerLib, IntegrationManager, StandardToken, YearnVaultV2Adapter } from '@enzymefinance/protocol';
|
|
3
|
-
import {
|
|
4
|
-
callOnIntegrationArgs,
|
|
5
|
-
IntegrationManagerActionId,
|
|
6
|
-
lendSelector,
|
|
7
|
-
redeemSelector,
|
|
8
|
-
yearnVaultV2LendArgs,
|
|
9
|
-
yearnVaultV2RedeemArgs,
|
|
10
|
-
} from '@enzymefinance/protocol';
|
|
11
|
-
import type { BigNumberish } from 'ethers';
|
|
12
|
-
import { BigNumber } from 'ethers';
|
|
13
|
-
|
|
14
|
-
export async function yearnVaultV2Lend({
|
|
15
|
-
signer,
|
|
16
|
-
comptrollerProxy,
|
|
17
|
-
integrationManager,
|
|
18
|
-
yearnVaultV2Adapter,
|
|
19
|
-
yVault,
|
|
20
|
-
outgoingUnderlyingAmount,
|
|
21
|
-
minIncomingYVaultSharesAmount = BigNumber.from(1),
|
|
22
|
-
}: {
|
|
23
|
-
signer: SignerWithAddress;
|
|
24
|
-
comptrollerProxy: ComptrollerLib;
|
|
25
|
-
integrationManager: IntegrationManager;
|
|
26
|
-
yearnVaultV2Adapter: YearnVaultV2Adapter;
|
|
27
|
-
yVault: StandardToken;
|
|
28
|
-
outgoingUnderlyingAmount: BigNumberish;
|
|
29
|
-
minIncomingYVaultSharesAmount?: BigNumberish;
|
|
30
|
-
}) {
|
|
31
|
-
const callArgs = callOnIntegrationArgs({
|
|
32
|
-
adapter: yearnVaultV2Adapter,
|
|
33
|
-
encodedCallArgs: yearnVaultV2LendArgs({
|
|
34
|
-
minIncomingYVaultSharesAmount,
|
|
35
|
-
outgoingUnderlyingAmount,
|
|
36
|
-
yVault,
|
|
37
|
-
}),
|
|
38
|
-
selector: lendSelector,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return comptrollerProxy
|
|
42
|
-
.connect(signer)
|
|
43
|
-
.callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export async function yearnVaultV2Redeem({
|
|
47
|
-
signer,
|
|
48
|
-
comptrollerProxy,
|
|
49
|
-
integrationManager,
|
|
50
|
-
yearnVaultV2Adapter,
|
|
51
|
-
yVault,
|
|
52
|
-
maxOutgoingYVaultSharesAmount,
|
|
53
|
-
minIncomingUnderlyingAmount = BigNumber.from(1),
|
|
54
|
-
slippageToleranceBps = 1,
|
|
55
|
-
}: {
|
|
56
|
-
signer: SignerWithAddress;
|
|
57
|
-
comptrollerProxy: ComptrollerLib;
|
|
58
|
-
integrationManager: IntegrationManager;
|
|
59
|
-
yearnVaultV2Adapter: YearnVaultV2Adapter;
|
|
60
|
-
yVault: StandardToken;
|
|
61
|
-
maxOutgoingYVaultSharesAmount: BigNumberish;
|
|
62
|
-
minIncomingUnderlyingAmount?: BigNumberish;
|
|
63
|
-
slippageToleranceBps?: BigNumberish;
|
|
64
|
-
}) {
|
|
65
|
-
const callArgs = callOnIntegrationArgs({
|
|
66
|
-
adapter: yearnVaultV2Adapter,
|
|
67
|
-
encodedCallArgs: yearnVaultV2RedeemArgs({
|
|
68
|
-
maxOutgoingYVaultSharesAmount,
|
|
69
|
-
minIncomingUnderlyingAmount,
|
|
70
|
-
slippageToleranceBps,
|
|
71
|
-
yVault,
|
|
72
|
-
}),
|
|
73
|
-
selector: redeemSelector,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
return comptrollerProxy
|
|
77
|
-
.connect(signer)
|
|
78
|
-
.callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
|
|
79
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
2
|
-
import type {
|
|
3
|
-
ComptrollerLib,
|
|
4
|
-
IntegrationManager,
|
|
5
|
-
SignedZeroExV2Order,
|
|
6
|
-
VaultLib,
|
|
7
|
-
ZeroExV2Adapter,
|
|
8
|
-
} from '@enzymefinance/protocol';
|
|
9
|
-
import {
|
|
10
|
-
callOnIntegrationArgs,
|
|
11
|
-
IntegrationManagerActionId,
|
|
12
|
-
takeOrderSelector,
|
|
13
|
-
zeroExV2TakeOrderArgs,
|
|
14
|
-
} from '@enzymefinance/protocol';
|
|
15
|
-
import type { BigNumberish } from 'ethers';
|
|
16
|
-
|
|
17
|
-
export async function zeroExV2TakeOrder({
|
|
18
|
-
comptrollerProxy,
|
|
19
|
-
integrationManager,
|
|
20
|
-
fundOwner,
|
|
21
|
-
zeroExV2Adapter,
|
|
22
|
-
signedOrder,
|
|
23
|
-
takerAssetFillAmount,
|
|
24
|
-
}: {
|
|
25
|
-
comptrollerProxy: ComptrollerLib;
|
|
26
|
-
vaultProxy: VaultLib;
|
|
27
|
-
integrationManager: IntegrationManager;
|
|
28
|
-
fundOwner: SignerWithAddress;
|
|
29
|
-
zeroExV2Adapter: ZeroExV2Adapter;
|
|
30
|
-
signedOrder: SignedZeroExV2Order;
|
|
31
|
-
takerAssetFillAmount: BigNumberish;
|
|
32
|
-
}) {
|
|
33
|
-
const takeOrderArgs = zeroExV2TakeOrderArgs({
|
|
34
|
-
signedOrder,
|
|
35
|
-
takerAssetFillAmount,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const callArgs = callOnIntegrationArgs({
|
|
39
|
-
adapter: zeroExV2Adapter,
|
|
40
|
-
encodedCallArgs: takeOrderArgs,
|
|
41
|
-
selector: takeOrderSelector,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
return comptrollerProxy
|
|
45
|
-
.connect(fundOwner)
|
|
46
|
-
.callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
|
|
47
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { IPolicy, PolicyHook, policyManagerConfigArgs } from '@enzymefinance/protocol';
|
|
2
|
-
import type { Signer } from 'ethers';
|
|
3
|
-
import { constants, utils } from 'ethers';
|
|
4
|
-
|
|
5
|
-
// Policy Manager
|
|
6
|
-
|
|
7
|
-
export async function generatePolicyManagerConfigWithMockPolicies({ deployer }: { deployer: Signer }) {
|
|
8
|
-
const policies = Object.values(
|
|
9
|
-
await generateMockPolicies({
|
|
10
|
-
deployer,
|
|
11
|
-
}),
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
// Guarantees one policy has settings data
|
|
15
|
-
const policiesSettingsData = [...new Array(policies.length - 1).fill(constants.HashZero), utils.randomBytes(10)];
|
|
16
|
-
|
|
17
|
-
return policyManagerConfigArgs({
|
|
18
|
-
policies,
|
|
19
|
-
settings: policiesSettingsData,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function generateMockPolicies({ deployer }: { deployer: Signer }) {
|
|
24
|
-
// Create mock policies
|
|
25
|
-
const mockAddTrackedAssetsPolicy = await IPolicy.mock(deployer);
|
|
26
|
-
const mockCreateExternalPositionPolicy = await IPolicy.mock(deployer);
|
|
27
|
-
const mockPostBuySharesPolicy = await IPolicy.mock(deployer);
|
|
28
|
-
const mockPostCallOnExternalPositionPolicy = await IPolicy.mock(deployer);
|
|
29
|
-
const mockPostCoIPolicy = await IPolicy.mock(deployer);
|
|
30
|
-
const mockRedeemSharesForSpecificAssetsPolicy = await IPolicy.mock(deployer);
|
|
31
|
-
const mockPreTransferSharesPolicy = await IPolicy.mock(deployer);
|
|
32
|
-
const mockRemoveExternalPositionPolicy = await IPolicy.mock(deployer);
|
|
33
|
-
|
|
34
|
-
// Initialize mock policy return values
|
|
35
|
-
await Promise.all([
|
|
36
|
-
// AddTrackedAssets
|
|
37
|
-
mockAddTrackedAssetsPolicy.identifier.returns(`MOCK_ADD_TRACKED_ASSETS`),
|
|
38
|
-
mockAddTrackedAssetsPolicy.addFundSettings.returns(undefined),
|
|
39
|
-
mockAddTrackedAssetsPolicy.activateForFund.returns(undefined),
|
|
40
|
-
mockAddTrackedAssetsPolicy.canDisable.returns(false),
|
|
41
|
-
mockAddTrackedAssetsPolicy.validateRule.returns(true),
|
|
42
|
-
mockAddTrackedAssetsPolicy.implementedHooks.returns([PolicyHook.AddTrackedAssets]),
|
|
43
|
-
mockAddTrackedAssetsPolicy.updateFundSettings.returns(undefined),
|
|
44
|
-
// CreateExternalPosition
|
|
45
|
-
mockCreateExternalPositionPolicy.identifier.returns(`MOCK_CREATE_EXTERNAL_POSITION`),
|
|
46
|
-
mockCreateExternalPositionPolicy.addFundSettings.returns(undefined),
|
|
47
|
-
mockCreateExternalPositionPolicy.activateForFund.returns(undefined),
|
|
48
|
-
mockCreateExternalPositionPolicy.canDisable.returns(false),
|
|
49
|
-
mockCreateExternalPositionPolicy.validateRule.returns(true),
|
|
50
|
-
mockCreateExternalPositionPolicy.implementedHooks.returns([PolicyHook.CreateExternalPosition]),
|
|
51
|
-
mockCreateExternalPositionPolicy.updateFundSettings.returns(undefined),
|
|
52
|
-
// PostBuyShares
|
|
53
|
-
mockPostBuySharesPolicy.identifier.returns(`MOCK_POST_BUY_SHARES`),
|
|
54
|
-
mockPostBuySharesPolicy.addFundSettings.returns(undefined),
|
|
55
|
-
mockPostBuySharesPolicy.activateForFund.returns(undefined),
|
|
56
|
-
mockPostBuySharesPolicy.canDisable.returns(false),
|
|
57
|
-
mockPostBuySharesPolicy.validateRule.returns(true),
|
|
58
|
-
mockPostBuySharesPolicy.implementedHooks.returns([PolicyHook.PostBuyShares]),
|
|
59
|
-
mockPostBuySharesPolicy.updateFundSettings.returns(undefined),
|
|
60
|
-
// PostCallOnExternalPosition
|
|
61
|
-
mockPostCallOnExternalPositionPolicy.identifier.returns(`MOCK_POST_CALL_ON_EXTERNAL_POSITION`),
|
|
62
|
-
mockPostCallOnExternalPositionPolicy.addFundSettings.returns(undefined),
|
|
63
|
-
mockPostCallOnExternalPositionPolicy.activateForFund.returns(undefined),
|
|
64
|
-
mockPostCallOnExternalPositionPolicy.canDisable.returns(false),
|
|
65
|
-
mockPostCallOnExternalPositionPolicy.validateRule.returns(true),
|
|
66
|
-
mockPostCallOnExternalPositionPolicy.implementedHooks.returns([PolicyHook.PostCallOnExternalPosition]),
|
|
67
|
-
mockPostCallOnExternalPositionPolicy.updateFundSettings.returns(undefined),
|
|
68
|
-
// PostCallOnIntegration
|
|
69
|
-
mockPostCoIPolicy.identifier.returns(`MOCK_POST_CALL_ON_INTEGRATION`),
|
|
70
|
-
mockPostCoIPolicy.addFundSettings.returns(undefined),
|
|
71
|
-
mockPostCoIPolicy.activateForFund.returns(undefined),
|
|
72
|
-
mockPostCoIPolicy.canDisable.returns(false),
|
|
73
|
-
mockPostCoIPolicy.validateRule.returns(true),
|
|
74
|
-
mockPostCoIPolicy.implementedHooks.returns([PolicyHook.PostCallOnIntegration]),
|
|
75
|
-
mockPostCoIPolicy.updateFundSettings.returns(undefined),
|
|
76
|
-
// PreTransferSharesPolicy
|
|
77
|
-
mockPreTransferSharesPolicy.identifier.returns(`MOCK_PRE_TRANSFER_SHARES`),
|
|
78
|
-
mockPreTransferSharesPolicy.addFundSettings.returns(undefined),
|
|
79
|
-
mockPreTransferSharesPolicy.activateForFund.returns(undefined),
|
|
80
|
-
mockPreTransferSharesPolicy.canDisable.returns(false),
|
|
81
|
-
mockPreTransferSharesPolicy.validateRule.returns(true),
|
|
82
|
-
mockPreTransferSharesPolicy.implementedHooks.returns([PolicyHook.PreTransferShares]),
|
|
83
|
-
mockPreTransferSharesPolicy.updateFundSettings.returns(undefined),
|
|
84
|
-
// RedeemSharesForSpecificAssets
|
|
85
|
-
mockRedeemSharesForSpecificAssetsPolicy.identifier.returns(`MOCK_REDEEM_SHARES_FOR_SPECIFIC_ASSETS`),
|
|
86
|
-
mockRedeemSharesForSpecificAssetsPolicy.addFundSettings.returns(undefined),
|
|
87
|
-
mockRedeemSharesForSpecificAssetsPolicy.activateForFund.returns(undefined),
|
|
88
|
-
mockRedeemSharesForSpecificAssetsPolicy.canDisable.returns(false),
|
|
89
|
-
mockRedeemSharesForSpecificAssetsPolicy.validateRule.returns(true),
|
|
90
|
-
mockRedeemSharesForSpecificAssetsPolicy.implementedHooks.returns([PolicyHook.RedeemSharesForSpecificAssets]),
|
|
91
|
-
mockRedeemSharesForSpecificAssetsPolicy.updateFundSettings.returns(undefined),
|
|
92
|
-
// RemoveExternalPosition
|
|
93
|
-
mockRemoveExternalPositionPolicy.identifier.returns(`MOCK_REMOVE_EXTERNAL_POSITION`),
|
|
94
|
-
mockRemoveExternalPositionPolicy.addFundSettings.returns(undefined),
|
|
95
|
-
mockRemoveExternalPositionPolicy.activateForFund.returns(undefined),
|
|
96
|
-
mockRemoveExternalPositionPolicy.canDisable.returns(false),
|
|
97
|
-
mockRemoveExternalPositionPolicy.validateRule.returns(true),
|
|
98
|
-
mockRemoveExternalPositionPolicy.implementedHooks.returns([PolicyHook.RedeemSharesForSpecificAssets]),
|
|
99
|
-
mockRemoveExternalPositionPolicy.updateFundSettings.returns(undefined),
|
|
100
|
-
]);
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
mockAddTrackedAssetsPolicy,
|
|
104
|
-
mockCreateExternalPositionPolicy,
|
|
105
|
-
mockPostBuySharesPolicy,
|
|
106
|
-
mockPostCallOnExternalPositionPolicy,
|
|
107
|
-
mockPostCoIPolicy,
|
|
108
|
-
mockPreTransferSharesPolicy,
|
|
109
|
-
mockRedeemSharesForSpecificAssetsPolicy,
|
|
110
|
-
mockRemoveExternalPositionPolicy,
|
|
111
|
-
};
|
|
112
|
-
}
|
package/src/scaffolding/index.ts
DELETED