Get the code
Clone the repository to follow along.
Bank
Deploys contracts, mints tokens, manages roles, and sets the FX rate for each payment
Sender
Initiates payments in the source currency (e.g., iEUR)
Receiver
Receives funds in the destination currency (e.g., iAUD)
- The Sender initiates a payment, specifying the receiver and amount in iEUR
- The Bank sets the conversion rate (how much iAUD the receiver gets)
- The Sender executes the payment. iEUR is burned from the sender and iAUD is minted to the receiver
Prerequisites
- Clone the cross-border-payments solution
- Create a DFNS organization if you don’t have one already, and note the organization id
- Create a service account for API access (see the service account guide)
- Create 3 wallets: Bank, Sender and Receiver on an EVM-compatible network (e.g.: Ethereum Sepolia)
- Fund the Bank and Sender wallets with Testnet ETH for gas fees (see using testnets)
- Make sure you have installed Node.js v18+
Project Structure
Configuration
1
Clone and install
2
Set up environment variables
Copy the example environment file and fill in your values:
.env
3
Compile contracts
Deploy the System
- Deploys iEUR (source stablecoin)
- Deploys iAUD (destination stablecoin)
- Deploys the CrossBorderPayment contract
- Transfers iAUD ownership to the payment contract (so it can mint on settlement)
- Mints 1000 iEUR to the Sender wallet
End-to-End Payment Flow
1
Grant the MINTER_ROLE to the CrossBorderPayment contract
The payment contract needs permission to mint iAUD when settling payments:
2
Initiate a payment (Sender)
The sender initiates a 100 iEUR payment to the receiver. This approves the token transfer and calls Note the Payment ID from the output.
initPayment in one step:3
Set the FX rate (FX Provider)
The FX provider sets how much iAUD the receiver will get. For example, 150 iAUD for 100 iEUR (1.5x rate):
4
Execute the payment (Sender)
The sender confirms and executes the payment. This burns iEUR from the sender and mints iAUD to the receiver:
5
Verify balances
- Sender: 900 iEUR (100 burned)
- Receiver: 150 iAUD (150 minted)