Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: FlashmintNAV #186

Merged
merged 38 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2b3e47d
start FlashMintNav
edkim Aug 21, 2024
778eaf3
minimal compile
edkim Aug 21, 2024
ad477b8
minimal compile
edkim Aug 22, 2024
e8a38db
Merge branch 'master' into fmnav-exact-input
edkim Aug 22, 2024
2018d7c
wip add deploy funcs for nav issuance module
edkim Aug 22, 2024
f1db6c6
add nav issuance abi for typechain
edkim Aug 22, 2024
c03f1ef
remove alt name nav issuance module
edkim Aug 23, 2024
a3856d3
consistent filename casing
edkim Aug 23, 2024
72df76b
consistent filename casing
edkim Aug 23, 2024
8e34577
fix deps
edkim Aug 23, 2024
848bbbd
test setup
edkim Aug 23, 2024
b425622
first test run
edkim Aug 23, 2024
a5aca2d
use correct version of DIM from fixture
edkim Aug 23, 2024
36a7289
check for reserve asset
edkim Aug 23, 2024
a72e1c8
issue functions & tests
edkim Aug 26, 2024
c1b5eb2
redeem for ETH
edkim Aug 27, 2024
62d4a6c
add redeem for erc20 function
edkim Aug 27, 2024
b1ec1f9
cleanup unused functions
edkim Aug 27, 2024
8242b10
function to validate reserve asset
edkim Sep 3, 2024
6314039
wip getter functions
edkim Sep 4, 2024
25821a2
debugging static call in test
edkim Sep 10, 2024
6e96197
fix callStatic
pblivin0x Sep 10, 2024
6354ee4
use callStatic
pblivin0x Sep 10, 2024
be01ab7
tests for output estimation
edkim Sep 11, 2024
4c7e253
cleanup
edkim Sep 11, 2024
0e8df22
add description
edkim Sep 11, 2024
f408e6f
cleanup issue from eth test
edkim Sep 11, 2024
3d11fc1
issue tests cont
edkim Sep 12, 2024
c4359c8
add tests for dai and usdt
edkim Sep 12, 2024
6306125
wip refactor redeem tests
edkim Sep 13, 2024
954e53e
redemption tests
edkim Sep 13, 2024
88ae882
update desc and wip refactor tests
edkim Sep 13, 2024
2da94b0
refactor redeem tests
edkim Sep 13, 2024
61e54d9
remove unused import
edkim Sep 19, 2024
e21b456
Merge branch 'master' into flashmint-nav-issuance
edkim Sep 19, 2024
6c8ab06
reorg immutable vars
edkim Sep 24, 2024
472a6dd
format withdrawTokens
edkim Sep 24, 2024
6ab61b5
Merge branch 'pr-feedback' into flashmint-nav-issuance
edkim Sep 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
412 changes: 412 additions & 0 deletions contracts/exchangeIssuance/FlashMintNAV.sol

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions contracts/interfaces/INAVIssuanceHook.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
Copyright 2020 Set Labs Inc.
edkim marked this conversation as resolved.
Show resolved Hide resolved

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache License, Version 2.0
*/
pragma solidity 0.6.10;

import { ISetToken } from "./ISetToken.sol";

interface INAVIssuanceHook {
function invokePreIssueHook(
ISetToken _setToken,
address _reserveAsset,
uint256 _reserveAssetQuantity,
address _sender,
address _to
)
external;

function invokePreRedeemHook(
ISetToken _setToken,
uint256 _redeemQuantity,
address _sender,
address _to
)
external;
}
57 changes: 57 additions & 0 deletions contracts/interfaces/INAVIssuanceModule.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
Copyright 2024 Index Coop

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache License, Version 2.0
*/
pragma solidity 0.6.10;

import { ISetToken } from "./ISetToken.sol";

interface INAVIssuanceModule {
function issue(
ISetToken _setToken,
address _reserveAsset,
uint256 _reserveAssetQuantity,
uint256 _minSetTokenReceiveQuantity,
address _to
) external;

function redeem(
ISetToken _setToken,
address _reserveAsset,
uint256 _setTokenQuantity,
uint256 _minReserveReceiveQuantity,
address _to
) external;

function isReserveAsset(
ISetToken _setToken,
address _asset
) external view returns(bool);

function getReserveAssets(address _setToken) external view returns (address[] memory);

function getExpectedSetTokenIssueQuantity(
ISetToken _setToken,
address _reserveAsset,
uint256 _reserveAssetQuantity
) external view returns (uint256);

function getExpectedReserveRedeemQuantity(
ISetToken _setToken,
address _reserveAsset,
uint256 _setTokenQuantity
) external view returns (uint256);
}
2 changes: 1 addition & 1 deletion test/integration/arbitrum/withdrawTokens.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { impersonateAccount, setBlockNumber } from "@utils/test/testingUtils";
import { WithdrawTokens__factory } from "../../../typechain";

if (process.env.INTEGRATIONTEST) {
describe.only("WithdrawTokens", function () {
describe("WithdrawTokens", function () {
const deployerAddress = "0x37e6365d4f6aE378467b0e24c9065Ce5f06D70bF";
let deployerSigner: Signer;

Expand Down
1 change: 1 addition & 0 deletions test/integration/ethereum/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const PRODUCTION_ADDRESSES = {
osEth: "0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38",
comp: "0xc00e94Cb662C3520282E6f5717214004A7f26888",
dpi: "0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b",
usdt: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
},
whales: {
stEth: "0xdc24316b9ae028f1497c275eb9192a3ea0f67022",
Expand Down
2 changes: 1 addition & 1 deletion test/integration/ethereum/flashMintDex.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const swapDataWethToUsdc = {
};

if (process.env.INTEGRATIONTEST) {
describe.only("FlashMintDex - Integration Test", async () => {
describe("FlashMintDex - Integration Test", async () => {
let owner: Account;
let deployer: DeployHelper;
let legacySetTokenCreator: SetTokenCreator;
Expand Down
Loading
Loading