
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@venusprotocol/token-converter-bot
Advanced tools
The Token Converter Bot uses the [ConverterOperator](../smart-contracts/contracts/operators/TokenConverterOperator.sol) to perform swaps using the Venus TokenConverter contracts.
The Token Converter Bot uses the ConverterOperator to perform swaps using the Venus TokenConverter contracts.
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.
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);
You can run a working example using the Venus Keeper Bot CLI .
FAQs
The Token Converter Bot uses the [ConverterOperator](../smart-contracts/contracts/operators/TokenConverterOperator.sol) to perform swaps using the Venus TokenConverter contracts.
We found that @venusprotocol/token-converter-bot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.