Skip to content

Commit

Permalink
feat: script to set btc fee (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
scolear authored Jun 5, 2024
1 parent 1d47526 commit 7a6e895
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
23 changes: 23 additions & 0 deletions scripts/15_set-btc-fee.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const {
callTokenManagerFunction,
} = require('./helpers/10-call-token-manager-fn');

async function setBTCFee(mintOrBurn, newFee) {
let functionToCall;
if (mintOrBurn === 'mint') {
functionToCall = 'setBtcMintFeeRate';
} else if (mintOrBurn === 'burn') {
functionToCall = 'setBtcRedeemFeeRate';
} else {
throw new Error('Invalid mintOrBurn argument');
}
await callTokenManagerFunction(functionToCall, [newFee]);
}

module.exports = setBTCFee;

if (require.main === module) {
const mintOrBurn = process.argv[2];
const newFee = process.argv[3];
setBTCFee(mintOrBurn, newFee).catch(console.error);
}
8 changes: 8 additions & 0 deletions scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const unwhitelistAccount = require('./11_unwhitelist-account');
const tokenManagerSetupVault = require('./12_setup-vault');
const whitelistingEnabled = require('./13_set-whitelisting');
const setBtcFeeRecipient = require('./14_set-btc-fee-recipient');
const setBTCFee = require('./15_set-btc-fee');

const contractAdmin = require('./50_contract-admin');

Expand Down Expand Up @@ -174,6 +175,13 @@ async function main() {
.argument('<btcFeeRecipient>', 'BTC fee recipient')
.action(setBtcFeeRecipient);

program
.command('set-btc-fee-rate')
.description('[token-man] set BTC fee rate')
.argument('<mintOrBurn>', 'mint or burn')
.argument('<newFee>', 'new fee')
.action(setBTCFee);

program
.command('create-dlc')
.description('[test] create a DLC')
Expand Down

0 comments on commit 7a6e895

Please sign in to comment.