diff --git a/contracts/defi/Invest.sol b/contracts/defi/Invest.sol deleted file mode 100644 index 8785a5b04..000000000 --- a/contracts/defi/Invest.sol +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (C) 2018 Argent Labs Ltd. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pragma solidity ^0.5.4; -import "../wallet/BaseWallet.sol"; - -/** - * @title Interface for a contract that can invest tokens in order to earn an interest. - * @author Julien Niset - - */ -interface Invest { - - event InvestmentAdded(address indexed _wallet, address _token, uint256 _invested, uint256 _period); - event InvestmentRemoved(address indexed _wallet, address _token, uint256 _fraction); - - /** - * @dev Invest tokens for a given period. - * @param _wallet The target wallet. - * @param _token The token address. - * @param _amount The amount of tokens to invest. - * @param _period The period over which the tokens may be locked in the investment (optional). - * @return The exact amount of tokens that have been invested. - */ - function addInvestment( - BaseWallet _wallet, - address _token, - uint256 _amount, - uint256 _period - ) - external - returns (uint256 _invested); - - /** - * @dev Exit invested postions. - * @param _wallet The target wallet. - * @param _token The token address. - * @param _fraction The fraction of invested tokens to exit in per 10000. - */ - function removeInvestment( - BaseWallet _wallet, - address _token, - uint256 _fraction - ) - external; - - /** - * @dev Get the amount of investment in a given token. - * @param _wallet The target wallet. - * @param _token The token address. - * @return The value in tokens of the investment (including interests) and the time at which the investment can be removed. - */ - function getInvestment( - BaseWallet _wallet, - address _token - ) - external - view - returns (uint256 _tokenValue, uint256 _periodEnd); -} \ No newline at end of file diff --git a/contracts/legacy/LegacyMakerManager.sol b/contracts/legacy/LegacyMakerManager.sol index 4f18cc9a0..bb2295291 100644 --- a/contracts/legacy/LegacyMakerManager.sol +++ b/contracts/legacy/LegacyMakerManager.sol @@ -19,10 +19,9 @@ import "../wallet/BaseWallet.sol"; import "../modules/common/BaseModule.sol"; import "../modules/common/RelayerModule.sol"; import "../modules/common/OnlyOwnerModule.sol"; -import "../defi/Loan.sol"; +import "./Loan.sol"; import "../../lib/maker/DS/DSMath.sol"; - // Interface to MakerDAO's Tub contract, used to manage CDPs contract IMakerCdp { IDSValue public pep; // MKR price feed diff --git a/contracts/defi/Loan.sol b/contracts/legacy/Loan.sol similarity index 100% rename from contracts/defi/Loan.sol rename to contracts/legacy/Loan.sol diff --git a/contracts/modules/CompoundManager.sol b/contracts/modules/CompoundManager.sol index 0762803e6..a3c9edee8 100644 --- a/contracts/modules/CompoundManager.sol +++ b/contracts/modules/CompoundManager.sol @@ -19,8 +19,6 @@ import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; import "./common/OnlyOwnerModule.sol"; -import "../defi/Loan.sol"; -import "../defi/Invest.sol"; import "../infrastructure/CompoundRegistry.sol"; interface IComptroller { @@ -47,7 +45,7 @@ interface ICToken { * @dev Module to invest and borrow tokens with CompoundV2 * @author Julien Niset - */ -contract CompoundManager is Loan, Invest, BaseModule, RelayerModule, OnlyOwnerModule { +contract CompoundManager is BaseModule, RelayerModule, OnlyOwnerModule { bytes32 constant NAME = "CompoundManager"; @@ -59,6 +57,21 @@ contract CompoundManager is Loan, Invest, BaseModule, RelayerModule, OnlyOwnerMo // Mock token address for ETH address constant internal ETH_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; + event InvestmentAdded(address indexed _wallet, address _token, uint256 _invested, uint256 _period); + event InvestmentRemoved(address indexed _wallet, address _token, uint256 _fraction); + event LoanOpened( + address indexed _wallet, + bytes32 indexed _loanId, + address _collateral, + uint256 _collateralAmount, + address _debtToken, + uint256 _debtAmount); + event LoanClosed(address indexed _wallet, bytes32 indexed _loanId); + event CollateralAdded(address indexed _wallet, bytes32 indexed _loanId, address _collateral, uint256 _collateralAmount); + event CollateralRemoved(address indexed _wallet, bytes32 indexed _loanId, address _collateral, uint256 _collateralAmount); + event DebtAdded(address indexed _wallet, bytes32 indexed _loanId, address _debtToken, uint256 _debtAmount); + event DebtRemoved(address indexed _wallet, bytes32 indexed _loanId, address _debtToken, uint256 _debtAmount); + using SafeMath for uint256; constructor(