OmniTransfers

OmniTransfers make possible the execution of multiple ERC20 or native token transfers to multiple recipients in the same transaction. Accesible from transfer.omnify.finance and app.omnify.finance/transfers

Visualization of how the OmniTransfer contract functions

Conduct Transfers

Calling the OmniTransfers contract to conduct a set of transfers is simple. Start by downloading the OmniTransfers interface found in our github repo. Before getting into making a call, let's talk about the conductTransfers payable function which takes ParamTransfer[] as its only parameter, that array can be of any length.

ParamTransfer: A single transfer

ParamTransfer is the struct contained in the array passed as a parameter to conductTransfers , it represents a single transfer.

Calculating msgValue based on transfers and their fees

Omnify charges a fee for each transfer it processes, so we need to make sure the total amount of msgValue includes the total value of native tokens being transferred in all the transfers (if any), and total value of fees charged from each transfer. You can find a list of all Omnify services' tiers and fees at omnify.finance/fees.

Steps to reproduce

1

Define OmniTransfers variable

2

Define a ParamTransfer[] variable

This will contain all the transfers you wish to conduct.

3

Add your transfers as ParamTransfer struct to the paramTransfers array

We use address(0) for the asset if we wish to transfer the native token, and the contract address if the asset is an ERC20 token.

4

Get the altcoin & tier fees

Call altcoinFee() and tier1(), tier2(), tier3(), tier4()

5

Define a variable msgVal

This will be the msg.value of the conductTransfers function call.

6

Match fee tiers

Run a for loop for the array of ParamTransfer you defined to add transfer values and fee values to msgVal:

7

Call conductTransfers

We have conducted our first multisending transaction with OmniTransfers. 🎉

Last updated