forked from SetProtocol/set-protocol-v2
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(NotionalTradeModule): audit adjustments
fix(NotionalTradeModule): audit adjustments
- Loading branch information
Showing
27 changed files
with
2,363 additions
and
1,624 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: agpl-3.0 | ||
pragma solidity 0.6.10; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
|
||
interface IERC20Metadata is IERC20 { | ||
function name() external view returns (string memory); | ||
|
||
function symbol() external view returns (string memory); | ||
|
||
function decimals() external view returns (uint8); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
pragma solidity 0.6.10; | ||
pragma experimental "ABIEncoderV2"; | ||
|
||
/// @dev Market object as represented in memory | ||
struct MarketParameters { | ||
bytes32 storageSlot; | ||
uint256 maturity; | ||
// Total amount of fCash available for purchase in the market. | ||
int256 totalfCash; | ||
// Total amount of cash available for purchase in the market. | ||
int256 totalAssetCash; | ||
// Total amount of liquidity tokens (representing a claim on liquidity) in the market. | ||
int256 totalLiquidity; | ||
// This is the previous annualized interest rate in RATE_PRECISION that the market traded | ||
// at. This is used to calculate the rate anchor to smooth interest rates over time. | ||
uint256 lastImpliedRate; | ||
// Time lagged version of lastImpliedRate, used to value fCash assets at market rates while | ||
// remaining resistent to flash loan attacks. | ||
uint256 oracleRate; | ||
// This is the timestamp of the previous trade | ||
uint256 previousTradeTime; | ||
} | ||
|
||
|
||
interface INotionalV2 { | ||
function getfCashLendFromDeposit( | ||
uint16 currencyId, | ||
uint256 depositAmountExternal, | ||
uint256 maturity, | ||
uint32 minLendRate, | ||
uint256 blockTime, | ||
bool useUnderlying | ||
) external view returns ( | ||
uint88 fCashAmount, | ||
uint8 marketIndex, | ||
bytes32 encodedTrade | ||
); | ||
|
||
function getfCashBorrowFromPrincipal( | ||
uint16 currencyId, | ||
uint256 borrowedAmountExternal, | ||
uint256 maturity, | ||
uint32 maxBorrowRate, | ||
uint256 blockTime, | ||
bool useUnderlying | ||
) external view returns ( | ||
uint88 fCashDebt, | ||
uint8 marketIndex, | ||
bytes32 encodedTrade | ||
); | ||
|
||
} | ||
|
||
interface INotionalV2Complete is INotionalV2 { | ||
function getCurrencyId(address tokenAddress) external view returns (uint16 currencyId); | ||
|
||
function getActiveMarkets(uint16 currencyId) external view returns (MarketParameters[] memory); | ||
|
||
function updateAssetRate(uint16 currencyId, address rateOracle) external; | ||
|
||
function upgradeTo(address newAddress) external; | ||
|
||
function owner() external view returns(address); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
pragma solidity 0.6.10; | ||
pragma experimental "ABIEncoderV2"; | ||
|
||
import { INotionalV2 } from "../interfaces/external/INotionalV2.sol"; | ||
|
||
|
||
contract NotionalV2Mock is INotionalV2 { | ||
uint88 fCashEstimation; | ||
|
||
function setFCashEstimation(uint88 _fCashEstimation) public { | ||
fCashEstimation = _fCashEstimation; | ||
} | ||
|
||
function getfCashLendFromDeposit( | ||
uint16 currencyId, | ||
uint256 depositAmountExternal, | ||
uint256 maturity, | ||
uint32 minLendRate, | ||
uint256 blockTime, | ||
bool useUnderlying | ||
) external view override returns ( | ||
uint88 fCashAmount, | ||
uint8 marketIndex, | ||
bytes32 encodedTrade | ||
) { | ||
fCashAmount = fCashEstimation; | ||
} | ||
|
||
function getfCashBorrowFromPrincipal( | ||
uint16 currencyId, | ||
uint256 borrowedAmountExternal, | ||
uint256 maturity, | ||
uint32 maxBorrowRate, | ||
uint256 blockTime, | ||
bool useUnderlying | ||
) external view override returns ( | ||
uint88 fCashDebt, | ||
uint8 marketIndex, | ||
bytes32 encodedTrade | ||
) { | ||
fCashDebt = fCashEstimation; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
contracts/protocol/integration/wrap/notional/WrappedfCash.sol
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
contracts/protocol/integration/wrap/notional/WrappedfCashFactory.sol
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
contracts/protocol/integration/wrap/notional/nBeaconProxy.sol
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
contracts/protocol/integration/wrap/notional/nUpgradeableBeacon.sol
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -384,4 +384,4 @@ contract DebtIssuanceModuleV2 is DebtIssuanceModule { | |
|
||
return (components, equityUnits, debtUnits); | ||
} | ||
} | ||
} |
Oops, something went wrong.