Skip to content

Automated service for processing BEP3 refunds on Kava and Binance Chain

Notifications You must be signed in to change notification settings

GretchenPi/refund-bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Refund Bot

Automated service for processing BEP3 refunds on Kava and Binance Chain.

Set up

Clone the example env file

cp ./refund/example-env ./refund/.env

Running

Running the refund bot is straightforward. Simply declare a new RefundBot, initialize its Kava client and Binance Chain client, then refund swaps on a cron job. Here's a working example:

var main = async () => {
  // Load environment variables
  const cronTimer = process.env.CRONTAB;
  const kavaLcdURL = process.env.KAVA_LCD_URL;
  const kavaMnemonic = process.env.KAVA_MNEMONIC;
  const bnbChainLcdURL = process.env.BINANCE_CHAIN_LCD_URL;
  const bnbChainMnemonic = process.env.BINANCE_CHAIN_MNEMONIC;
  const bnbChainDeputy = process.env.BINANCE_CHAIN_DEPUTY_ADDRESS;

  // Initiate refund bot
  refundBot = new RefundBot(bnbChainDeputy);
  await refundBot.initKavaClient(kavaLcdURL, kavaMnemonic);
  await refundBot.initBnbChainClient(
    bnbChainLcdURL,
    bnbChainMnemonic,
    "mainnet"
  );

  // Start cron job
  cron.schedule(cronTimer, () => {
    refundBot.refundSwaps();
  });

  // Optional: print Binance Chain offsets hourly for debugging
  cron.schedule("* 1 * * *", () => {
    refundBot.printOffsets();
  });
};

About

Automated service for processing BEP3 refunds on Kava and Binance Chain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 91.9%
  • Makefile 6.7%
  • Dockerfile 1.4%