Gateway

Gateway Contract Interfaces and Events

Learn about the Circle Gateway smart contracts

The wallet and minter smart contracts have a set of interfaces and events that you can use to build with Circle Gateway. This page describes the user-facing methods of these contracts.

This section provides information on the public methods of the GatewayWallet and GatewayMinter smart contracts. The full ABIs are available on GitHub.

Deposit tokens after approving this contract for the token. The resulting balance belongs to the function caller.

Solidity
function deposit(address token, uint256 value) external;

Parameters

NameTypeDescription
tokenaddressThe address of the token to deposit
valueuint256The amount of tokens to deposit

Deposit tokens on behalf of another address after approving this contract for the token. The resulting balance belongs to the address specified by the depositor parameter, not the function caller.

Solidity
function depositFor(address token, address depositor, uint256 value) external;

Parameters

NameTypeDescription
tokenaddressThe address of the token to deposit
depositoraddressThe address that should own the resulting balance
valueuint256The amount of tokens to deposit

Deposit tokens with an EIP-2612 permit. The resulting balance belongs to the owner specified in the permit. The permit's spender must be the address of the GatewayWallet contract. The full permitted value is always deposited.

Solidity
function depositWithPermit(address token, address owner, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;

Parameters

NameTypeDescription
tokenaddressThe address of the token to deposit
owneraddressThe depositor's address
valueuint256The amount of tokens to deposit
deadlineuint256The unix timestamp at which the signature expires, or max uint256 value to signal no expiration
vuint8v of the signature
rbytes32r of the signature
sbytes32s of the signature

Deposit tokens with an EIP-2612 permit (using the EIP-7597 extension), passing the signature as bytes to allow for SCA deposits. The resulting balance belongs to the owner specified in the permit. The permit's spender must be the address of the GatewayWallet contract. The full permitted value is always deposited. EOA wallet signatures should be packed in the order of r, s, v.

Solidity
function depositWithPermit(address token, address owner, uint256 value, uint256 deadline, bytes calldata signature) external;

Parameters

NameTypeDescription
tokenaddressThe address of the token to deposit
owneraddressThe depositor's address
valueuint256The amount of tokens to deposit
deadlineuint256The unix time at which the signature expires, or max uint256 value to signal no expiration
signaturebytesSignature bytes signed by an EOA wallet or a contract wallet

Deposit tokens with an ERC-3009 authorization. The resulting balance in this contract belongs to the from specified in the authorization. The authorization's to must be the address of the GatewayWallet contract.

Solidity
function depositWithAuthorization(address token, address from, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 nonce, uint8 v, bytes32 r, bytes32 s) external;

Parameters

NameTypeDescription
tokenaddressThe address of the token to deposit
fromaddressThe depositor's address
valueuint256The amount of tokens to deposit
validAfteruint256The unix timestamp after which the authorization is valid
validBeforeuint256The unix timestamp before which the authorization is valid
noncebytes32Unique nonce
vuint8v of the signature
rbytes32r of the signature
sbytes32s of the signature

Deposit tokens with an ERC-3009 authorization (using the ERC-7598 extension), passing the signature as bytes to allow for SCA deposits. The resulting balance in this contract belongs to the from specified in the authorization. The authorization's to must be the address of this contract. The transfer will be done via receiveWithAuthorization. EOA wallet signatures should be packed in the order of r, s, v.

Solidity
function depositWithAuthorization(address token, address from, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 nonce, bytes calldata signature) external;

Parameters

NameTypeDescription
tokenaddressThe address of the token to deposit
fromaddressThe depositor's address
valueuint256The amount of tokens to deposit
validAfteruint256The unix timestamp after which the authorization is valid
validBeforeuint256The unix timestamp before which the authorization is valid
noncebytes32Unique nonce
signaturebytesSignature bytes signed by an EOA wallet or a contract wallet

Returns the total balance of a depositor for a given token. This will always be equal to the sum of availableBalance and withdrawingBalance.

Solidity
function totalBalance(address token, address depositor) public view returns (uint256);

Parameters

NameTypeDescription
tokenaddressThe address of the token to check
depositoraddressThe depositor to check

Returns

NameTypeDescription
<none>uint256The total balance of the depositor for the token

Returns the balance that is available to the depositor, subject to deposits being observed by Circle in a finalized block and excepting in-flight transfers.

Solidity
function availableBalance(address token, address depositor) public view returns (uint256);

Parameters

NameTypeDescription
tokenaddressThe address of the token to check
depositoraddressThe depositor to check

Returns

NameTypeDescription
<none>uint256The available balance of the depositor for the token

Returns the balance that is in the process of being withdrawn from the GatewayWallet contract.

Solidity
function withdrawingBalance(address token, address depositor) public view returns (uint256);

Parameters

NameTypeDescription
tokenaddressThe address of the token to check
depositoraddressThe depositor to check

Returns

NameTypeDescription
<none>uint256The withdrawing balance of the depositor for the token

Returns the balance that is withdrawable as of the current block. This will either be 0 or withdrawingBalance.

Solidity
function withdrawableBalance(address token, address depositor) public view returns (uint256);

Parameters

NameTypeDescription
tokenaddressThe address of the token to check
depositoraddressThe depositor to check

Returns

NameTypeDescription
<none>uint256The withdrawable balance of the depositor for the token

Returns the balance of a depositor for a given token and balance type, compatible with ERC-1155. The "token" id is encoded as uint256(bytes32(abi.encodePacked(uint96(BALANCE_TYPE), address(token)))), where BALANCE_TYPE is 0 for Total, 1 for Available, 2 for Withdrawing, and 3 for Withdrawable.

Solidity
function balanceOf(address depositor, uint256 id) public view returns (uint256 balance);

Parameters

NameTypeDescription
depositoraddressThe depositor to check
iduint256The packed token and balance type

Returns

NameTypeDescription
balanceuint256The balance of the depositor for the token and balance type

The batch version of balanceOf, compatible with ERC-1155. depositors and ids must be the same length. See the documentation for balanceOf for the format of ids.

Solidity
function balanceOfBatch(address[] calldata depositors, uint256[] calldata ids) external view override returns (uint256[] memory balances);

Parameters

NameTypeDescription
depositorsaddress[]The depositors to check
idsuint256[]The packed tokens and balance types

Returns

NameTypeDescription
balancesuint256[]The balances of the depositors for the tokens and balance types

Allow a delegate to transfer the caller's balance of the specified token. This acts as a full allowance for delegate on the token balance of the function caller.

Solidity
function addDelegate(address token, address delegate) external;

Parameters

NameTypeDescription
tokenaddressThe address of the token that delegate should be authorized for
delegateaddressThe address being authorized

Stop allowing a delegate to transfer the caller's balance of the specified token. This revocation is not respected for burn intents that have already been signed, so that burns cannot be prevented by removing the delegate.

Solidity
function removeDelegate(address token, address delegate) external;

Parameters

NameTypeDescription
tokenaddressThe address of the token the delegate should no longer be authorized for
delegateaddressThe address that should no longer be authorized

Returns whether an address is currently authorized to transfer tokens on behalf of a depositor.

Solidity
function isAuthorizedForBalance(address token, address depositor, address addr) public view returns (bool);

Parameters

NameTypeDescription
tokenaddressThe address of the token to check
depositoraddressThe depositor to check
addraddressThe address to check

Returns

NameTypeDescription
<none>booltrue if the address is authorized, false otherwise

Returns the number of blocks that must pass after calling initiateWithdrawal before a withdrawal can be completed.

Solidity
function withdrawalDelay() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256The number of blocks that must pass

Returns the block height at which an in-progress withdrawal is withdrawable, or 0 if there is no in-progress withdrawal.

Solidity
function withdrawalBlock(address token, address depositor) public view returns (uint256);

Parameters

NameTypeDescription
tokenaddressThe address of the token of the in-progress withdrawal
depositoraddressThe address of the depositor of the in-progress withdrawal

Returns

NameTypeDescription
<none>uint256The block number at which the withdrawal will be withdrawable

Starts the withdrawal process. After withdrawalDelay blocks, withdraw may be called to complete the withdrawal. Once a withdrawal has been initiated, that amount can no longer be used. Repeated calls will add to the amount and reset the timer.

Solidity
function initiateWithdrawal(address token, uint256 value) external;

Parameters

NameTypeDescription
tokenaddressThe address of the token to initiate a withdrawal for
valueuint256The amount to be withdrawn

Completes a withdrawal that was initiated at least withdrawalDelay blocks ago. The funds are sent to the depositor (who must be the caller of this function). The full amount that is in the process of being withdrawn is always withdrawn.

Solidity
function withdraw(address token) external;

Parameters

NameTypeDescription
tokenaddressThe address of the token to withdraw

Mint funds via a signed attestation from the Gateway API. Emits an event containing the keccak256 hash of the encoded TransferSpec (which is the same for the corresponding burn that will happen on the source domain), to be used as a cross-chain identifier and for replay protection.

Solidity
function gatewayMint(bytes memory attestationPayload, bytes memory signature) external;

Parameters

NameTypeDescription
attestationPayloadbytesThe byte-encoded attestation(s)
signaturebytesThe signature from a valid attestation signer on attestationPayload

These methods are supported by both the GatewayWallet and GatewayMinter contracts.

The domain assigned to the chain this contract is deployed on.

Solidity
function domain() public view returns (uint32);

Returns

NameTypeDescription
<none>uint32The Circle-issued identifier for the current chain

Whether or not a token is supported.

Solidity
function isTokenSupported(address token) public view returns (bool);

Parameters

NameTypeDescription
tokenaddressThe address of the token to check

Returns

NameTypeDescription
<none>booltrue if the token is supported, false otherwise

Whether or not a transfer spec hash has been used.

Solidity
function isTransferSpecHashUsed(bytes32 transferSpecHash) public view returns (bool);

Parameters

NameTypeDescription
transferSpecHashbytes32The transfer spec hash to check

Returns

NameTypeDescription
<none>booltrue if the transfer spec hash has been used, false otherwise

Whether or not a given address is denied from interacting with the contract.

Solidity
function isDenylisted(address addr) public view returns (bool);

Parameters

NameTypeDescription
addraddressThe address to check

Returns

NameTypeDescription
<none>booltrue if the address is denylisted, false otherwise

Emitted when a deposit is made. The sender will always be the same as depositor, except when a deposit is made using depositFor.

Solidity
event Deposited(address indexed token, address indexed depositor, address indexed sender, uint256 value);

Parameters

NameTypeDescription
tokenaddressThe address of the token that was deposited
depositoraddressThe address that the resulting balance is credited to
senderaddressThe address that the funds were deposited from
valueuint256The amount that was deposited

Emitted when a delegate is authorized for a depositor's balance.

Solidity
event DelegateAdded(address indexed token, address indexed depositor, address delegate);

Parameters

NameTypeDescription
tokenaddressThe address of the token that the delegate is now authorized for
depositoraddressThe depositor who added the delegate
delegateaddressThe delegate that was added

Emitted when a delegate's authorization is revoked.

Solidity
event DelegateRemoved(address indexed token, address indexed depositor, address delegate);

Parameters

NameTypeDescription
tokenaddressThe address of the token the delegate is no longer authorized for
depositoraddressThe depositor who removed the delegate
delegateaddressThe delegate that was removed

Emitted when a withdrawal is initiated.

Solidity
event WithdrawalInitiated(
    address indexed token,
    address indexed depositor,
    uint256 value,
    uint256 remainingAvailable,
    uint256 totalWithdrawing,
    uint256 withdrawalBlock
);

Parameters

NameTypeDescription
tokenaddressThe address of the token that is being withdrawn
depositoraddressThe owner of the funds being withdrawn
valueuint256The value that was added to the in-progress withdrawal
remainingAvailableuint256The remaining available balance after the withdrawal
totalWithdrawinguint256The total value that is now being withdrawn
withdrawalBlockuint256The block number at which the full withdrawal can be completed

Emitted when a withdrawal is completed and funds have been transferred to the depositor.

Solidity
event WithdrawalCompleted(address indexed token, address indexed depositor, uint256 value);

Parameters

NameTypeDescription
tokenaddressThe address of the token that was withdrawn
depositoraddressThe owner of the withdrawn funds
valueuint256The value that was withdrawn

Emitted when Circle burns tokens that have been minted on another domain

Solidity
event GatewayBurned(
    address indexed token,
    address indexed depositor,
    bytes32 indexed transferSpecHash,
    uint32 destinationDomain,
    bytes32 destinationRecipient,
    address signer,
    uint256 value,
    uint256 fee,
    uint256 fromAvailable,
    uint256 fromWithdrawing
);

Parameters

NameTypeDescription
tokenaddressThe address of the token that was burned
depositoraddressThe depositor who owned the balance
transferSpecHashbytes32The keccak256 hash of the TransferSpec
destinationDomainuint32The domain the corresponding attestation was used on
destinationRecipientbytes32The recipient of the funds at the destination
signeraddressThe address that authorized the transfer
valueuint256The value that was burned
feeuint256The fee charged for the burn
fromAvailableuint256The value burned from the available balance
fromWithdrawinguint256The value burned from the withdrawing balance

Emitted when an attestation is used.

Solidity
event AttestationUsed(
    address indexed token,
    address indexed recipient,
    bytes32 indexed transferSpecHash,
    uint32 sourceDomain,
    bytes32 sourceDepositor,
    bytes32 sourceSigner,
    uint256 value
);

Parameters

NameTypeDescription
tokenaddressThe address of the token that was minted
recipientaddressThe recipient of the funds
transferSpecHashbytes32The keccak256 hash of the TransferSpec, shared with the burn intent
sourceDomainuint32The domain the funds came from
sourceDepositorbytes32The depositor on the source domain
sourceSignerbytes32The signer that authorized the transfer
valueuint256The amount that was minted

These events are emitted by both the GatewayWallet and GatewayMinter contracts.

Emitted when an address is added to the denylist.

Solidity
event Denylisted(address indexed addr);

Parameters

NameTypeDescription
addraddressThe address that is now being denied from interacting with the contract

Emitted when an address is removed from the denylist.

Solidity
event UnDenylisted(address indexed addr);

Parameters

NameTypeDescription
addraddressThe address that is allowed to interact with the contract again

Emitted when a token is added to the set of supported tokens.

Solidity
event TokenSupported(address token);

Parameters

NameTypeDescription
tokenaddressThe address of the token that is now supported
Did this page help you?
© 2023-2025 Circle Technology Services, LLC. All rights reserved.