All Blog Posts

Introducing the Flash Mint SDK v2

Flash Mint is an innovative integration that enables dApps and DEXs to pass along significant cost savings and provide deep liquidity for large cryptocurrency trades.

Introducing the Flash Mint SDK v2

Version 2 of the Flash Mint SDK introduces an even easier way to get quotes and execute flash mint transactions thus providing support for dApps and exchanges looking to easily integrate mint and redeem capabilities for crypto structured products, such as DeFi Pulse Index (DPI) and Interest Compounding Ethereum (icETH). Integrating Flash Mint provides many benefits not only for developers but also for crypto users. The ability to Flash Mint tokens reduces slippage and unlocks cost savings on large trades. The Flash Mint SDK is written in TypeScript, and is available now on GitHub.

TL;DR

“I’m a DeFi app and/or DEX aggregator. What’s in it for me?”

The Flash Mint SDK:

1. Provides the code and documentation so the ability to Flash Mint can be simply integrated into your dApp or DEX

2. Sources better trade execution for your users (especially for large trades)

What is Flash Mint?

A simple decentralized exchange (DEX) trade is usually cost-effective for smaller trades where you are likely to encounter low slippage. However, at some threshold on larger trades, you are likely to encounter significant slippage (> 1%). That’s where Flash Mint can offer cost savings.

Compared to typical DEX trades, Flash Mint can facilitate more cost-effective large trades by minting new units from the underlying product components. This is especially helpful where the cost of slippage would exceed the cost of gas for buying each token and minting a new product unit.

Flash Mint allows you to indirectly buy components of an index and then mint a new unit. As an example, here’s how that works for DPI:

  • You send your currency of choice (ETH, USDC, or DAI, for example) to the contract
  • Your currency is then exchanged into the correct amount of underlying DPI assets necessary to mint new units
  • New DPI units are minted and sent back to your wallet

The Contracts

To find out more about the code of Flash Mint contracts, go to Index Coop’s smart contract repository on GitHub.

The SDK includes all contracts for the different products we offer. Check out the utility functions for easily obtaining the correct addresses and contracts when integrating into your project.

Limitations

There are a few limitations to be aware of when first getting started.

  • A Flash Mint contract can only mint or redeem an exact amount of Set token. The SDK currently does not support finding these amounts e.g., compared to other quotes. You're welcome to contact us and we can walk you through how we do it in our frontend.
  • (Set) tokens must be approved on the contracts before they can be used with any of the contract's functions. Use `approveSetToken`, `approveToken` or `approveTokens`. This functionality is currently not available through the SDK but can be easily executed via a block explorer like Etherscan.

Quick Install

The library is hosted on npm. Installing is as easy as:

$ npm i @indexcoop/flash-mint-sdk
or
$ yarn add @indexcoop/flash-mint-sdk


Using Flash Mint SDK

The Flash Mint SDK currently supports two use cases: retrieving quotes and facilitating the issuance/redemption of an index token. This functionality is accessible across all deployed FlashMint contracts.

The GitHub repository is the best resource on how to use the SDK. Here is an example of how to get a quote for minting MVI and sending the transaction. As you can see it’s only a few lines. We use ethers.js but this should be equally simple for viem/wagmi.

import { QuoteToken, FlashMintQuoteProvider } from '@indexcoop/flash-mint-sdk'
// Input/output token should be of type QuoteToken with the following properties
const inputToken: QuoteToken = {
 symbol: 'ETH',
 decimals: 18,
 address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
}
const outputToken: QuoteToken = {
 symbol: 'MVI',
 decimals: 18,
 address: '0x72e364F2ABdC788b7E918bc238B21f109Cd634D7',
}
const rpcProvider = new JsonRpcProvider('')
const quoteProvider = new FlashMintQuoteProvider(rpcProvider)
const quote = await quoteProvider.getQuote({
 isMinting: true,
 inputToken,
 outputToken,
 indexTokenAmount: wei(1),
 slippage: 0.1,
})
let tx = quote.tx
const gasEstimate = await provider.estimateGas(tx)
tx.gasLimit = gasEstimate
const res = await signer.sendTransaction(tx)
console.log(res.hash)


Integrate Flash Mint Today

Thank you for exploring FlashMintSDK Version 2! We've made it easier than ever for development teams to seamlessly integrate Flash Mint into their applications, fostering more cost-efficient trades. We're eager to hear your feedback and discover how Flash Mint enhances your protocol and benefits your users. If you have any questions or need support with the integration, don't hesitate to reach out.

To discuss partnership opportunities, email Jordan Tonani: institutions@indexcoop.com. For any technical questions, feel free to reach out to JD, jann@indexcoop.com, or our engineering team via our channel #product-support on Discord.

Find out more under: https://github.com/IndexCoop/flash-mint-sdk

https://www.npmjs.com/package/@indexcoop/flash-mint-sdk

The SDK is licensed under MIT. Copyright © 2023 Index Coop.

Disclaimer: This content is for informational purposes only and is not legal, tax, investment, financial, or other advice. You should not take, or refrain from taking, any action based on any information contained herein, or any other information that we make available at any time, including blog posts, data, articles, links to third-party content, discord content, news feeds, tutorials, tweets, and videos. Before you make any financial, legal, technical, or other decisions, you should seek independent professional advice from a licensed and qualified individual in the area for which such advice would be appropriate. This information is not intended to be comprehensive or address all aspects of Index or its products. There is additional documentation on Index’s website about the functioning of Index Coop, and its ecosystem and community.

You shall not purchase or otherwise acquire any of our token products if you are: a citizen, resident (tax or otherwise), green card holder, incorporated in, owned or controlled by a person or entity in, located in, or have a registered office or principal place of business in the U.S. (a “U.S. Person”), or if you are a person in any jurisdiction in which such offer, sale, and/or purchase of any of our token products is unlawful, prohibited, or unauthorized (together with U.S. Person, a “Restricted Person”).  The term “Restricted Person” includes, but is not limited to, any natural person residing in, or any firm, company, partnership, trust, corporation, entity, government, state or agency of a state, or any other incorporated or unincorporated body or association, association or partnership (whether or not having separate legal personality) that is established and/or lawfully existing under the laws of, a jurisdiction in which such offer, sale, and/or purchase of any of our token products is unlawful, prohibited, or unauthorized).  You shall not resell or otherwise transfer any of our token products to any Restricted Person. The transfer or resale of any of our token products to any Restricted Person is not permitted. Click here to view the list of Tokens Restricted for Restricted Persons. You shall read the Terms of Service and use our Website in compliance with the Terms of Service.

Recent Posts