Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@venusprotocol/keeper-bots

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@venusprotocol/keeper-bots

The Token Converter Bot uses the [ConverterOperator](../smart-contracts/contracts/operators/TokenConverterOperator.sol) to perform swaps using the Venus TokenConverter contracts.

  • 1.1.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Token Converter Bot

The Token Converter Bot uses the ConverterOperator to perform swaps using the Venus TokenConverter contracts.

Setup

Installation

yarn add @venusprotocol/token-converter-bot

You will also need to copy the .env.example file and add the appropriate values for the RPC and private key variables.

Reference

Guide

Start by querying available conversions by asset to send to the converter (assetIn), asset to receive from the converter (assetOut) or the converter you'd like to interact with. TokenConverter.queryConversions also takes a releaseFunds: boolean which will query using converter balances after releasing funds.

const potentialConversions = await tokenConverter.queryConversions({ assetIn, assetOut, converters, releaseFunds });

If you queried for conversions assuming the release of funds you'll want to release those funds before attempting conversions to ensure the converter balance is as you expect. An advanced version would be to check the amount you want to convert over the current balance and the balance after released to decide if you need to release the funds or not.

await tokenConverter.releaseFundsForConversions(potentialConversions);

Once you have the possible conversions, you can query for details on the flash swap required to execute conversion using TokenConverter.prepareConversion. Based on the amount you want to receive from the converter it will return a pancakeSwap trade, an updated amount out and a min income required for the trade (the difference between the amount you will receive from the converter and the amount that will be send to pancake swap).

const { trade, amount, minIncome } = await tokenConverter.prepareConversion(
  tokenConverter,
  assetOutAddress,
  assetInAddress,
  amountOut,
);

Using these values you can call arbitrage which will simulate the transaction and if successful execute it.

await tokenConverter.arbitrage(tokenConverter, trade, amount, minIncome);

Example

You can run a working example using the Venus Keeper Bot CLI .

FAQs

Package last updated on 30 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc