Skip to content

Commit

Permalink
Merge pull request #123 from bancorprotocol/pol-eth-to-bnt
Browse files Browse the repository at this point in the history
carbon pol eth conversion - minor fix
  • Loading branch information
ivanzhelyazkov authored Nov 28, 2023
2 parents cb56770 + 49b1aa1 commit c5cee7d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
25 changes: 17 additions & 8 deletions contracts/pol/CarbonPOL.sol
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ contract CarbonPOL is ICarbonPOL, Upgradeable, ReentrancyGuardUpgradeable, Utils
}
_tradingStartTimes[token] = uint32(block.timestamp);
_initialPrice[token] = price;
emit TradingEnabled(token, price);
emit TradingEnabled({ token: token, price: price });
}

/**
Expand All @@ -193,7 +193,7 @@ contract CarbonPOL is ICarbonPOL, Upgradeable, ReentrancyGuardUpgradeable, Utils
_tradingStartTimes[NATIVE_TOKEN] = uint32(block.timestamp);
_initialPrice[NATIVE_TOKEN] = price;
_ethSaleAmount.current = Math.min(address(this).balance, _ethSaleAmount.initial).toUint128();
emit TradingEnabled(NATIVE_TOKEN, price);
emit TradingEnabled({ token: NATIVE_TOKEN, price: price });
}

/**
Expand Down Expand Up @@ -308,7 +308,7 @@ contract CarbonPOL is ICarbonPOL, Upgradeable, ReentrancyGuardUpgradeable, Utils
} else {
inputAmount = _sellTokenForETH(token, amount);
}
emit TokenTraded(msg.sender, token, amount, inputAmount);
emit TokenTraded({ caller: msg.sender, token: token, inputAmount: inputAmount, outputAmount: amount });
}

function _sellTokenForETH(Token token, uint128 amount) private returns (uint128) {
Expand Down Expand Up @@ -356,7 +356,7 @@ contract CarbonPOL is ICarbonPOL, Upgradeable, ReentrancyGuardUpgradeable, Utils
_initialPrice[NATIVE_TOKEN] = price;
_tradingStartTimes[NATIVE_TOKEN] = uint32(block.timestamp);
// emit price updated event
emit PriceUpdated(NATIVE_TOKEN, price);
emit PriceUpdated({ token: NATIVE_TOKEN, price: price });
}

return bntRequired;
Expand All @@ -375,7 +375,10 @@ contract CarbonPOL is ICarbonPOL, Upgradeable, ReentrancyGuardUpgradeable, Utils

_marketPriceMultiply = newMarketPriceMultiply;

emit MarketPriceMultiplyUpdated(prevMarketPriceMultiply, newMarketPriceMultiply);
emit MarketPriceMultiplyUpdated({
prevMarketPriceMultiply: prevMarketPriceMultiply,
newMarketPriceMultiply: newMarketPriceMultiply
});
}

/**
Expand All @@ -391,7 +394,10 @@ contract CarbonPOL is ICarbonPOL, Upgradeable, ReentrancyGuardUpgradeable, Utils

_priceDecayHalfLife = newPriceDecayHalfLife;

emit PriceDecayHalfLifeUpdated(prevPriceDecayHalfLife, newPriceDecayHalfLife);
emit PriceDecayHalfLifeUpdated({
prevPriceDecayHalfLife: prevPriceDecayHalfLife,
newPriceDecayHalfLife: newPriceDecayHalfLife
});
}

/**
Expand All @@ -412,7 +418,7 @@ contract CarbonPOL is ICarbonPOL, Upgradeable, ReentrancyGuardUpgradeable, Utils
_ethSaleAmount.current = Math.min(address(this).balance, _ethSaleAmount.initial).toUint128();
}

emit EthSaleAmountUpdated(prevEthSaleAmount, newEthSaleAmount);
emit EthSaleAmountUpdated({ prevEthSaleAmount: prevEthSaleAmount, newEthSaleAmount: newEthSaleAmount });
}

/**
Expand All @@ -428,7 +434,10 @@ contract CarbonPOL is ICarbonPOL, Upgradeable, ReentrancyGuardUpgradeable, Utils

_minEthSaleAmount = newMinEthSaleAmount;

emit MinEthSaleAmountUpdated(prevMinEthSaleAmount, newMinEthSaleAmount);
emit MinEthSaleAmountUpdated({
prevMinEthSaleAmount: prevMinEthSaleAmount,
newMinEthSaleAmount: newMinEthSaleAmount
});
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/forge/CarbonPOL.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ contract CarbonPOLTest is TestFixture {

// trade
vm.expectEmit();
emit TokenTraded(user1, token, tradeAmount, expectedTradeInput);
emit TokenTraded(user1, token, expectedTradeInput, tradeAmount);
carbonPOL.trade{ value: expectedTradeInput }(token, tradeAmount);

vm.stopPrank();
Expand Down Expand Up @@ -648,7 +648,7 @@ contract CarbonPOLTest is TestFixture {

// trade
vm.expectEmit();
emit TokenTraded(user1, token, tradeAmount, expectedTradeInput);
emit TokenTraded(user1, token, expectedTradeInput, tradeAmount);
carbonPOL.trade(token, tradeAmount);

vm.stopPrank();
Expand Down

0 comments on commit c5cee7d

Please sign in to comment.