Inspiration

I got inspired by disperse.app , an app to send erc20 tokens to multiple addresses on one transaction. Once i saw this app , I wondered how many erc721 tokens can be sent in a single transaction and got down to business.

What it does

What this application does is to allow the user to write the contract address of an NFT and , in case of being an ERC721 , it allows to enter a list of addresses and tokens and send all the tokens to the specified addresses in a single transaction once the user has approved the allowance to the smart contract.

How we built it

This application has been built using React.js as a javascript framework, MaterialUI as a CSS framework for the client. The backend is a blockchain and in this case is Polygon (both Mumbai and POS), an Smart Contract has been developed using Solidity and Truffle. Tests and helpers has been done in Javascript and Typescript.

The Smart Contract consists in a function that accepts as an argument an nft address, a list of address and a list of integers (token ids), a loop is used to iterate the list and execute each transfer using transferFrom. This is the most eficient way to do an airdrop without hardcoding anything on the contract.

Challenges we ran into

  • How to allow the smart contract to send all the tokens in one transaction

I didn't know how to set the allowance for all the tokens, with ERC20 you can approve the amount of tokens you want to send preventing hacks using delegatecall and exploiting the allowance for the contract but the ERC721 standard has the setApprovalForAll function that allows a user to approve all of his tokens to a smart contract.

  • Gas optimization

I wanted to send as many tokens as possible and for this i was in need to try different approaches to the multisend/airdrop functionality and study how many opcodes were used by each approach and which one the most efficient.

  • Multichain client

Web3 integrations and middleware are sometimes hard to work on and dealing not only with one chain but with more than one chain made me think on how to make my app multichain without the user noticing any change between chains.

Accomplishments that we're proud of

What we learned

I've learned a lot of advanced topics like gas optimization, encapsulation of multiple transfers in one transaction, to integrate a smart contract into a client, to use React along a CSS framework and web3 libraries. I also improved my skills to make my software free and open source.

What's next for Disperse721

I'd like to deploy the smart contract in many chains as possible. The next chains to deploy are:

  • Ethereum
  • Binance
  • Moonriver
  • Moonbeam

Including the testnets!

I'd also like to add more features to the client app and improve the notification system.

Share this project:

Updates