Smart Contracts

Source Code & Audits

Environment

Most of UR's core functionalities, including account management and card operations, are deployed and executed exclusively on the Mantle Network. Interactions with other chains (such as Ethereum, Arbitrum, Base, and Monad) are only required for specific features like Deposit and Cash to Crypto.

For deployment, we recommend using QuickNodearrow-up-right or Alchemyarrow-up-right as your RPC provider.

Mantle Mainnet

  • Chain ID: 5000

  • RPC Endpoint: https://rpc.mantle.xyz

Mantle Sepolia Testnet

  • Chain ID: 5003

  • RPC Endpoint: https://rpc.sepolia.mantle.xyz

Chain Explorers

Functions

Account

Our account model is based on the ERC721 NFT standard; each user has a unique UR ID (Token ID) that identifies and manages their assets and permissions on the UR platform. The user's KYC status is recorded in the contract's status mapping, with each status corresponding to a numeric value as follows:

Contract Addresses

Methods

Function Name
Description

ownerOf

Query EVM wallet address by URID.

tokenOfOwnerByIndex

Query URID by EVM wallet address. This ERC721Enumerable method returns the token ID owned by an address at a given index. Since each user should hold one Account NFT, use index = 0 to get the user's URID.

status

Status: KYC passed, status is Live. Functions for non-Live statuses are restricted. SoftBlocked, // 1 Tourist, // 2 Blocked, // 3 Closed, // 4 Live // 5

limit

Query user monthly transaction limit by URID. All outgoing Fiat transactions count towards this limit. For KYC-verified users, the default monthly limit is 100,000 CHF. Returns usedLimit (uint256), clientLimit (uint256), startLimitDate (uint256). Users receive a spending limit that refreshes every 30 days. - usedLimit (uint256): Amount of the limit already used in the current 30-day cycle. This value is reset every 30 days. - clientLimit (uint256): Total allowed limit for the current 30-day period. - startLimitDate (uint256): Timestamp of the last limit reset (start time of the current 30-day cycle).

ABI

Fiat24Account.solarrow-up-right

Example: Get URID by Wallet Address (TypeScript + viem)

Fiat Balance

Contract Addresses

Methods

Method
Description

balanceOf

Query a user's fiat token balance by their address.

decimals

Precision of the token. For example, if decimals equals 2, a balance of 505 tokens should be displayed to a user as 5.05 (505 / 10 ** 2).

allowance

This function can be used to query the amount a user has approved for a given spender. Generally, for an unlimited approval, we call the approve method with value set to the maximum of uint256, i.e. 2^256-1.

ABI

Fiat24Token.solarrow-up-right

Example: Get Balance (TypeScript + viem)

Money Transfer

Contract Addresses

Contract refers to the currency contracts.

Methods

Note: Only users in Live status (status == 5) are allowed to transfer their fiat tokens out in any form.

Method
Description

transfer

Transfer fiat token to any EVM address.

transferByAccountId

Transfer fiat tokens to the target user by their URID.

clientPayout

User to transfer their currency out via bank transfer to a UR-supported bank account. Before the user calls this contract function, a payout account (contactId) must be created through UR's API (The API is coming soon).

Example: Transfer Fiat (TypeScript + viem)

Money Exchange

Also known as foreign-exchange conversion, used for exchanging between fiat currencies.

Contract Addresses

Methods

Note: Only users in Live status (status = 5) are allowed to do money exchange.

Method
Description

moneyExchangeExactIn

Exchange between 2 currencies

getExchangeRate

Query the exchange rate between two specified currency token addresses.

ABI

Fiat24CryptoRelay.solarrow-up-right

Example: Money Exchange (TypeScript + viem)

This process involves two steps:

  1. Query the current exchange rate using getExchangeRate.

  2. Execute the exchange using moneyExchangeExactin.

Deposit (Off-ramp)

Contract Addresses

Methods

Note: Only users with status Live (5) or SoftBlocked (1) can perform deposit(off-ramp) transactions.

Method
Description

depositTokenViaUsdc

The user deposits USDC into the contract and receives fiat currency in their UR account.

depositTokenViaAggregator

Supports users depositing a specific crypto asset and receiving fiat currency in their UR account. The prerequisite is that the frontend must integrate a DEX/aggregator API(API is coming soon) and construct the Crypto → USDC swap as calldata.

ABI

Fiat24CryptoDeposit.solarrow-up-right

Onramp

Contract Addresses

Network
Mainnet
Testnet

Arbitrum/Base/Ethereum/BSC

0xAACe017F0a6Bb9890E449d5b27fbcA9C440b81e9

Methods

ABI

BufferPool.solarrow-up-right

Card

Contract Addresses

Contract refers to the currency contracts.

Spender Contract (Card Authorization):

Methods

To use the UR debit card, users must authorize the Spender Contract to spend their Fiat or USDe balance via approve or permit methods.

Method
Description

approve / permit

Authorize the Spender Contract to spend funds. The debit card payments are booked by the Spender contract via the authorize() function. Therefore, the card owner needs to approve a certain limit to the Spender contract for future card spendings. Supported Assets: - Fiat Tokens: Users must approve the corresponding Fiat token contract. - USDe: Users can also authorize USDe directly for consumption. Usage Notes: - Enable Authorization: It is common practice to approve the maximum uint256 value (2^256 - 1) to ensure uninterrupted service. - Revoke Authorization: To cancel the authorization, call the approve method with an amount of 0.

ABI

Fiat24Token.solarrow-up-right

Card Transaction Flow

Card Transaction Flow

Last updated