Skip to content

Commit

Permalink
isTakingConceroFee refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
olegkron committed Oct 9, 2024
1 parent deec118 commit 7e241c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions packages/hardhat/contracts/DexSwap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,10 @@ contract DexSwap is IDexSwap, InfraCommon, InfraStorage {

_performSwap(_swapData[i], destinationAddress);

if (swapDataLength - 1 > i) {
if (i < swapDataLength - 1) {
if (_swapData[i].toToken != _swapData[i + 1].fromToken) {
revert InvalidTokenPath();
}
}

if (i + 1 <= swapDataLength - 1) {
uint256 postBalance = LibConcero.getBalance(_swapData[i].toToken, address(this));
uint256 newBalance = postBalance - previousBalance;
_swapData[i + 1].fromAmount = newBalance;
Expand All @@ -105,6 +102,7 @@ contract DexSwap is IDexSwap, InfraCommon, InfraStorage {
}
}

//TODO: optimise this line in the future
uint256 outputAmount = LibConcero.getBalance(dstToken, address(this)) -
dstTokenBalanceBefore;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const rl = readline.createInterface({ input: process.stdin, output: process.stdo
const prompt = (question: string): Promise<string> => new Promise(resolve => rl.question(question, resolve));

const minBalances: Record<ProxyEnum, bigint> = {
parentPoolProxy: parseEther("7"),
parentPoolProxy: parseEther("10"),
childPoolProxy: parseEther("1.5"),
infraProxy: parseEther("7"),
infraProxy: parseEther("10"),
};

async function checkChainBalance(chain: CNetwork, contractType: ProxyEnum): Promise<BalanceInfo> {
Expand Down

0 comments on commit 7e241c6

Please sign in to comment.