Skip to content

Commit

Permalink
placed emit USDCBought event at the bottom of
Browse files Browse the repository at this point in the history
the buy function
  • Loading branch information
ethan-crypto committed Jan 20, 2022
1 parent 3f36e69 commit 8f4685c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/contracts/DexAggregator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ contract DexAggregator {
(uint8 _dex, uint[] memory _USDCAmounts) = getOutputAmounts(msg.value, _path);
// Route trade to dex with best USDC price
Dexes[_dex].swapETHForExactTokens{ value: msg.value }(_USDCAmounts[0], _path, msg.sender, _deadline);
emit USDCBought(_USDCAmounts[0], msg.value, address(Dexes[_dex]), _USDCAmounts[1]);
// refund leftover ETH to user
payable(msg.sender).transfer(address(this).balance);
emit USDCBought(_USDCAmounts[0], msg.value, address(Dexes[_dex]), _USDCAmounts[1]);
}
function sellUSDCAtBestPrice(uint _USDCAmount, uint _deadline, address[] calldata _path) external {
require(_path[1] == wethAddress && _path[0] == address(usdc), "Wrong token pair array");
Expand Down

0 comments on commit 8f4685c

Please sign in to comment.