Skip to main content

Contract Interface Reference

Flat technical reference for all state variables, functions, and events of the Settlement Contract. For normative definitions see SSF-SPEC-001, Sections 10–13.


State Variables

VariableTypeDescription
baseFeeAmountuint256Minimum absolute fee (in token units) charged on every transfer.
maxAcquiringFeeuint256Maximum acquiring fee percentage an acquirer may configure. Enforced at registration and update.
balancesmapping(address => mapping(address => uint256))Internal balances: token → participant → amount.
usedHashesmapping(bytes32 => bool)Registry of consumed Binding Signature digests. true = already processed, MUST revert.
acquirerWalletsmapping(bytes16 => address)Maps Acquirer ID (UUID) to wallet address.
acquiringFeePercentmapping(address => uint256)Maps acquirer wallet address to configured fee percentage.
acquiringAllowedTokensmapping(IERC20Permit => bool)Set of tokens accepted for acquirer registration payments.
acquiringPriceuint256Token units required to register as a new Acquirer.

Functions

transferWithPermit

function transferWithPermit(
IERC20Permit token,
address tokenOwner,
uint256 amount,
uint256 deadline,
uint8 v1, bytes32 r1, bytes32 s1,
uint8 v2, bytes32 r2, bytes32 s2,
address recipient,
bytes32 ref
) external
ParameterTypeDescription
tokenIERC20PermitERC-2612-compliant stablecoin to transfer from.
tokenOwneraddressToken holder whose permit authorises the transfer.
amountuint256Total amount inclusive of fees. Must equal value in the signed permit.
deadlineuint256Permit expiry timestamp. Forwarded to token.permit().
v1, r1, s1signaturePermit Signature — validated by the ERC-2612 token contract.
v2, r2, s2signatureBinding Signature — validated by the Settlement Contract.
recipientaddressBeneficiary address. Receives principal after fee deduction.
refbytes3232-byte field: 16-byte Order Reference || 16-byte Acquirer ID.

Reverts if: digest of Binding Signature in usedHashes · Binding Signature signer not authorised · deadline ≤ block.timestamp · token.permit() reverts · tokenOwner balance less than amount.

Emits: PermittedTransfer · CommissionGenerated (if acquirer fee applies).


buyAcquiringPack

function buyAcquiringPack(
IERC20Permit token,
address payer,
address acquiring,
uint256 feePercent,
uint256 price,
uint256 deadline,
uint8 v1, bytes32 r1, bytes32 s1,
uint8 v2, bytes32 r2, bytes32 s2
) public
ParameterTypeDescription
tokenIERC20PermitToken for registration fee. Must be in acquiringAllowedTokens.
payeraddressToken holder paying the fee. May differ from acquiring.
acquiringaddressWallet to register as Acquirer. Must not already be registered.
feePercentuint256Acquiring fee percentage. Must not exceed maxAcquiringFee.
priceuint256Registration fee in token units. Must equal current acquiringPrice.
deadlineuint256Permit expiry timestamp.
v1, r1, s1signaturePermit Signature — validated by the ERC-2612 token contract.
v2, r2, s2signatureBinding Signature — validated by the Settlement Contract.

Reverts if: token not in acquiringAllowedTokens · feePercent exceeds maxAcquiringFee · priceacquiringPrice · acquiring already registered · Binding Signature digest in usedHashes · Binding Signature signer not authorised · token.permit() reverts · payer balance less than price.

Emits: AcquirerCreated.


calculateFees

function calculateFees(
uint256 amount,
bytes16 acquirerId
) public view returns (uint256 totalFee)
ParameterTypeDescription
amountuint256Principal amount the beneficiary should receive, in token units.
acquirerIdbytes16Acquirer ID. Pass Zero-UUID if no acquirer.

Returns: totalFee — the fee to add to amount to get the correct PermitParams.value.


breakdownTransferAmount

function breakdownTransferAmount(
uint256 totalWithFees,
bytes16 acquirerId
) public view returns (uint256 principalAmount, uint256 totalFees)
ParameterTypeDescription
totalWithFeesuint256Total inclusive of fees. The permit value.
acquirerIdbytes16Acquirer ID. Pass Zero-UUID if no acquirer.

Returns: principalAmount — credited to beneficiary; totalFees — distributed to processor and acquirer.


getBalances (single token)

function getBalances(
address token,
address[] calldata users
) external view returns (uint256[] memory)

Returns internal balances for multiple participants in one token. Response array is parallel to users.


getBalances (multi-token overload)

function getBalances(
address[] calldata tokens,
address[] calldata users
) external view returns (uint256[][] memory)

Returns balances[i][j] = internal balance of users[j] for tokens[i].


getAcquiringWallet

function getAcquiringWallet(
bytes16 acquirerId
) public view returns (address)

Returns the wallet address registered under acquirerId, or the zero address if not registered.


Events

PermittedTransfer

Primary event for session reconciliation. orderReference MUST match the ref submitted in TransferRequest.

event PermittedTransfer(
bytes32 indexed domainSeparator,
address indexed token,
address indexed payer,
address recipient,
uint256 value,
uint256 fee,
bytes32 orderReference
)
ParameterDescription
domainSeparatorEIP-712 domain separator of the ERC-2612 token.
tokenToken contract address.
payerToken owner whose permit authorised the transfer.
recipientBeneficiary address that received the principal.
valuePrincipal amount credited to recipient, in token units.
feeTotal fees deducted, in token units.
orderReference32-byte field: 16-byte Order Reference || 16-byte Acquirer ID.

AcquirerCreated

event AcquirerCreated(
bytes16 indexed acquirerId,
address indexed wallet,
uint256 feePercent
)
ParameterDescription
acquirerIdThe bytes16 UUID assigned to the new Acquirer.
walletThe registered Acquirer wallet address.
feePercentThe acquiring fee percentage.

CommissionGenerated

event CommissionGenerated(
bytes16 indexed acquirerId,
uint256 amount
)
ParameterDescription
acquirerIdThe Acquirer ID that earned the commission.
amountCommission credited to the Acquirer, in token units.

AcquiringFeeUpdated

event AcquiringFeeUpdated(
address indexed acquiring,
uint256 feePercent
)

Withdrawal

event Withdrawal(
address indexed owner,
address indexed beneficiary,
uint256 amount
)