deposit
Deposit
event with the sender’s address on L1, the recipient’s address on L2, and the amountexternal
payable
address token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 l2Recipient | The L2 address of the recipient. |
Deposit
Event attributes
address indexed sender | The L1 address of the account that sent the deposit. |
address indexed token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 indexed l2Recipient | The L2 address of the recipient. The L2 address of the recipient. |
uint256 nonce | The nonce for the L1 transaction. |
uint256 fee | The Starknet fee sent with the transaction. |
StarknetTokenBridge.sol
deposit
Deposit
depositCancelRequest
depositReclaim
function.
The depositReclaim
function can only be used once for any deposit cancellation request.
external
nonpayable
address token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 l2Recipient | The L2 address of the recipient. |
uint256 nonce | The nonce of the deposit. |
DepositCancelRequest
Event attributes
address indexed sender | The L1 address of the account that sent the deposit. |
address indexed token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 indexed l2Recipient | The L2 address of the recipient. The L2 address of the recipient. |
uint256 nonce | The nonce of the deposit. |
StarknetTokenBridge.sol
depositCancelRequest
DepositCancelRequest
depositReclaim
depositCancelRequest
function.
external
nonpayable
address token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 l2Recipient | The L2 address of the recipient. |
uint256 nonce | The nonce of the deposit. |
DepositReclaimed
Event attributes
address indexed sender | The L1 address of the account that sent the deposit. |
address indexed token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 indexed l2Recipient | The L2 address of the recipient. The L2 address of the recipient. |
uint256 nonce | The nonce of the deposit. |
StarknetTokenBridge.sol
depositReclaim
DepositReclaimed
depositWithMessage
deposit
, with a message attached.
With this function, a deposit transaction can trigger subsequent actions. For example, you can deposit funds and include a message to transfer those funds to another address. depositWithMessage
lets you execute these two separate transactions with a single user action.
After depositing to another recipient, the L1 handler in token_bridge.cairo
calls the on_receive
function in the contract of the recipient.
If on_receive
returns true
, then the on_receive
function succeeded. If it returns false
, or if it doesn’t return any value because the on_receive
function is not implemented in the recipient contract, the operation fails and the transaction is reverted.
external
payable
address token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 l2Recipient | The L2 address of the recipient. |
uint256[] calldata message | The message attached to the deposit. |
DepositWithMessage
Event attributes
address indexed sender | The L1 address of the account that sent the deposit. |
address indexed token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 indexed l2Recipient | The L2 address of the recipient. The L2 address of the recipient. |
uint256[] message | The message attached to the deposit. |
uint256 nonce | The nonce for the L1 transaction. |
uint256 fee | The Starknet fee sent with the transaction. |
StarknetTokenBridge.sol
depositWithMessage
DepositWithMessage
depositWithMessageCancelRequest
depositWithMessage
.
Similar to depositCancelRequest
.
external
nonpayable
address token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 l2Recipient | The L2 address of the recipient. |
uint256[] calldata message | The message attached to the deposit. |
uint256 nonce | The nonce of the deposit. |
DepositWithMessageCancelRequest
Event attributes
address indexed sender | The L1 address of the account that sent the deposit. |
address indexed token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 indexed l2Recipient | The L2 address of the recipient. The L2 address of the recipient. |
uint256[] message | The message attached to the deposit. |
uint256 nonce | The nonce for the L1 transaction. |
StarknetTokenBridge.sol
depositWithMessageCancelRequest
DepositWithMessageCancelRequest
depositWithMessageReclaim
depositWithMessageCancelRequest
function.
external
nonpayable
address token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 l2Recipient | The L2 address of the recipient. |
uint256 nonce | The nonce of the deposit. |
DepositWithMessageReclaimed
Event attributes
address indexed sender | The L1 address of the account that sent the deposit. |
address indexed token | The address of the contract for the desired token. |
uint256 amount | The amount of the deposit. |
uint256 indexed l2Recipient | The L2 address of the recipient. The L2 address of the recipient. |
uint256[] message | The message attached to the deposit. |
uint256 nonce | The nonce for the L1 transaction. |
StarknetTokenBridge.sol
depositWithMessageReclaim
DepositWithMessageReclaimed
enrollTokenBridge
get_erc20_class_hash
.
external
payable
The message payload needs to include funds to cover the Starknet (L2) fee for executing this transaction. You can include this payload using a standard wrapper such as web3.js.
address token | The address of the contract for the desired ERC-20 token. |
TokenEnrollmentInitiated
enrollTokenBridge
in StarkgateManager.sol
TokenEnrollmentInitiated
in StarknetTokenBridge.sol
estimateDepositFeeWei
external
view
uint256 | An estimate of the fee, in Wei, for depositing funds to the L1 StarkGate bridge contract. |
estimateDepositFeeWei
in StarknetTokenBridge.sol
estimateEnrollmentFeeWei
enrollTokenBridge
function.
external
view
uint256 | An estimate of the fee, in Wei, for creating and registering a new bridge. |
estimateEnrollmentFeeWei
in StarknetTokenBridge.sol
getBridge
external
view
address token | The address of the contract for the desired ERC-20 token. |
address address | The address of the bridge for the specified token. |
Address(0) | The bridge does not exist. |
Address(1) | The bridge is blocked or deactivated. |
getBridge
in IStarkgateRegistry.sol
getRegistry
external
view
address | The address of the Registry contract. |
getRegistry
in StarkgateManager.sol
getStatus
external
view
address token | The address of the contract for the desired ERC-20 token. |
TokenStatus | One of the following values: 0 : Unknown. The bridge does not recognize the token. 1 : Pending. The token has been enrolled to StarkGate, but the deploy transaction has not yet successfully completed. You can deposit funds. 2 : Active. The deploy transaction for this token has completed successfully and StarkGate recognizes the token. 3 : Deactivated. The token has been removed from StarkGate. You cannot deposit funds. |
getStatus
in StarknetTokenBridge.sol
getWithdrawalBridges
external
view
address token | The address of the contract for the desired token. |
address[] memory bridges | An array of addresses of all bridges that ever serviced token . |
getWithdrawalBridges
in StarkgateRegistry.sol
.
identify
StarknetTokenBridge.sol
contract.
external
pure
string memory | The name and version of the StarknetTokenBridge.sol contract. |
identify
in StarknetTokenBridge.sol
isServicingToken
external
view
address token | The address of the contract for the desired token. |
true | The calling contract is currently providing a service for the token. |
false | The calling contract is not currently providing a service for the token. |
isServicingToken
in IStarkgateService.sol
.
withdraw
l1_recipient
parameter of the initiate_token_withdraw
function on L2.
Anyone can call this function, but only after the withdraw message has been recorded on the Starknet Core Contract.
address token | The address of the contract for the desired token. |
uint256 amount | The amount of the withdrawal. |
address recipient | (Optional) The recipient. If you don’t specify this parameter, the withdraw function uses the sender’s address. |
nonpayable
Withdrawal
Event attributes
address indexed recipient | The recipient. |
address indexed token | The address of the contract for the desired token. |
uint256 amount | The amount of the withdrawal. |
StarknetTokenBridge.sol
withdraw
Withdrawal
get_erc20_class_hash
ClassHash | The class hash of the ERC-20 token contract. |
get_erc20_class_hash
in token_bridge.cairo
.
get_identity
felt252 | The identity of StarkGate. |
get_identity
in token_bridge_interface.cairo
.
get_l1_token
l2_token_address: ContractAddress | The L2 address of the ERC-20 token contract. |
EthAddress | The L1 address of the ERC-20 token contract. |
EthAddressZeroable::zero() | The token is not found in the bridge. |
get_l1_token
in token_bridge_interface.cairo
.
get_l2_token
0
.
l1_token_address | The L1 address of the ERC-20 token contract. |
ContractAddress address | The L2 address of the ERC-20 token contract. |
ContractAddressZeroable::zero() | The token is not found in the bridge. |
get_l2_token
in token_bridge_interface.cairo
.
get_remaining_withdrawal_quota
l1_token_address | The L1 address of the ERC-20 token contract. |
u256 | The amount that can currently be withdrawn from the bridge, in units defined by the ERC-20 token contract. |
get_remaining_withdrawal_quota
in token_bridge_interface.cairo
get_version
felt252 | The current version of StarkGate. |
get_version
in token_bridge_interface.cairo
.
initiate_token_withdraw
l1_token: EthAddress | The L1 address of the ERC-20 token contract. |
l1_recipient: EthAddress | The L1 address of the recipient. |
amount uint256 | The amount to transfer. |
initiate_token_withdraw
in token_bridge_interface.cairo
.
on_receive
on_receive
function that you must provide in your L2 contract in order to enable the depositWithMessage
function to succeed.
The L2 contract that receives the message that is sent with the depositWithMessage
function must implement a callback function named on_receive
.
Upon completion, the depositWithMessage
function triggers a call to the on_receive
callback function on the receiving L2 contract. The on_receive
function receives the deposit message as input, and it must return true
for the deposit to succeed.
If on_receive
returns false
, or if the receiving contract does not implement on_receive
, the depositWithMessage
L1 handler fails, and the user can only recover their funds using the depositWithMessageCancelRequest
function.
l2_token: ContractAddress | The L2 address of the ERC-20 token contract. |
amount: uint256 | The amount deposited. |
depositor : EthAddress | L1 address of the deposit sender. |
message: Span<felt252> | The message that was sent with the depositWithMessage function. |
true | The on_receive function completed successfully. |
false | The on_receive function did not complete successfully. The transaction is reverted. |
No value | If the recipients’s smart contract does not implement the on_receive function, the call fails to execute, and the transaction is reverted. |
on_receive
in receiver_interface.cairo
.