npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@venusprotocol/token-converter-bot

v1.2.0

Published

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

Downloads

43

Readme

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 .