Skip to content

Commit

Permalink
Don't change transfer policy if nothing changed
Browse files Browse the repository at this point in the history
  • Loading branch information
koirikivi committed Sep 30, 2024
1 parent 33ac2eb commit 32a7047
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bridge_contracts/config/runes/hardhat.config.runes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ task(`${PREFIX}set-evm-to-btc-transfer-policy`)
const oldPolicy = await bridge.getEvmToBtcTransferPolicy(token);
console.log('Old policy:', oldPolicy);

let anyChanged = false;
let newPolicy = {
maxTokenAmount: oldPolicy.maxTokenAmount,
minTokenAmount: oldPolicy.minTokenAmount,
Expand All @@ -244,18 +245,30 @@ task(`${PREFIX}set-evm-to-btc-transfer-policy`)
};
if (maxTokenAmount) {
newPolicy.maxTokenAmount = BigInt(maxTokenAmount);
anyChanged = true;
}
if (minTokenAmount) {
newPolicy.minTokenAmount = BigInt(minTokenAmount);
anyChanged = true;
}
if (flatFeeBaseCurrency) {
newPolicy.flatFeeBaseCurrency = BigInt(flatFeeBaseCurrency);
anyChanged = true;
}
if (flatFeeTokens) {
newPolicy.flatFeeTokens = BigInt(flatFeeTokens);
anyChanged = true;
}
if (dynamicFeeTokens) {
newPolicy.dynamicFeeTokens = BigInt(dynamicFeeTokens);
anyChanged = true;
}

if (!anyChanged) {
console.log("No changes detected, skipping");
return {
success: true,
}
}

console.log(`Setting EVM to BTC transfer policy for token ${token}`);
Expand Down

0 comments on commit 32a7047

Please sign in to comment.