Skip to content

Commit bcec4c1

Browse files
edkimpblivin0x
andauthored
Feat: FlashmintNAV (#186)
* start FlashMintNav * minimal compile * minimal compile * wip add deploy funcs for nav issuance module * add nav issuance abi for typechain * remove alt name nav issuance module * consistent filename casing * consistent filename casing * fix deps * test setup * first test run * use correct version of DIM from fixture * check for reserve asset * issue functions & tests * redeem for ETH * add redeem for erc20 function * cleanup unused functions * function to validate reserve asset * wip getter functions * debugging static call in test * fix callStatic * use callStatic * tests for output estimation * cleanup * add description * cleanup issue from eth test * issue tests cont * add tests for dai and usdt * wip refactor redeem tests * redemption tests * update desc and wip refactor tests * refactor redeem tests * remove unused import * reorg immutable vars * format withdrawTokens --------- Co-authored-by: Pranav Bhardwaj <[email protected]>
1 parent 509df42 commit bcec4c1

File tree

10 files changed

+1105
-2
lines changed

10 files changed

+1105
-2
lines changed

contracts/exchangeIssuance/FlashMintNAV.sol

Lines changed: 412 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
Copyright 2020 Set Labs Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
16+
SPDX-License-Identifier: Apache License, Version 2.0
17+
*/
18+
pragma solidity 0.6.10;
19+
20+
import { ISetToken } from "./ISetToken.sol";
21+
22+
interface INAVIssuanceHook {
23+
function invokePreIssueHook(
24+
ISetToken _setToken,
25+
address _reserveAsset,
26+
uint256 _reserveAssetQuantity,
27+
address _sender,
28+
address _to
29+
)
30+
external;
31+
32+
function invokePreRedeemHook(
33+
ISetToken _setToken,
34+
uint256 _redeemQuantity,
35+
address _sender,
36+
address _to
37+
)
38+
external;
39+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
Copyright 2024 Index Coop
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
16+
SPDX-License-Identifier: Apache License, Version 2.0
17+
*/
18+
pragma solidity 0.6.10;
19+
20+
import { ISetToken } from "./ISetToken.sol";
21+
22+
interface INAVIssuanceModule {
23+
function issue(
24+
ISetToken _setToken,
25+
address _reserveAsset,
26+
uint256 _reserveAssetQuantity,
27+
uint256 _minSetTokenReceiveQuantity,
28+
address _to
29+
) external;
30+
31+
function redeem(
32+
ISetToken _setToken,
33+
address _reserveAsset,
34+
uint256 _setTokenQuantity,
35+
uint256 _minReserveReceiveQuantity,
36+
address _to
37+
) external;
38+
39+
function isReserveAsset(
40+
ISetToken _setToken,
41+
address _asset
42+
) external view returns(bool);
43+
44+
function getReserveAssets(address _setToken) external view returns (address[] memory);
45+
46+
function getExpectedSetTokenIssueQuantity(
47+
ISetToken _setToken,
48+
address _reserveAsset,
49+
uint256 _reserveAssetQuantity
50+
) external view returns (uint256);
51+
52+
function getExpectedReserveRedeemQuantity(
53+
ISetToken _setToken,
54+
address _reserveAsset,
55+
uint256 _setTokenQuantity
56+
) external view returns (uint256);
57+
}

test/integration/arbitrum/withdrawTokens.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { impersonateAccount, setBlockNumber } from "@utils/test/testingUtils";
44
import { WithdrawTokens__factory } from "../../../typechain";
55

66
if (process.env.INTEGRATIONTEST) {
7-
describe.only("WithdrawTokens", function () {
7+
describe("WithdrawTokens", function () {
88
const deployerAddress = "0x37e6365d4f6aE378467b0e24c9065Ce5f06D70bF";
99
let deployerSigner: Signer;
1010

test/integration/ethereum/addresses.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const PRODUCTION_ADDRESSES = {
4343
osEth: "0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38",
4444
comp: "0xc00e94Cb662C3520282E6f5717214004A7f26888",
4545
dpi: "0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b",
46+
usdt: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
4647
},
4748
whales: {
4849
stEth: "0xdc24316b9ae028f1497c275eb9192a3ea0f67022",

test/integration/ethereum/flashMintDex.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const swapDataWethToUsdc = {
8181
};
8282

8383
if (process.env.INTEGRATIONTEST) {
84-
describe.only("FlashMintDex - Integration Test", async () => {
84+
describe("FlashMintDex - Integration Test", async () => {
8585
let owner: Account;
8686
let deployer: DeployHelper;
8787
let legacySetTokenCreator: SetTokenCreator;

0 commit comments

Comments
 (0)