From 14279a207306821a74aebe8f587b76738cdab6de Mon Sep 17 00:00:00 2001 From: mingda Date: Thu, 10 Dec 2020 20:45:38 +0800 Subject: [PATCH] remove dpp & dvm events indexed --- contracts/DODOPrivatePool/impl/DPPStorage.sol | 14 +++++++------- contracts/DODOPrivatePool/impl/DPPTrader.sol | 15 +++++---------- .../DODOVendingMachine/impl/DVMFunding.sol | 17 ++++++----------- .../DODOVendingMachine/impl/DVMStorage.sol | 10 +++++----- contracts/DODOVendingMachine/impl/DVMTrader.sol | 11 +++-------- 5 files changed, 26 insertions(+), 41 deletions(-) diff --git a/contracts/DODOPrivatePool/impl/DPPStorage.sol b/contracts/DODOPrivatePool/impl/DPPStorage.sol index c06541c..81db7f1 100644 --- a/contracts/DODOPrivatePool/impl/DPPStorage.sol +++ b/contracts/DODOPrivatePool/impl/DPPStorage.sol @@ -57,19 +57,19 @@ contract DPPStorage is InitializableOwnable, ReentrancyGuard { // ============ Events ============ - event SetLpFeeRateModel(address indexed oldAddr, address indexed newAddr); + event SetLpFeeRateModel(address oldAddr, address newAddr); - event SetMtFeeRateModel(address indexed oldAddr, address indexed newAddr); + event SetMtFeeRateModel(address oldAddr, address newAddr); - event SetTradePermissionManager(address indexed oldAddr, address indexed newAddr); + event SetTradePermissionManager(address oldAddr, address newAddr); - event SetMaintainer(address indexed oldAddr, address indexed newAddr); + event SetMaintainer(address oldAddr, address newAddr); - event SetGasPriceSource(address indexed oldAddr, address indexed newAddr); + event SetGasPriceSource(address oldAddr, address newAddr); - event SetISource(address indexed oldAddr, address indexed newAddr); + event SetISource(address oldAddr, address newAddr); - event SetKSource(address indexed oldAddr, address indexed newAddr); + event SetKSource(address oldAddr, address newAddr); event SetBuy(bool allow); diff --git a/contracts/DODOPrivatePool/impl/DPPTrader.sol b/contracts/DODOPrivatePool/impl/DPPTrader.sol index 8d79743..deab4e5 100644 --- a/contracts/DODOPrivatePool/impl/DPPTrader.sol +++ b/contracts/DODOPrivatePool/impl/DPPTrader.sol @@ -20,8 +20,8 @@ contract DPPTrader is DPPVault { // ============ Events ============ event DODOSwap( - address indexed fromToken, - address indexed toToken, + address fromToken, + address toToken, uint256 fromAmount, uint256 toAmount, address trader @@ -122,12 +122,7 @@ contract DPPTrader is DPPVault { uint256 quoteAmount, address assetTo, bytes calldata data - ) - external - preventReentrant - isSellAllow(assetTo) - isBuyAllow(assetTo) - { + ) external preventReentrant isSellAllow(assetTo) isBuyAllow(assetTo) { _transferBaseOut(assetTo, baseAmount); _transferQuoteOut(assetTo, quoteAmount); @@ -264,10 +259,10 @@ contract DPPTrader is DPPVault { function _sync() internal { uint256 baseBalance = _BASE_TOKEN_.balanceOf(address(this)); uint256 quoteBalance = _QUOTE_TOKEN_.balanceOf(address(this)); - if(baseBalance != _BASE_RESERVE_) { + if (baseBalance != _BASE_RESERVE_) { _BASE_RESERVE_ = baseBalance; } - if(quoteBalance != _QUOTE_RESERVE_) { + if (quoteBalance != _QUOTE_RESERVE_) { _QUOTE_RESERVE_ = quoteBalance; } } diff --git a/contracts/DODOVendingMachine/impl/DVMFunding.sol b/contracts/DODOVendingMachine/impl/DVMFunding.sol index d94893f..03819c3 100644 --- a/contracts/DODOVendingMachine/impl/DVMFunding.sol +++ b/contracts/DODOVendingMachine/impl/DVMFunding.sol @@ -15,14 +15,9 @@ import {IDODOCallee} from "../../intf/IDODOCallee.sol"; contract DVMFunding is DVMVault { // ============ Events ============ - event BuyShares(address indexed to, uint256 increaseShares, uint256 totalShares); + event BuyShares(address to, uint256 increaseShares, uint256 totalShares); - event SellShares( - address indexed payer, - address indexed to, - uint256 decreaseShares, - uint256 totalShares - ); + event SellShares(address payer, address to, uint256 decreaseShares, uint256 totalShares); // ============ Buy & Sell Shares ============ @@ -51,7 +46,7 @@ contract DVMFunding is DVMVault { // 但有可能出现,reserve>0但totalSupply=0的场景 if (totalSupply == 0) { shares = baseBalance.sub(10**3); // 以免出现balance很大但shares很小的情况 - _mint(address(0), 10**3); + _mint(address(0), 10**3); } else if (baseReserve > 0 && quoteReserve == 0) { // case 2. supply when quote reserve is 0 shares = baseInput.mul(totalSupply).div(baseReserve); @@ -62,7 +57,7 @@ contract DVMFunding is DVMVault { uint256 mintRatio = quoteInputRatio < baseInputRatio ? quoteInputRatio : baseInputRatio; shares = DecimalMath.mulFloor(totalSupply, mintRatio); } - require(shares > 0, 'INSUFFICIENT_LIQUIDITY_MINED'); + require(shares > 0, "INSUFFICIENT_LIQUIDITY_MINED"); _mint(to, shares); _sync(); emit BuyShares(to, shares, _SHARES_[to]); @@ -95,7 +90,7 @@ contract DVMFunding is DVMVault { _transferBaseOut(to, baseAmount); _transferQuoteOut(to, quoteAmount); _sync(); - + if (data.length > 0) { IDODOCallee(to).DVMSellShareCall( msg.sender, @@ -105,7 +100,7 @@ contract DVMFunding is DVMVault { data ); } - + emit SellShares(msg.sender, to, shareAmount, _SHARES_[msg.sender]); } } diff --git a/contracts/DODOVendingMachine/impl/DVMStorage.sol b/contracts/DODOVendingMachine/impl/DVMStorage.sol index e484154..080dfe6 100644 --- a/contracts/DODOVendingMachine/impl/DVMStorage.sol +++ b/contracts/DODOVendingMachine/impl/DVMStorage.sol @@ -66,15 +66,15 @@ contract DVMStorage is InitializableOwnable, ReentrancyGuard { // ============ Events ============ - event SetLpFeeRateModel(address indexed oldAddr, address indexed newAddr); + event SetLpFeeRateModel(address oldAddr, address newAddr); - event SetMtFeeRateModel(address indexed oldAddr, address indexed newAddr); + event SetMtFeeRateModel(address oldAddr, address newAddr); - event SetTradePermissionManager(address indexed oldAddr, address indexed newAddr); + event SetTradePermissionManager(address oldAddr, address newAddr); - event SetMaintainer(address indexed oldAddr, address indexed newAddr); + event SetMaintainer(address oldAddr, address newAddr); - event SetGasPriceSource(address indexed oldAddr, address indexed newAddr); + event SetGasPriceSource(address oldAddr, address newAddr); event SetBuy(bool allow); diff --git a/contracts/DODOVendingMachine/impl/DVMTrader.sol b/contracts/DODOVendingMachine/impl/DVMTrader.sol index d082a1f..e5f6e2d 100644 --- a/contracts/DODOVendingMachine/impl/DVMTrader.sol +++ b/contracts/DODOVendingMachine/impl/DVMTrader.sol @@ -21,8 +21,8 @@ contract DVMTrader is DVMVault { // ============ Events ============ event DODOSwap( - address indexed fromToken, - address indexed toToken, + address fromToken, + address toToken, uint256 fromAmount, uint256 toAmount, address trader @@ -103,12 +103,7 @@ contract DVMTrader is DVMVault { uint256 quoteAmount, address assetTo, bytes calldata data - ) - external - preventReentrant - isSellAllow(assetTo) - isBuyAllow(assetTo) - { + ) external preventReentrant isSellAllow(assetTo) isBuyAllow(assetTo) { _transferBaseOut(assetTo, baseAmount); _transferQuoteOut(assetTo, quoteAmount);