From 5d8139c494960d087e6605cf33bf84b44c67bc41 Mon Sep 17 00:00:00 2001 From: Mubaris NK Date: Sat, 6 Feb 2021 00:21:11 +0530 Subject: [PATCH] Restructure old contracts --- contracts/connectors/1inch/main.sol | 6 +++--- contracts/connectors_old/1inch.sol | 20 +++++++++++--------- contracts/connectors_old/aave.sol | 6 ++++-- contracts/connectors_old/aave_v2.sol | 6 ++++-- contracts/connectors_old/basic.sol | 4 +++- contracts/connectors_old/curve.sol | 6 ++++-- contracts/connectors_old/curve_3pool.sol | 6 ++++-- contracts/connectors_old/curve_gauge.sol | 8 +++++--- contracts/connectors_old/curve_vesting.sol | 6 ++++-- contracts/connectors_old/curvesbtc.sol | 6 ++++-- contracts/connectors_old/curvey.sol | 6 ++++-- contracts/connectors_old/dydx.sol | 6 ++++-- contracts/connectors_old/dydxFlash.sol | 4 +++- contracts/connectors_old/kyber.sol | 6 ++++-- contracts/connectors_old/mock.sol | 4 +++- contracts/connectors_old/staking.sol | 6 ++++-- contracts/connectors_old/swerve.sol | 6 ++++-- contracts/connectors_old/uniswap.sol | 10 ++++++---- 18 files changed, 78 insertions(+), 44 deletions(-) diff --git a/contracts/connectors/1inch/main.sol b/contracts/connectors/1inch/main.sol index 7b856f3d..1510ba51 100644 --- a/contracts/connectors/1inch/main.sol +++ b/contracts/connectors/1inch/main.sol @@ -35,7 +35,7 @@ abstract contract OneProtoResolver is Helpers, Events { uint initalBal = getTokenBal(_buyAddr); - oneProtoContract.swap.value(ethAmt)( + oneProtoContract.swap{value: ethAmt}( _sellAddr, _buyAddr, _sellAmt, @@ -70,7 +70,7 @@ abstract contract OneProtoResolver is Helpers, Events { } uint initalBal = getTokenBal(_buyAddr); - oneSplitContract.swapMulti.value(ethAmt)( + oneSplitContract.swapMulti{value: ethAmt}( convertToTokenInterface(oneProtoData.tokens), _sellAmt, _slippageAmt, @@ -117,7 +117,7 @@ abstract contract OneInchResolver is OneProtoResolver { uint initalBal = getTokenBal(buyToken); // solium-disable-next-line security/no-call-value - (bool success, ) = address(getOneInchAddress()).call.value(ethAmt)(oneInchData.callData); + (bool success, ) = address(getOneInchAddress()).call{value: ethAmt}(oneInchData.callData); if (!success) revert("1Inch-swap-failed"); uint finalBal = getTokenBal(buyToken); diff --git a/contracts/connectors_old/1inch.sol b/contracts/connectors_old/1inch.sol index 1d0e4d1d..a83b4411 100644 --- a/contracts/connectors_old/1inch.sol +++ b/contracts/connectors_old/1inch.sol @@ -62,7 +62,7 @@ interface OneProtoMappingInterface { } -contract OneHelpers is Stores, DSMath { +abstract contract OneHelpers is Stores, DSMath { /** * @dev Return 1proto mapping Address @@ -130,7 +130,7 @@ contract OneHelpers is Stores, DSMath { } -contract OneProtoResolver is OneHelpers { +abstract contract OneProtoResolver is OneHelpers { struct OneProtoData { TokenInterface sellToken; TokenInterface buyToken; @@ -216,7 +216,7 @@ contract OneProtoResolver is OneHelpers { } } -contract OneInchResolver is OneProtoResolver { +abstract contract OneInchResolver is OneProtoResolver { function checkOneInchSig(bytes memory callData) internal pure returns(bool isOk) { bytes memory _data = callData; bytes4 sig; @@ -260,7 +260,7 @@ contract OneInchResolver is OneProtoResolver { } -contract OneProtoEventResolver is OneInchResolver { +abstract contract OneProtoEventResolver is OneInchResolver { event LogSell( address indexed buyToken, address indexed sellToken, @@ -373,7 +373,7 @@ contract OneProtoEventResolver is OneInchResolver { } } -contract OneInchEventResolver is OneProtoEventResolver { +abstract contract OneInchEventResolver is OneProtoEventResolver { event LogSellThree( address indexed buyToken, address indexed sellToken, @@ -410,7 +410,7 @@ contract OneInchEventResolver is OneProtoEventResolver { } } -contract OneProtoResolverHelpers is OneInchEventResolver { +abstract contract OneProtoResolverHelpers is OneInchEventResolver { function _sell( OneProtoData memory oneProtoData, uint256 getId, @@ -480,7 +480,7 @@ contract OneProtoResolverHelpers is OneInchEventResolver { } } -contract OneInchResolverHelpers is OneProtoResolverHelpers { +abstract contract OneInchResolverHelpers is OneProtoResolverHelpers { function _sellThree( OneInchData memory oneInchData, uint setId @@ -503,7 +503,7 @@ contract OneInchResolverHelpers is OneProtoResolverHelpers { } } -contract OneProto is OneInchResolverHelpers { +abstract contract OneProto is OneInchResolverHelpers { /** * @dev Sell ETH/ERC20_Token using 1proto. * @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) @@ -602,7 +602,7 @@ contract OneProto is OneInchResolverHelpers { } } -contract OneInch is OneProto { +abstract contract OneInch is OneProto { /** * @dev Sell ETH/ERC20_Token using 1inch. * @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) @@ -635,4 +635,6 @@ contract OneInch is OneProto { contract ConnectOne is OneInch { string public name = "1inch-1proto-v1"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/aave.sol b/contracts/connectors_old/aave.sol index 8649becb..7c358a5e 100644 --- a/contracts/connectors_old/aave.sol +++ b/contracts/connectors_old/aave.sol @@ -45,7 +45,7 @@ interface ATokenInterface { function principalBalanceOf(address _user) external view returns(uint256); } -contract AaveHelpers is DSMath, Stores { +abstract contract AaveHelpers is DSMath, Stores { /** * @dev get Aave Provider @@ -77,7 +77,7 @@ contract AaveHelpers is DSMath, Stores { } -contract BasicResolver is AaveHelpers { +abstract contract BasicResolver is AaveHelpers { event LogDeposit(address indexed token, uint256 tokenAmt, uint256 getId, uint256 setId); event LogWithdraw(address indexed token, uint256 tokenAmt, uint256 getId, uint256 setId); event LogBorrow(address indexed token, uint256 tokenAmt, uint256 getId, uint256 setId); @@ -206,4 +206,6 @@ contract BasicResolver is AaveHelpers { contract ConnectAave is BasicResolver { string public name = "Aave-v1.1"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/aave_v2.sol b/contracts/connectors_old/aave_v2.sol index 7d231d00..70827698 100644 --- a/contracts/connectors_old/aave_v2.sol +++ b/contracts/connectors_old/aave_v2.sol @@ -52,7 +52,7 @@ interface ATokenInterface { function balanceOf(address _user) external view returns(uint256); } -contract AaveHelpers is DSMath, Stores { +abstract contract AaveHelpers is DSMath, Stores { /** * @dev get Aave Lending Pool Provider */ @@ -109,7 +109,7 @@ contract AaveHelpers is DSMath, Stores { } } -contract BasicResolver is AaveHelpers { +abstract contract BasicResolver is AaveHelpers { event LogDeposit(address indexed token, uint256 tokenAmt, uint256 getId, uint256 setId); event LogWithdraw(address indexed token, uint256 tokenAmt, uint256 getId, uint256 setId); event LogBorrow(address indexed token, uint256 tokenAmt, uint256 indexed rateMode, uint256 getId, uint256 setId); @@ -263,4 +263,6 @@ contract BasicResolver is AaveHelpers { contract ConnectAaveV2 is BasicResolver { string public name = "AaveV2-v1.1"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/basic.sol b/contracts/connectors_old/basic.sol index 650ab9e3..dfe86cff 100644 --- a/contracts/connectors_old/basic.sol +++ b/contracts/connectors_old/basic.sol @@ -16,7 +16,7 @@ interface AccountInterface { * @dev Connector to deposit/withdraw assets. */ -contract BasicResolver is Stores { +abstract contract BasicResolver is Stores { event LogDeposit(address indexed erc20, uint256 tokenAmt, uint256 getId, uint256 setId); event LogWithdraw(address indexed erc20, uint256 tokenAmt, address indexed to, uint256 getId, uint256 setId); @@ -86,4 +86,6 @@ contract BasicResolver is Stores { contract ConnectBasic is BasicResolver { string public constant name = "Basic-v1.1"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/curve.sol b/contracts/connectors_old/curve.sol index 3dbd2a41..e406db76 100644 --- a/contracts/connectors_old/curve.sol +++ b/contracts/connectors_old/curve.sol @@ -19,7 +19,7 @@ interface ICurveZap { } -contract CurveHelpers is Stores, DSMath { +abstract contract CurveHelpers is Stores, DSMath { /** * @dev Return Curve Swap Address */ @@ -73,7 +73,7 @@ contract CurveHelpers is Stores, DSMath { } } -contract CurveProtocol is CurveHelpers { +abstract contract CurveProtocol is CurveHelpers { event LogSell( address indexed buyToken, @@ -225,4 +225,6 @@ contract CurveProtocol is CurveHelpers { contract ConnectCurve is CurveProtocol { string public name = "Curve-susd-v1.2"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/curve_3pool.sol b/contracts/connectors_old/curve_3pool.sol index e734ef03..b28a6a8a 100644 --- a/contracts/connectors_old/curve_3pool.sol +++ b/contracts/connectors_old/curve_3pool.sol @@ -11,7 +11,7 @@ interface ICurve { function exchange(int128 sellTokenId, int128 buyTokenId, uint256 sellTokenAmt, uint256 minBuyToken) external; } -contract CurveHelpers is Stores, DSMath { +abstract contract CurveHelpers is Stores, DSMath { /** * @dev Return Curve 3pool Swap Address */ @@ -50,7 +50,7 @@ contract CurveHelpers is Stores, DSMath { } } -contract CurveProtocol is CurveHelpers { +abstract contract CurveProtocol is CurveHelpers { event LogSell( address indexed buyToken, @@ -105,4 +105,6 @@ contract CurveProtocol is CurveHelpers { contract ConnectCurveThreePool is CurveProtocol { string public name = "Curve-3pool-v1.0"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/curve_gauge.sol b/contracts/connectors_old/curve_gauge.sol index 7fd17455..e001018c 100644 --- a/contracts/connectors_old/curve_gauge.sol +++ b/contracts/connectors_old/curve_gauge.sol @@ -30,7 +30,7 @@ interface ICurveGaugeMapping { function gaugeMapping(bytes32) external view returns(GaugeData memory); } -contract GaugeHelper is DSMath, Stores{ +abstract contract GaugeHelper is DSMath, Stores{ function getCurveGaugeMappingAddr() internal virtual view returns (address){ return 0x1C800eF1bBfE3b458969226A96c56B92a069Cc92; } @@ -51,7 +51,7 @@ contract GaugeHelper is DSMath, Stores{ } } -contract CurveGaugeEvent is GaugeHelper { +abstract contract CurveGaugeEvent is GaugeHelper { event LogDeposit( string indexed gaugePoolName, uint amount, @@ -89,7 +89,7 @@ contract CurveGaugeEvent is GaugeHelper { } } -contract CurveGauge is CurveGaugeEvent { +abstract contract CurveGauge is CurveGaugeEvent { struct Balances{ uint intialCRVBal; uint intialRewardBal; @@ -237,5 +237,7 @@ contract CurveGauge is CurveGaugeEvent { contract ConnectCurveGauge is CurveGauge { string public name = "Curve-Gauge-v1.0"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/curve_vesting.sol b/contracts/connectors_old/curve_vesting.sol index 2785527c..20353b9b 100644 --- a/contracts/connectors_old/curve_vesting.sol +++ b/contracts/connectors_old/curve_vesting.sol @@ -9,7 +9,7 @@ interface ICurve { function claim(address addr) external; } -contract CurveVestingHelpers is Stores, DSMath { +abstract contract CurveVestingHelpers is Stores, DSMath { /** * @dev Return Curve Token Address */ @@ -25,7 +25,7 @@ contract CurveVestingHelpers is Stores, DSMath { } } -contract CurveVestingProtocol is CurveVestingHelpers { +abstract contract CurveVestingProtocol is CurveVestingHelpers { event LogClaim(address account, uint256 claimAmount, uint256 getId, uint256 setId); /** @@ -53,5 +53,7 @@ contract CurveVestingProtocol is CurveVestingHelpers { contract ConnectCurveVesting is CurveVestingProtocol { string public name = "Curve-vesting-v1"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/curvesbtc.sol b/contracts/connectors_old/curvesbtc.sol index 6996845b..d55572c7 100644 --- a/contracts/connectors_old/curvesbtc.sol +++ b/contracts/connectors_old/curvesbtc.sol @@ -15,7 +15,7 @@ interface ICurve { function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external returns (uint256 amount); } -contract CurveSBTCHelpers is Stores, DSMath{ +abstract contract CurveSBTCHelpers is Stores, DSMath{ /** * @dev Return Curve Swap Address */ @@ -54,7 +54,7 @@ contract CurveSBTCHelpers is Stores, DSMath{ } } -contract CurveSBTCProtocol is CurveSBTCHelpers { +abstract contract CurveSBTCProtocol is CurveSBTCHelpers { // Events event LogSell( @@ -203,5 +203,7 @@ contract CurveSBTCProtocol is CurveSBTCHelpers { contract ConnectSBTCCurve is CurveSBTCProtocol { string public name = "Curve-sbtc-v1"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/curvey.sol b/contracts/connectors_old/curvey.sol index ac508aa7..ac445759 100644 --- a/contracts/connectors_old/curvey.sol +++ b/contracts/connectors_old/curvey.sol @@ -23,7 +23,7 @@ interface YTokenInterface { function getPricePerFullShare() external view returns (uint256 amount); } -contract CurveHelpers is Stores, DSMath { +abstract contract CurveHelpers is Stores, DSMath { /** * @dev Return ycurve Swap Address */ @@ -90,7 +90,7 @@ contract CurveHelpers is Stores, DSMath { } } -contract CurveProtocol is CurveHelpers { +abstract contract CurveProtocol is CurveHelpers { event LogSell( address indexed buyToken, @@ -242,4 +242,6 @@ contract CurveProtocol is CurveHelpers { contract ConnectCurveY is CurveProtocol { string public name = "Curve-y-v1"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/dydx.sol b/contracts/connectors_old/dydx.sol index bc53b4f8..192086bb 100644 --- a/contracts/connectors_old/dydx.sol +++ b/contracts/connectors_old/dydx.sol @@ -66,7 +66,7 @@ interface SoloMarginContract { } -contract DydxHelpers is DSMath, Stores { +abstract contract DydxHelpers is DSMath, Stores { /** * @dev get WETH address */ @@ -142,7 +142,7 @@ contract DydxHelpers is DSMath, Stores { } -contract BasicResolver is DydxHelpers { +abstract contract BasicResolver is DydxHelpers { event LogDeposit(address indexed token, uint marketId, uint256 tokenAmt, uint256 getId, uint256 setId); event LogWithdraw(address indexed token, uint marketId, uint256 tokenAmt, uint256 getId, uint256 setId); event LogBorrow(address indexed token, uint marketId, uint256 tokenAmt, uint256 getId, uint256 setId); @@ -294,4 +294,6 @@ contract BasicResolver is DydxHelpers { contract ConnectDydx is BasicResolver { string public name = "Dydx-v1"; + + constructor(uint256 _id) Stores(_id) public {} } \ No newline at end of file diff --git a/contracts/connectors_old/dydxFlash.sol b/contracts/connectors_old/dydxFlash.sol index 91bcb1e6..c4982049 100644 --- a/contracts/connectors_old/dydxFlash.sol +++ b/contracts/connectors_old/dydxFlash.sol @@ -13,7 +13,7 @@ interface DydxFlashInterface { function initiateFlashLoan(address _token, uint256 _amount, bytes calldata data) external; } -contract FlashLoanResolver is Stores { +abstract contract FlashLoanResolver is Stores { event LogDydxFlashLoan(address indexed token, uint256 tokenAmt); /** @@ -54,4 +54,6 @@ contract FlashLoanResolver is Stores { contract ConnectDydxFlashLoan is FlashLoanResolver { string public constant name = "dydx-flashloan-v1"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/kyber.sol b/contracts/connectors_old/kyber.sol index 38f03333..9e0823ca 100644 --- a/contracts/connectors_old/kyber.sol +++ b/contracts/connectors_old/kyber.sol @@ -24,7 +24,7 @@ interface KyberInterface { } -contract KyberHelpers is DSMath, Stores { +abstract contract KyberHelpers is DSMath, Stores { /** * @dev Kyber Proxy Address */ @@ -41,7 +41,7 @@ contract KyberHelpers is DSMath, Stores { } -contract KyberResolver is KyberHelpers { +abstract contract KyberResolver is KyberHelpers { event LogSell( address indexed buyToken, address indexed sellToken, @@ -103,4 +103,6 @@ contract KyberResolver is KyberHelpers { contract ConnectKyber is KyberResolver { string public name = "Kyber-v1"; + + constructor(uint256 _id) Stores(_id) public {} } \ No newline at end of file diff --git a/contracts/connectors_old/mock.sol b/contracts/connectors_old/mock.sol index 433ff14e..1dbbf56e 100644 --- a/contracts/connectors_old/mock.sol +++ b/contracts/connectors_old/mock.sol @@ -5,7 +5,7 @@ import { TokenInterface , MemoryInterface, EventInterface} from "../common/inter import { Stores } from "../common/stores.sol"; import { DSMath } from "../common/math.sol"; -contract MockProtocol is Stores, DSMath { +abstract contract MockProtocol is Stores, DSMath { event LogMock(uint mockOne, uint mockTwo, uint getId, uint setId); @@ -34,4 +34,6 @@ contract MockProtocol is Stores, DSMath { contract ConnectMock is MockProtocol { string public name = "Mock-v1"; + + constructor(uint256 _id) Stores(_id) public {} } \ No newline at end of file diff --git a/contracts/connectors_old/staking.sol b/contracts/connectors_old/staking.sol index c918fdc9..10eba2c8 100644 --- a/contracts/connectors_old/staking.sol +++ b/contracts/connectors_old/staking.sol @@ -25,7 +25,7 @@ interface SynthetixMapping { } -contract StakingHelper is DSMath, Stores { +abstract contract StakingHelper is DSMath, Stores { /** * @dev Convert String to bytes32. */ @@ -59,7 +59,7 @@ contract StakingHelper is DSMath, Stores { } } -contract Staking is StakingHelper { +abstract contract Staking is StakingHelper { event LogDeposit( address indexed stakingToken, bytes32 indexed stakingType, @@ -193,4 +193,6 @@ contract Staking is StakingHelper { contract ConnectStaking is Staking { string public name = "Staking-v1.1"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/swerve.sol b/contracts/connectors_old/swerve.sol index e9b911e0..adf26d40 100644 --- a/contracts/connectors_old/swerve.sol +++ b/contracts/connectors_old/swerve.sol @@ -19,7 +19,7 @@ interface ISwerveZap { } -contract SwerveHelpers is Stores, DSMath { +abstract contract SwerveHelpers is Stores, DSMath { /** * @dev Return Swerve Swap Address */ @@ -68,7 +68,7 @@ contract SwerveHelpers is Stores, DSMath { } } -contract SwerveProtocol is SwerveHelpers { +abstract contract SwerveProtocol is SwerveHelpers { event LogSell( address indexed buyToken, @@ -220,4 +220,6 @@ contract SwerveProtocol is SwerveHelpers { contract ConnectSwerve is SwerveProtocol { string public name = "Swerve-swUSD-v1.0"; + + constructor(uint256 _id) Stores(_id) public {} } diff --git a/contracts/connectors_old/uniswap.sol b/contracts/connectors_old/uniswap.sol index 8c5eacd9..58815046 100644 --- a/contracts/connectors_old/uniswap.sol +++ b/contracts/connectors_old/uniswap.sol @@ -61,7 +61,7 @@ interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } -contract UniswapHelpers is Stores, DSMath { +abstract contract UniswapHelpers is Stores, DSMath { /** * @dev Return WETH address */ @@ -146,7 +146,7 @@ contract UniswapHelpers is Stores, DSMath { } } -contract LiquidityHelpers is UniswapHelpers { +abstract contract LiquidityHelpers is UniswapHelpers { function getMinAmount( TokenInterface token, @@ -246,7 +246,7 @@ contract LiquidityHelpers is UniswapHelpers { } } -contract UniswapLiquidity is LiquidityHelpers { +abstract contract UniswapLiquidity is LiquidityHelpers { event LogDepositLiquidity( address indexed tokenA, address indexed tokenB, @@ -397,7 +397,7 @@ contract UniswapLiquidity is LiquidityHelpers { } } -contract UniswapResolver is UniswapLiquidity { +abstract contract UniswapResolver is UniswapLiquidity { event LogBuy( address indexed buyToken, address indexed sellToken, @@ -528,4 +528,6 @@ contract UniswapResolver is UniswapLiquidity { contract ConnectUniswapV2 is UniswapResolver { string public name = "UniswapV2-v1"; + + constructor(uint256 _id) Stores(_id) public {} } \ No newline at end of file