Universal EVM Funding Protocol

The Immersve Universal EVM funding protocol allows client applications to fund Immersve cards via simple ERC-20 transfers. Depositors can withdraw funds at any time with signed withdrawal approvals. Depositor funds can only be settled to Immersve’s approved settlement address. Deposits are scoped to the client application that registers the Funds Storage contract as an Immersve Funding Channel.

Smart Contract

The Universal EVM protocol has a master "Funds Manager" contract and many partner "Funds Storage" contracts.

Source

https://github.com/immersve/funding-contract-universal-evm

Deployed Contract Addresses

The Universal EVM protocol is designed to work on any EVM. The deployed contract addresses for supported EVM networks are listed below.

Mainnet Deployments

Testnet Deployments

Smart Contract Overview

The master contract is the main entry point and is a factory for the Funds Storage contracts. Funds Storage contracts pool together all deposits scoped to an integrated partner application. The master contract is also used by Immersve for performing settlements and refunds.

Component Diagram
Universal EVM smart contract component diagram.

Deposits are performed by sending ERC-20 transfers to the partner Funds Storage contract.

Funds Flow Diagram
Universal EVM funds flow diagram.

Protocol Mechanics

Deposits

Depositors can send ERC-20 transfers directly to the Funds Storage address. Each depositor address needs to have a Funding Source created that is linked with the Funding Channel by calling the Create Funding Source endpoint. After an ERC-20 transfer transaction is confirmed, the connected Funding Source will be credited to the customer funding source to use with a card.

The Get Spending Prerequisites endpoint can be used to reliably obtain the Web3 transaction parameters for depositing into a Funding Source.

When a Funding Source is created, any deposits made before the creation of the Funding Source associated with the depositing address will be credited immediately.

Withdrawals

Withdrawals are approved by the Immersve platform and executed by calling the withdraw() function on the partner Funds Storage contract. The signed withdrawal approval, and all other parameters required for submitting the withdrawal transaction to the EVM chain, are obtained by calling the Create Withdrawal Intent endpoint. See Card Funding for more details.

Partner Setup

Creating a Partner Funds Storage Instance

A partner Funds Storage instance needs to be created for each token you wish to support. It only needs to be deployed once for all depositors. The address of the created Funds Storage will need to be supplied when Creating a Funding Channel.

To create the partner Funds Storage instance, invoke the createFundsStorage(address, string) function on the master Funds Manager contract. Find the master contract address for your target chain from "Contract Addresses" above. The params have the following semantics:

token (address): The address of the ERC-20 token that will be used to fund your cardholders' cards. See Supported Tokens for possible values.

name (string): The name of the deployed contract. This is used only for debugging purposes and must be globally unique. Using your app name, token name , and "liveness" in the name are recommended, for example: "Acme Wallet USDC Live".

The address of the deployed Funds Storage instance can be discovered from the EVM transaction logs. In a block explorer, find the FundsStorageCreated event within the logs for the transaction that created the Funds Storage instance. Use the created funds storage address as the storageAddress when calling the Create Funding Channel endpoint.