Contract | Description |
---|---|
Starknet Token Bridge(on both L1 and L2) | The primary StarkGate bridge contract, where the main user bridge functionality are defined. |
Starkgate Manager | Responsible for adding tokens to the multi-bridge. |
Starkgate Registry | Contains the addresses of all supported bridges and tokens and enables to stop servicing an existing bridge. An interface to the Starkgate Registry is available through IStarkgateRegistry.sol. |
Starkgate Service | An interface to check if a contract is servicing a token. |
LegacyBridge.sol
and the L2 contract is an instance of legacy_bridge_eic.cairo
. These legacy token bridges are supported by StarkGate 2.0 in a fully backward-compatible fashion.
deposit
functions:deposit (0x0efe6a8b) | The multi-bridge contract, which includes support for all tokens within a single contract, requiring that you enter the address of the token in the deposit function. |
deposit (0xe2bbb158) | The legacy contract, which is labeled Support Legacy ABI. This function does not include the token (address) parameter, because the contract that contains this function only supports USDC. Therefore, the address of the token is superfluous. |
bridged_tokens
directory on GitHub.estimateDepositFeeWei
or estimateEnrollmentFeeWei
function.
To invoke onchain contracts, use Starknet Foundry’s sncast
, Starkli, or a block explorer. To get the onchain addresses of StarkGate’s contracts, see Important addresses.
For more information on StarkGate’s various functions, see StarkGate functions and events.
deposit
function. The deposit
function does the following:
Deposit
event that includes the L1 and L2 addresses of the user, and the amount deposited.
deposit
function on L1, you don’t see your funds appear on L2 within a reasonable amount of time.
In order to guard against an attack, it takes approximately five days to cancel a deposit. From the moment StarkGate receives the cancellation request, a counter begins. When exactly five days have passed, and the funds still do not appear on L2, you can reclaim the deposit.
To cancel a deposit, call the depositCancelRequest
request function. When StarkGate receives the cancellation request, a counter begins to count five days. When exactly five days have passed, and the funds still do not appear on L2, you can reclaim the deposit by calling depositReclaim
.
depositReclaim
was not performed, the deposit may be processed, even if the cancellation delay time has already passed. Only the depositor is allowed to cancel a deposit, and only before depositReclaim was performed.depositWithMessage
function enables sending a deposit with a message. depositWithMessage
is similar to the deposit
function, with an additional 256-bit message, which can contain instructions for executing additional actions.
Upon completion, the depositWithMessage
function triggers a call to a callback function, named on_receive
, on the L2 contract that receives the deposit. The on_receive
function receives the deposit message as input.
on_receive
must return true
for the deposit to succeed. If on_receive
returns false
, or if the recipient contract does not include the on_receive
function, the depositWithMessage
function’s L1 handler fails. The user can recover their funds using the depositWithMessageCancelRequest
function.
To enable deposits with messages in your application:
on_receive
function in the L2 contract that should receive deposits.
depositWithMessage
function to transfer funds from L1 to L2.
deposit
function initiates a deposit.
Deposit
event that includes the L1 and L2 addresses of the user, and the amount deposited.
NOT_RECEIVED
.
handle_deposit
function on the L2 bridge.
handle_deposit
function verifies that the deposit indeed came from the corresponding L1 bridge. It then calls the relevant token’s contract on Starknet and mints the specified amount of the token on L2 for the user.
ACCEPTED_ON_L2
.
Step 3: Proving the block that includes the deposit
initiate_token_withdraw
function to initiate a withdrawal. The function does the following:
setWithdrawLimitPCT()
function in the WithdrawalLimit.sol
contract. A dedicated team can then investigate and resolve the issue.
Only a security admin quorum can disable the withdrawal limit. The quorum will consist of Starknet Foundation members, Starknet ecosystem contributors, and StarkWare representatives. This diverse group will ensure that decisions reflect the Starknet community’s broad interests.
This approach, blending manual oversight with automated detection, aims to minimize potential losses.
initiate_token_withdraw
function initiates a withdrawal.
withdraw
function.
withdraw
function on L1.