diff --git a/contracts/Gateway.sol b/contracts/Gateway.sol index 8c3ec55..ed7abff 100644 --- a/contracts/Gateway.sol +++ b/contracts/Gateway.sol @@ -217,7 +217,7 @@ contract Gateway is IGateway, GatewaySettingManager, PausableUpgradeable { return true; } - /** @dev See {refund-IGateway}. */ + /** @dev See {refundOrder-IGateway}. */ function refundOrder(uint256 _fee, bytes32 _orderId) external onlyAggregator returns (bool) { // ensure the transaction has not been fulfilled require(!offRampOrder[_orderId].isFulfilled, 'OrderFulfilled'); @@ -257,7 +257,7 @@ contract Gateway is IGateway, GatewaySettingManager, PausableUpgradeable { return true; } - /** @dev See {settleOnRampOrder-IGateway}. */ + /** @dev See {settleOrder-IGateway}. */ function settleOrder( bytes32 _orderId, bytes memory _signature, @@ -275,9 +275,7 @@ contract Gateway is IGateway, GatewaySettingManager, PausableUpgradeable { bytes32 ethSignedMessageHash = messageHash.toEthSignedMessageHash(); address recoveredAddress = ethSignedMessageHash.recover(_signature); require(recoveredAddress == _provider, "Invalid signature"); - // update transaction uint256 _protocolFee = (_amount * protocolFeePercent) / MAX_BPS; - // Check provider's balance, // Note: There is no need for checks for token supported as the balance will be 0 if the token is not supported require(balance[_token][_provider] >= _amount + _protocolFee, "Insufficient balance"); @@ -286,8 +284,7 @@ contract Gateway is IGateway, GatewaySettingManager, PausableUpgradeable { // Update balances balance[_token][_provider] -= (_amount + _protocolFee); - - // Update OnRampOrder state + onRampOrder[_orderId] = OnRampOrder({ amount: _amount, provider: _provider, @@ -300,11 +297,9 @@ contract Gateway is IGateway, GatewaySettingManager, PausableUpgradeable { // transfer to sender IERC20(_token).transfer(_sender, _amount); if (_protocolFee > 0) { - // transfer protocol fee IERC20(_token).transfer(treasuryAddress, _protocolFee); } - // Emit event emit OnrampOrderSettlement(_provider, _sender, _amount, _token, _orderId); } diff --git a/test/gateway/gateway.settleOnchainOrder.test.js b/test/gateway/gateway.settleOnchainOrder.test.js deleted file mode 100644 index a5c57af..0000000 --- a/test/gateway/gateway.settleOnchainOrder.test.js +++ /dev/null @@ -1,526 +0,0 @@ -const { ethers } = require("hardhat"); -const { BigNumber } = require("@ethersproject/bignumber"); -const { gatewayFixture } = require("../fixtures/gateway.js"); -const { - deployContract, - ZERO_AMOUNT, - Events, - mockMintDeposit, - assertBalance, - assertDepositBalance, -} = require("../utils/utils.manager.js"); -const { expect } = require("chai"); - -describe("Gateway Onramp Order settlement", function () { - beforeEach(async function () { - [ - this.deployer, - this.treasuryAddress, - this.aggregator, - this.alice, - this.bob, - this.Eve, - this.hacker, - ...this.accounts - ] = await ethers.getSigners(); - - ({ gateway, mockUSDT } = await gatewayFixture()); - - this.mockDAI = await deployContract("MockUSDT"); - - this.mockUSDT = mockUSDT; - this.gateway = gateway; - - this.depositAmount = ethers.utils.parseEther("1000000"); - - await mockMintDeposit(gateway, this.alice, mockUSDT, this.depositAmount); - await mockMintDeposit(gateway, this.Eve, mockUSDT, this.depositAmount); - await mockMintDeposit( - gateway, - this.alice, - this.mockDAI, - this.depositAmount - ); - await mockMintDeposit(gateway, this.Eve, this.mockDAI, this.depositAmount); - - await assertBalance( - this.mockUSDT, - this.mockDAI, - this.alice.address, - this.depositAmount - ); - await assertBalance( - this.mockUSDT, - this.mockDAI, - this.bob.address, - ZERO_AMOUNT - ); - await assertBalance( - this.mockUSDT, - this.mockDAI, - this.Eve.address, - this.depositAmount - ); - - const token = ethers.utils.formatBytes32String("token"); - - await expect( - this.gateway - .connect(this.deployer) - .settingManagerBool(token, this.mockUSDT.address, BigNumber.from(1)) - ) - .to.emit(this.gateway, Events.Gateway.SettingManagerBool) - .withArgs(token, this.mockUSDT.address, BigNumber.from(1)); - - const treasury = ethers.utils.formatBytes32String("treasury"); - - await expect( - gateway - .connect(this.deployer) - .updateProtocolAddress(treasury, this.treasuryAddress.address) - ).to.emit(gateway, Events.Gateway.ProtocolAddressUpdated); - - const aggregator = ethers.utils.formatBytes32String("aggregator"); - - await expect( - gateway - .connect(this.deployer) - .updateProtocolAddress(aggregator, this.aggregator.address) - ).to.emit(gateway, Events.Gateway.ProtocolAddressUpdated); - }); - - it("Should settle onramp assets from provider to sender", async function () { - const orderId = ethers.utils.formatBytes32String("order1"); - const amount = ethers.utils.parseEther("1000"); - - // Create the message hash - const messageHash = ethers.utils.solidityKeccak256( - ["bytes32", "address", "address", "address", "uint256"], - [ - orderId, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount, - ] - ); - - // Sign the message - const signature = await this.alice.signMessage( - ethers.utils.arrayify(messageHash) - ); - - // Check initial balances - await assertDepositBalance( - this.gateway, - this.mockUSDT.address, - this.alice.address, - ZERO_AMOUNT - ); - await assertDepositBalance( - this.gateway, - this.mockUSDT.address, - this.bob.address, - ZERO_AMOUNT - ); - - await expect( - this.gateway - .connect(this.alice) - .deposit(this.mockUSDT.address, this.depositAmount) - ) - .to.emit(this.gateway, Events.Gateway.Deposit) - .withArgs( - this.alice.address, - this.mockUSDT.address, - BigNumber.from(this.depositAmount) - ); - - await assertDepositBalance( - this.gateway, - this.mockUSDT.address, - this.alice.address, - this.depositAmount - ); - // Perform the settling order - await expect( - this.gateway.connect(this.aggregator).settleOrder( - orderId, - signature, - this.alice.address, // Provider - this.bob.address, // Sender - this.mockUSDT.address, - amount - ) - ) - .to.emit(this.gateway, Events.Gateway.OnrampOrderSettlement) - .withArgs( - this.alice.address, - this.bob.address, - amount, - this.mockUSDT.address, - orderId - ); - - // Check final balances - await assertDepositBalance( - this.gateway, - this.mockUSDT.address, - this.alice.address, - this.depositAmount.sub(amount) - ); - - await assertBalance(this.mockUSDT, this.mockUSDT, this.bob.address, amount); - }); - - it("Should fail if the order is already processed", async function () { - const orderId = ethers.utils.formatBytes32String("order1"); - const amount = ethers.utils.parseEther("1000"); - - await expect( - this.gateway - .connect(this.alice) - .deposit(this.mockUSDT.address, this.depositAmount) - ) - .to.emit(this.gateway, Events.Gateway.Deposit) - .withArgs( - this.alice.address, - this.mockUSDT.address, - BigNumber.from(this.depositAmount) - ); - - // Create the message hash - const messageHash = ethers.utils.solidityKeccak256( - ["bytes32", "address", "address", "address", "uint256"], - [ - orderId, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount, - ] - ); - - // Sign the message - const signature = await this.alice.signMessage( - ethers.utils.arrayify(messageHash) - ); - - // Perform the settling - await this.gateway - .connect(this.aggregator) - .settleOrder( - orderId, - signature, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount - ); - - // Try to perform the settling again - await expect( - this.gateway - .connect(this.aggregator) - .settleOrder( - orderId, - signature, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount - ) - ).to.be.revertedWith("Order already processed"); - }); - - it("Should fail if the signature is invalid", async function () { - const orderId = ethers.utils.formatBytes32String("order1"); - const amount = ethers.utils.parseEther("1000"); - - // Create the message hash - const messageHash = ethers.utils.solidityKeccak256( - ["bytes32", "address", "address", "address", "uint256"], - [ - orderId, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount, - ] - ); - - // Sign the message with a different account - const signature = await this.hacker.signMessage( - ethers.utils.arrayify(messageHash) - ); - - // Try to perform the settling with the invalid signature - await expect( - this.gateway - .connect(this.aggregator) - .settleOrder( - orderId, - signature, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount - ) - ).to.be.revertedWith("Invalid signature"); - }); - - it("Should fail if the provider has insufficient balance", async function () { - const orderId = ethers.utils.formatBytes32String("order1"); - const amount = ethers.utils.parseEther("2000000"); // More than the deposit amount - - // Create the message hash - const messageHash = ethers.utils.solidityKeccak256( - ["bytes32", "address", "address", "address", "uint256"], - [ - orderId, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount, - ] - ); - - // Sign the message - const signature = await this.alice.signMessage( - ethers.utils.arrayify(messageHash) - ); - - // Try to perform the settling with insufficient balance - await expect( - this.gateway - .connect(this.aggregator) - .settleOrder( - orderId, - signature, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount - ) - ).to.be.revertedWith("Insufficient balance"); - }); - - it("Should fail when provider address is zero", async function () { - const orderId = ethers.utils.formatBytes32String("order2"); - const amount = ethers.utils.parseEther("1000"); - const zeroAddress = ethers.constants.AddressZero; - - const messageHash = ethers.utils.solidityKeccak256( - ["bytes32", "address", "address", "address", "uint256"], - [orderId, zeroAddress, this.bob.address, this.mockUSDT.address, amount] - ); - - const signature = await this.alice.signMessage( - ethers.utils.arrayify(messageHash) - ); - - await expect( - this.gateway - .connect(this.aggregator) - .settleOrder( - orderId, - signature, - zeroAddress, - this.bob.address, - this.mockUSDT.address, - amount - ) - ).to.be.revertedWith("Invalid provider address"); - }); - - it("Should revert when sender address is zero", async function () { - const orderId = ethers.utils.formatBytes32String("zeroSenderOrder"); - const amount = ethers.utils.parseEther("1"); - const zeroAddress = ethers.constants.AddressZero; - - const messageHash = ethers.utils.solidityKeccak256( - ["bytes32", "address", "address", "address", "uint256"], - [orderId, this.alice.address, zeroAddress, this.mockUSDT.address, amount] - ); - - const signature = await this.alice.signMessage( - ethers.utils.arrayify(messageHash) - ); - - await expect( - this.gateway - .connect(this.aggregator) - .settleOrder( - orderId, - signature, - this.alice.address, - zeroAddress, - this.mockUSDT.address, - amount - ) - ).to.be.revertedWith("Invalid sender address"); - }); - - it("Should correctly calculate and transfer protocol fees", async function () { - const orderId = ethers.utils.formatBytes32String("feeOrder"); - const amount = ethers.utils.parseEther("1000"); - const newProtocolFeePercent = 250; // 2.5% - - // Set a new protocol fee - await this.gateway - .connect(this.deployer) - .updateProtocolFee(newProtocolFeePercent); - - // Create the message hash - const messageHash = ethers.utils.solidityKeccak256( - ["bytes32", "address", "address", "address", "uint256"], - [ - orderId, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount, - ] - ); - - // Sign the message - const signature = await this.alice.signMessage( - ethers.utils.arrayify(messageHash) - ); - - // Get initial balances - const initialTreasuryBalance = await this.mockUSDT.balanceOf( - this.treasuryAddress.address - ); - const initialBobBalance = await this.mockUSDT.balanceOf(this.bob.address); - - await expect( - this.gateway - .connect(this.alice) - .deposit(this.mockUSDT.address, this.depositAmount) - ) - .to.emit(this.gateway, Events.Gateway.Deposit) - .withArgs( - this.alice.address, - this.mockUSDT.address, - BigNumber.from(this.depositAmount) - ); - - const initialAliceBalance = await this.gateway.getBalance( - this.mockUSDT.address, - this.alice.address - ); - - // Perform the settling order - await expect( - this.gateway - .connect(this.aggregator) - .settleOrder( - orderId, - signature, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount - ) - ).to.emit(this.gateway, "OnrampOrderSettlement"); - const feeDetails = await this.gateway.getFeeDetails(); - // Calculate expected fee - const expectedFee = amount.mul(feeDetails[0]).div(feeDetails[1]); - - // Check final balances - const finalTreasuryBalance = await this.mockUSDT.balanceOf( - this.treasuryAddress.address - ); - const finalAliceBalance = await this.gateway.getBalance( - this.mockUSDT.address, - this.alice.address - ); - const finalBobBalance = await this.mockUSDT.balanceOf(this.bob.address); - - expect(finalTreasuryBalance).to.equal( - initialTreasuryBalance.add(expectedFee) - ); - expect(finalAliceBalance).to.equal( - initialAliceBalance.sub(amount.add(expectedFee)) - ); - - expect(finalBobBalance).to.equal(initialBobBalance.add(amount)); - - // validate treasury balance - expect(await this.mockUSDT.balanceOf(this.treasuryAddress.address)).to.eq( - initialTreasuryBalance.add(expectedFee) - ); - }); - - it("Should revert when a non-aggregator calls settle onramp order", async function () { - const orderId = ethers.utils.formatBytes32String("nonAggregatorOrder"); - const amount = ethers.utils.parseEther("1"); - - await this.gateway - .connect(this.alice) - .deposit(this.mockUSDT.address, amount); - - const messageHash = ethers.utils.solidityKeccak256( - ["bytes32", "address", "address", "address", "uint256"], - [ - orderId, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount, - ] - ); - - const signature = await this.alice.signMessage( - ethers.utils.arrayify(messageHash) - ); - - await expect( - this.gateway - .connect(this.alice) - .settleOrder( - orderId, - signature, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount - ) - ).to.be.revertedWith("OnlyAggregator"); - }); - - it("Should revert when amount is zero", async function () { - const orderId = ethers.utils.formatBytes32String("zeroAmountOrder"); - const amount = BigNumber.from(0); - - const messageHash = ethers.utils.solidityKeccak256( - ["bytes32", "address", "address", "address", "uint256"], - [ - orderId, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount, - ] - ); - - const signature = await this.alice.signMessage( - ethers.utils.arrayify(messageHash) - ); - - await expect( - this.gateway - .connect(this.aggregator) - .settleOrder( - orderId, - signature, - this.alice.address, - this.bob.address, - this.mockUSDT.address, - amount - ) - ).to.be.revertedWith("AmountIsZero"); - }); - -}); diff --git a/test/gateway/gateway.settleOrder.test.js b/test/gateway/gateway.settleOrder.test.js deleted file mode 100644 index 282f4ac..0000000 --- a/test/gateway/gateway.settleOrder.test.js +++ /dev/null @@ -1,322 +0,0 @@ -const { ethers } = require("hardhat"); -const { BigNumber } = require("@ethersproject/bignumber"); -const CryptoJS = require("crypto-js"); - -const { gatewayFixture } = require("../fixtures/gateway.js"); - -const { - ZERO_AMOUNT, - FEE_BPS, - MAX_BPS, - Events, - getSupportedInstitutions, -} = require("../utils/utils.manager.js"); -const { expect } = require("chai"); - -describe("Gateway offramp order", function () { - beforeEach(async function () { - [ - this.deployer, - this.treasuryAddress, - this.primaryValidator, - this.aggregator, - this.alice, - this.bob, - this.liquidityProvider, - this.sender, - this.hacker, - ...this.accounts - ] = await ethers.getSigners(); - - ({ gateway, mockUSDT } = await gatewayFixture()); - - this.mintAmount = ethers.utils.parseEther("27000000"); - this.orderAmount = ethers.utils.parseEther("27000000"); - this.senderFee = ethers.utils.parseEther("0"); - - // - - // charge 0.1% as protocol fee - const protocolFeePercent = BigNumber.from(100); - - this.protocolFee = ethers.utils.parseEther("27000") - - this.liquidityProviderAmount = this.orderAmount.sub(this.protocolFee); - - await expect( - gateway.connect(this.deployer).updateProtocolFee(protocolFeePercent) - ) - .to.emit(gateway, Events.Gateway.ProtocolFeeUpdated) - .withArgs(protocolFeePercent); - - await mockUSDT.connect(this.alice).mint(this.mintAmount); - - expect(await mockUSDT.balanceOf(this.alice.address)).to.eq(this.mintAmount); - await mockUSDT - .connect(this.alice) - .transfer(this.sender.address, this.mintAmount); - - expect(await mockUSDT.balanceOf(this.alice.address)).to.eq(ZERO_AMOUNT); - - expect(await mockUSDT.balanceOf(this.treasuryAddress.address)).to.eq( - ZERO_AMOUNT - ); - - expect(await mockUSDT.balanceOf(this.aggregator.address)).to.eq( - ZERO_AMOUNT - ); - expect(await mockUSDT.balanceOf(this.liquidityProvider.address)).to.eq( - ZERO_AMOUNT - ); - - const treasury = ethers.utils.formatBytes32String("treasury"); - - await expect( - gateway - .connect(this.deployer) - .updateProtocolAddress(treasury, this.treasuryAddress.address) - ).to.emit(gateway, Events.Gateway.ProtocolAddressUpdated); - - const aggregator = ethers.utils.formatBytes32String("aggregator"); - - await expect( - gateway - .connect(this.deployer) - .updateProtocolAddress(aggregator, this.aggregator.address) - ).to.emit(gateway, Events.Gateway.ProtocolAddressUpdated); - - await expect( - gateway.connect(this.deployer).updateProtocolFee(FEE_BPS) - ).to.emit(gateway, Events.Gateway.ProtocolFeeUpdated); - - expect( - await mockUSDT.allowance(this.alice.address, gateway.address) - ).to.equal(ZERO_AMOUNT); - - const token = ethers.utils.formatBytes32String("token"); - - await expect( - gateway - .connect(this.deployer) - .settingManagerBool(token, mockUSDT.address, BigNumber.from(1)) - ) - .to.emit(gateway, Events.Gateway.SettingManagerBool) - .withArgs(token, mockUSDT.address, BigNumber.from(1)); - }); - - it("Should be able to create order by the sender and settled by the liquidity aggregator", async function () { - const ret = await getSupportedInstitutions(); - - await mockUSDT - .connect(this.sender) - .approve(gateway.address, this.mintAmount); - - expect( - await mockUSDT.allowance(this.sender.address, gateway.address) - ).to.equal(this.mintAmount); - - const rate = 750; - const data = [ - { bank_account: "09090990901" }, - { bank_name: "ACCESS BANK" }, - { account_name: "Jeff Dean" }, - { institution_code: ret.accessBank.code }, - ]; - const password = "123"; - - const cipher = CryptoJS.AES.encrypt( - JSON.stringify(data), - password - ).toString(); - - const messageHash = "0x" + cipher; - - const argOrderID = [this.sender.address, 1]; - - const encoded = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - argOrderID - ); - const orderId = ethers.utils.solidityKeccak256(["bytes"], [encoded]); - - await expect( - gateway - .connect(this.sender) - .createOrder( - mockUSDT.address, - this.orderAmount, - rate, - this.sender.address, - this.senderFee, - this.alice.address, - messageHash.toString() - ) - ) - .to.emit(gateway, Events.Gateway.OrderCreated) - .withArgs( - this.sender.address, - mockUSDT.address, - this.orderAmount, - this.protocolFee, - orderId, - rate, - messageHash.toString() - ); - - [ - this.seller, - this.token, - this.senderRecipient, - this.senderFee, - this.protocolFee, - this.isFulfilled, - this.isRefunded, - this.refundAddress, - this.currentBPS, - this.amount, - ] = await gateway.getOrderInfo(orderId); - - expect(this.seller).to.eq(this.sender.address); - expect(this.token).to.eq(mockUSDT.address); - expect(this.senderRecipient).to.eq(this.sender.address); - expect(this.senderFee).to.eq(this.senderFee); - expect(this.isFulfilled).to.eq(false); - expect(this.isRefunded).to.eq(false); - expect(this.refundAddress).to.eq(this.alice.address); - expect(this.currentBPS).to.eq(MAX_BPS); - expect(this.amount).to.eq(BigNumber.from(this.orderAmount)); - - expect(await mockUSDT.balanceOf(this.alice.address)).to.eq(ZERO_AMOUNT); - - expect( - await mockUSDT.allowance(this.alice.address, gateway.address) - ).to.equal(ZERO_AMOUNT); - - // =================== Create Order =================== - - expect( - await gateway - .connect(this.aggregator) - .settleOrder(orderId, orderId, this.liquidityProvider.address, MAX_BPS) - ) - .to.emit(gateway, Events.Gateway.OfframpOrderSettlement) - .withArgs(orderId, orderId, this.liquidityProvider.address, MAX_BPS); - - expect(await mockUSDT.balanceOf(this.liquidityProvider.address)).to.eq( - this.liquidityProviderAmount - ); - expect(await mockUSDT.balanceOf(this.treasuryAddress.address)).to.eq( - this.protocolFee - ); - expect(await mockUSDT.balanceOf(gateway.address)).to.eq(ZERO_AMOUNT); - }); - - it("Should revert when trying to settle an already fulfilled order", async function () { - const ret = await getSupportedInstitutions(); - - await mockUSDT - .connect(this.sender) - .approve(gateway.address, this.mintAmount); - - expect( - await mockUSDT.allowance(this.sender.address, gateway.address) - ).to.equal(this.mintAmount); - - const rate = 750; - const data = [ - { bank_account: "09090990901" }, - { bank_name: "ACCESS BANK" }, - { account_name: "Jeff Dean" }, - { institution_code: ret.accessBank.code }, - ]; - const password = "123"; - - const cipher = CryptoJS.AES.encrypt( - JSON.stringify(data), - password - ).toString(); - - const messageHash = "0x" + cipher; - - const argOrderID = [this.sender.address, 1]; - - const encoded = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - argOrderID - ); - const orderId = ethers.utils.solidityKeccak256(["bytes"], [encoded]); - - await expect( - gateway - .connect(this.sender) - .createOrder( - mockUSDT.address, - this.orderAmount, - rate, - this.sender.address, - this.senderFee, - this.alice.address, - messageHash.toString() - ) - ) - .to.emit(gateway, Events.Gateway.OrderCreated) - .withArgs( - this.sender.address, - mockUSDT.address, - this.orderAmount, - this.protocolFee, - orderId, - rate, - messageHash.toString() - ); - - [ - this.seller, - this.token, - this.senderRecipient, - this.senderFee, - this.protocolFee, - this.isFulfilled, - this.isRefunded, - this.refundAddress, - this.currentBPS, - this.amount, - ] = await gateway.getOrderInfo(orderId); - - expect(this.seller).to.eq(this.sender.address); - expect(this.token).to.eq(mockUSDT.address); - expect(this.senderRecipient).to.eq(this.sender.address); - expect(this.senderFee).to.eq(this.senderFee); - expect(this.isFulfilled).to.eq(false); - expect(this.isRefunded).to.eq(false); - expect(this.refundAddress).to.eq(this.alice.address); - expect(this.currentBPS).to.eq(MAX_BPS); - expect(this.amount).to.eq( - BigNumber.from(this.orderAmount) - ); - - expect(await mockUSDT.balanceOf(this.alice.address)).to.eq(ZERO_AMOUNT); - - expect( - await mockUSDT.allowance(this.alice.address, gateway.address) - ).to.equal(ZERO_AMOUNT); - - // =================== Create Order =================== - expect( - await gateway - .connect(this.aggregator) - .settleOrder(orderId, orderId, this.liquidityProvider.address, MAX_BPS) - ) - .to.emit(gateway, Events.Gateway.OfframpOrderSettlement) - .withArgs(orderId, orderId, this.liquidityProvider.address, MAX_BPS); - - expect(await mockUSDT.balanceOf(this.liquidityProvider.address)).to.eq( - this.liquidityProviderAmount - ); - expect(await mockUSDT.balanceOf(this.treasuryAddress.address)).to.eq( - this.protocolFee - ); - - expect(await mockUSDT.balanceOf(gateway.address)).to.eq(ZERO_AMOUNT); - }); -});