Skip to main content
After this page, you know what a Safe needs before a rule can pay a bank account, which steps are on chain, which go through the Anafi API, and how to follow the orders. The off_ramp action redeems EURe for a SEPA transfer through Monerium: Monerium burns the EURe from the Safe and pays the same amount in euros to the bank account that the rule names.
Bank payouts work only on polygon-amoy today, with the Monerium sandbox. The engine refuses off_ramp on every other network, and for an account that is not a Safe. The /api/monerium/* routes are served only on https://api.polygon-amoy.ana.fi.

Preconditions

Overview

Steps

1

Install the handler and write the policy

One Safe transaction with two calls to the Safe itself, in this order:
  1. Safe.setFallbackHandler(handler);
  2. Safe.setOffRampPolicy(terms). The Safe has no such function, so it forwards the call to its new fallback handler, which stores the policy for this Safe.
terms is OffRampPolicyTerms:Send the batch with executeSafeOwnerCalls({ safe, eoa, legs }). Each leg is { target: safe, calldata }. Anafi relays these two calls when it relays owner operations of the Safe; else the owner sends the transaction. See Safe account for the prompts.Read the policy with offRampPolicyOf(safe) on the handler. It returns the IBANs as keccak256 hashes.
2

Link the Safe to Monerium

  1. The owner signs the EIP-712 SafeMessage of the Safe (domain { chainId, verifyingContract: safe }, message hashMessage("I hereby declare that I am the address owner.")). This is a typed-data prompt. Nothing goes on chain.
  2. The browser sends POST /api/monerium/connect with { aaAddress, addressLinkSignature } and credentials. The Anafi API asks the Safe, through ERC-1271, whether it accepts the signature. The answer is { authorizeUrl }, and a cookie that binds the flow to this browser.
  3. The browser opens authorizeUrl. Monerium returns the browser to the callback of the Anafi API, which redirects to a return address that the deployment sets, with ?monerium=connected or ?monerium=error&reason=....
Today, the Anafi API hosts answer CORS only for https://app.ana.fi, and the flow is bound to the browser that started it. Do the link step in the Anafi dapp.
3

Read the link status

GET /api/monerium/status/{safe} needs no sign-in. It returns:To read the full IBAN and BIC of the Safe, an owner signs (sign-in message prompt, personal_sign) the text Anafi: show the bank account details of <Safe checksum address> on chain <chainId>. and a second line Valid until: <unix seconds>, then you send POST /api/monerium/bank-details with { aaAddress, validUntil, signature }. validUntil must lie in the next 10 minutes. Answers: { iban, bic }, 400 (bad validUntil or signature), 403 (the signer is not an owner), 404 (no link), 503.
4

Commit a rule with an off_ramp action

value is an amount of EURe in whole cents, or a share of an EURe trigger value. to names a person (first_name and last_name) or a company (company_name). memo has 5 to 140 characters. global.iban_allowlist can bound the IBANs of the document. See Actions.The SDK builders emit this action for a payee with a bank field (buildRoutingDsl, buildStandingOrderDsl). Stage and commit as for any Safe document.

When the rule fires

The engine signs an order for the Safe. Monerium asks the Safe, through ERC-1271, whether it accepts the order. The off-ramp handler answers against the policy of the Safe. See Off-ramp handler for each check. A Safe that installs another fallback handler stops each order until it installs the off-ramp handler again.

Follow the orders

GET /api/wallets/{safe}/off-ramp/orders needs no sign-in. It returns the orders newest first. Each row has seq, orderId, status, amount, currency, maskedIban, providerOrderId, providerState, lastError, firedAt, signedAt and updatedAt. The Anafi fee of a bank payout shows in the activity feed as a row with kind: "off_ramp_fee". See Execution.

Switch it off

Example