Skip to content

Commit

Permalink
Merge pull request #24 from bnb-party/optimizer
Browse files Browse the repository at this point in the history
remove unnecessary approve
  • Loading branch information
YouStillAlive authored Jul 17, 2024
2 parents af60cec + e0ce55a commit 877c4d8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 3 deletions.
2 changes: 0 additions & 2 deletions contracts/BNBPartyInternal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ abstract contract BNBPartyInternal is BNBPartyState {
function _executeSwap(address tokenOut) internal {
require(address(swapRouter) != address(0), "BNBPartyFactory: swapRouter not set");
uint256 amountIn = msg.value - party.createTokenFee;
// Approve the swap router to spend WBNB
WBNB.approve(address(swapRouter), amountIn);

// Prepare swap parameters
ISwapRouter.ExactInputParams memory params = ISwapRouter
Expand Down
1 change: 0 additions & 1 deletion test/BNBPartyFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ describe("BNBPartyFactory", function () {
amountOutMinimum: "0",
}
const token1Contract = await ethers.getContractAt("ERC20", MEME)
await weth9.approve(await swapRouter.getAddress(), amountIn)

const balanceBefore = await token1Contract.balanceOf(await signers[0].getAddress())
await expect(await swapRouter.exactInput(params, { value: amountIn })).to.emit(weth9, "Deposit")
Expand Down

0 comments on commit 877c4d8

Please sign in to comment.