more events

This commit is contained in:
mingda
2020-07-11 00:57:00 +08:00
parent be649f7750
commit 6f3f1557d7
2 changed files with 23 additions and 5 deletions

View File

@@ -19,7 +19,16 @@ import {Storage} from "./Storage.sol";
contract Admin is Storage {
// ============ Events ============
event UpdateGasPriceLimit(uint256 newGasPriceLimit);
event UpdateGasPriceLimit(uint256 oldGasPriceLimit, uint256 newGasPriceLimit);
event UpdateLiquidityProviderFeeRate(
uint256 oldLiquidityProviderFeeRate,
uint256 newLiquidityProviderFeeRate
);
event UpdateMaintainerFeeRate(uint256 oldMaintainerFeeRate, uint256 newMaintainerFeeRate);
event UpdateK(uint256 oldK, uint256 newK);
// ============ Params Setting Functions ============
@@ -36,23 +45,26 @@ contract Admin is Storage {
}
function setLiquidityProviderFeeRate(uint256 newLiquidityPorviderFeeRate) external onlyOwner {
emit UpdateLiquidityProviderFeeRate(_LP_FEE_RATE_, newLiquidityPorviderFeeRate);
_LP_FEE_RATE_ = newLiquidityPorviderFeeRate;
_checkDODOParameters();
}
function setMaintainerFeeRate(uint256 newMaintainerFeeRate) external onlyOwner {
emit UpdateMaintainerFeeRate(_MT_FEE_RATE_, newMaintainerFeeRate);
_MT_FEE_RATE_ = newMaintainerFeeRate;
_checkDODOParameters();
}
function setK(uint256 newK) external onlyOwner {
emit UpdateK(_K_, newK);
_K_ = newK;
_checkDODOParameters();
}
function setGasPriceLimit(uint256 newGasPriceLimit) external onlySupervisorOrOwner {
emit UpdateGasPriceLimit(_GAS_PRICE_LIMIT_, newGasPriceLimit);
_GAS_PRICE_LIMIT_ = newGasPriceLimit;
emit UpdateGasPriceLimit(newGasPriceLimit);
}
// ============ System Control Functions ============

View File

@@ -30,7 +30,9 @@ contract Trader is Storage, Pricing, Settlement {
event BuyBaseToken(address indexed buyer, uint256 receiveBase, uint256 payQuote);
event MaintainerFee(bool isBaseToken, uint256 amount);
event ChargeMaintainerFeeBase(address indexed maintainer, uint256 amount);
event ChargeMaintainerFeeQuote(address indexed maintainer, uint256 amount);
// ============ Modifiers ============
@@ -82,7 +84,9 @@ contract Trader is Storage, Pricing, Settlement {
_donateQuoteToken(lpFeeQuote);
emit SellBaseToken(msg.sender, amount, receiveQuote);
emit MaintainerFee(false, mtFeeQuote);
if (mtFeeQuote != 0) {
emit ChargeMaintainerFeeQuote(_MAINTAINER_, mtFeeQuote);
}
return receiveQuote;
}
@@ -123,7 +127,9 @@ contract Trader is Storage, Pricing, Settlement {
_donateBaseToken(lpFeeBase);
emit BuyBaseToken(msg.sender, amount, payQuote);
emit MaintainerFee(true, mtFeeBase);
if (mtFeeBase != 0) {
emit ChargeMaintainerFeeBase(_MAINTAINER_, mtFeeBase);
}
return payQuote;
}