diff --git a/contracts/DODOZoo.sol b/contracts/DODOZoo.sol index 0dc08b8..62b3555 100644 --- a/contracts/DODOZoo.sol +++ b/contracts/DODOZoo.sol @@ -38,8 +38,7 @@ contract DODOZoo is Ownable { uint256 k, uint256 gasPriceLimit ) public onlyOwner returns (address) { - require(!isDODORegistered(baseToken, quoteToken), "DODO_IS_REGISTERED"); - require(baseToken != quoteToken, "BASE_IS_SAME_WITH_QUOTE"); + require(!isDODORegistered(baseToken, quoteToken), "DODO_REGISTERED"); address newBornDODO = address(new DODO()); IDODO(newBornDODO).init( supervisor, diff --git a/contracts/impl/LiquidityProvider.sol b/contracts/impl/LiquidityProvider.sol index 596b6f6..7bb2600 100644 --- a/contracts/impl/LiquidityProvider.sol +++ b/contracts/impl/LiquidityProvider.sol @@ -49,12 +49,12 @@ contract LiquidityProvider is Storage, Pricing, Settlement { // ============ Modifiers ============ modifier depositQuoteAllowed() { - require(_DEPOSIT_QUOTE_ALLOWED_, "DEPOSIT_QUOTE_TOKEN_NOT_ALLOWED"); + require(_DEPOSIT_QUOTE_ALLOWED_, "DEPOSIT_QUOTE_NOT_ALLOWED"); _; } modifier depositBaseAllowed() { - require(_DEPOSIT_BASE_ALLOWED_, "DEPOSIT_BASE_TOKEN_NOT_ALLOWED"); + require(_DEPOSIT_BASE_ALLOWED_, "DEPOSIT_BASE_NOT_ALLOWED"); _; } @@ -144,7 +144,7 @@ contract LiquidityProvider is Storage, Pricing, Settlement { // handle penalty, penalty may exceed amount uint256 penalty = getWithdrawQuotePenalty(amount); - require(penalty < amount, "COULD_NOT_AFFORD_LIQUIDITY_PENALTY"); + require(penalty < amount, "PENALTY_EXCEED"); // settlement _TARGET_QUOTE_TOKEN_AMOUNT_ = _TARGET_QUOTE_TOKEN_AMOUNT_.sub(amount); @@ -172,7 +172,7 @@ contract LiquidityProvider is Storage, Pricing, Settlement { // handle penalty, penalty may exceed amount uint256 penalty = getWithdrawBasePenalty(amount); - require(penalty <= amount, "COULD_NOT_AFFORD_LIQUIDITY_PENALTY"); + require(penalty <= amount, "PENALTY_EXCEED"); // settlement _TARGET_BASE_TOKEN_AMOUNT_ = _TARGET_BASE_TOKEN_AMOUNT_.sub(amount); @@ -194,7 +194,7 @@ contract LiquidityProvider is Storage, Pricing, Settlement { // handle penalty, penalty may exceed amount uint256 penalty = getWithdrawQuotePenalty(withdrawAmount); - require(penalty <= withdrawAmount, "COULD_NOT_AFFORD_LIQUIDITY_PENALTY"); + require(penalty <= withdrawAmount, "PENALTY_EXCEED"); // settlement _TARGET_QUOTE_TOKEN_AMOUNT_ = _TARGET_QUOTE_TOKEN_AMOUNT_.sub(withdrawAmount); @@ -214,7 +214,7 @@ contract LiquidityProvider is Storage, Pricing, Settlement { // handle penalty, penalty may exceed amount uint256 penalty = getWithdrawBasePenalty(withdrawAmount); - require(penalty <= withdrawAmount, "COULD_NOT_AFFORD_LIQUIDITY_PENALTY"); + require(penalty <= withdrawAmount, "PENALTY_EXCEED"); // settlement _TARGET_BASE_TOKEN_AMOUNT_ = _TARGET_BASE_TOKEN_AMOUNT_.sub(withdrawAmount); @@ -269,7 +269,7 @@ contract LiquidityProvider is Storage, Pricing, Settlement { } function getWithdrawQuotePenalty(uint256 amount) public view returns (uint256 penalty) { - require(amount <= _QUOTE_BALANCE_, "DODO_QUOTE_TOKEN_BALANCE_NOT_ENOUGH"); + require(amount <= _QUOTE_BALANCE_, "DODO_QUOTE_BALANCE_NOT_ENOUGH"); if (_R_STATUS_ == Types.RStatus.BELOW_ONE) { uint256 spareBase = _BASE_BALANCE_.sub(_TARGET_BASE_TOKEN_AMOUNT_); uint256 price = getOraclePrice(); @@ -292,7 +292,7 @@ contract LiquidityProvider is Storage, Pricing, Settlement { } function getWithdrawBasePenalty(uint256 amount) public view returns (uint256 penalty) { - require(amount <= _BASE_BALANCE_, "DODO_BASE_TOKEN_BALANCE_NOT_ENOUGH"); + require(amount <= _BASE_BALANCE_, "DODO_BASE_BALANCE_NOT_ENOUGH"); if (_R_STATUS_ == Types.RStatus.ABOVE_ONE) { uint256 spareQuote = _QUOTE_BALANCE_.sub(_TARGET_QUOTE_TOKEN_AMOUNT_); uint256 price = getOraclePrice(); diff --git a/contracts/impl/Pricing.sol b/contracts/impl/Pricing.sol index ee88a7f..f9ce3ee 100644 --- a/contracts/impl/Pricing.sol +++ b/contracts/impl/Pricing.sol @@ -48,7 +48,7 @@ contract Pricing is Storage { view returns (uint256 payQuoteToken) { - require(amount < targetBaseTokenAmount, "DODO_BASE_TOKEN_BALANCE_NOT_ENOUGH"); + require(amount < targetBaseTokenAmount, "DODO_BASE_BALANCE_NOT_ENOUGH"); uint256 B2 = targetBaseTokenAmount.sub(amount); payQuoteToken = _RAboveIntegrate(targetBaseTokenAmount, targetBaseTokenAmount, B2); return payQuoteToken; @@ -111,7 +111,7 @@ contract Pricing is Storage { uint256 baseBalance, uint256 targetBaseAmount ) internal view returns (uint256 payQuoteToken) { - require(amount < baseBalance, "DODO_BASE_TOKEN_BALANCE_NOT_ENOUGH"); + require(amount < baseBalance, "DODO_BASE_BALANCE_NOT_ENOUGH"); uint256 B2 = baseBalance.sub(amount); return _RAboveIntegrate(targetBaseAmount, baseBalance, B2); } diff --git a/contracts/impl/Settlement.sol b/contracts/impl/Settlement.sol index f5ceaff..5c1b0cb 100644 --- a/contracts/impl/Settlement.sol +++ b/contracts/impl/Settlement.sol @@ -113,7 +113,7 @@ contract Settlement is Storage { // claim remaining assets after final settlement function claim() external preventReentrant { - require(_CLOSED_, "DODO_IS_NOT_CLOSED"); + require(_CLOSED_, "DODO_NOT_CLOSED"); require(!_CLAIMED_[msg.sender], "ALREADY_CLAIMED"); _CLAIMED_[msg.sender] = true; uint256 quoteAmount = DecimalMath.mul( diff --git a/contracts/impl/Storage.sol b/contracts/impl/Storage.sol index a56e5bd..63f8d1d 100644 --- a/contracts/impl/Storage.sol +++ b/contracts/impl/Storage.sol @@ -72,16 +72,16 @@ contract Storage is Ownable, ReentrancyGuard { } modifier notClosed() { - require(!_CLOSED_, "DODO_IS_CLOSED"); + require(!_CLOSED_, "DODO_CLOSED"); _; } // ============ Helper Functions ============ function _checkDODOParameters() internal view returns (uint256) { - require(_K_ < DecimalMath.ONE, "K_MUST_BE_LESS_THAN_ONE"); - require(_K_ > 0, "K_MUST_BE_GREATER_THAN_ZERO"); - require(_LP_FEE_RATE_.add(_MT_FEE_RATE_) < DecimalMath.ONE, "FEE_MUST_BE_LESS_THAN_ONE"); + require(_K_ < DecimalMath.ONE, "K>=1"); + require(_K_ > 0, "K=0"); + require(_LP_FEE_RATE_.add(_MT_FEE_RATE_) < DecimalMath.ONE, "FEE_RATE>=1"); } function getOraclePrice() public view returns (uint256) { diff --git a/contracts/intf/IERC20.sol b/contracts/intf/IERC20.sol index 2f1810b..252e1f5 100644 --- a/contracts/intf/IERC20.sol +++ b/contracts/intf/IERC20.sol @@ -70,18 +70,4 @@ interface IERC20 { address recipient, uint256 amount ) external returns (bool); - - /** - * @dev Emitted when `value` tokens are moved from one account (`from`) to - * another (`to`). - * - * Note that `value` may be zero. - */ - event Transfer(address indexed from, address indexed to, uint256 value); - - /** - * @dev Emitted when the allowance of a `spender` for an `owner` is set by - * a call to {approve}. `value` is the new allowance. - */ - event Approval(address indexed owner, address indexed spender, uint256 value); } diff --git a/contracts/lib/ReentrancyGuard.sol b/contracts/lib/ReentrancyGuard.sol index dee0bea..f56a8ef 100644 --- a/contracts/lib/ReentrancyGuard.sol +++ b/contracts/lib/ReentrancyGuard.sol @@ -24,7 +24,7 @@ contract ReentrancyGuard { } modifier preventReentrant() { - require(_ENTER_STATUS_ != Types.EnterStatus.ENTERED, "ReentrancyGuard: reentrant call"); + require(_ENTER_STATUS_ != Types.EnterStatus.ENTERED, "REENTRANT"); _ENTER_STATUS_ = Types.EnterStatus.ENTERED; _; _ENTER_STATUS_ = Types.EnterStatus.NOT_ENTERED;