1+ // SPDX-License-Identifier: MIT OR Apache-2.0
2+ pragma solidity ^ 0.8.26 ;
3+
4+ import {BottomUpCheckpoint, BottomUpMsgBatch, IpcEnvelope, ParentFinality, SubnetID, FvmAddress, FullActivityRollup} from "../types/CommonTypes.sol " ;
5+
6+ /// @title Gateway interface
7+ /// @author LimeChain team
8+ interface IGatewayManagerFacet {
9+ /// @notice Register is called by subnet actors to put the required collateral
10+ /// and register the subnet to the hierarchy.
11+ function register (uint256 genesisCircSupply , uint256 collateral ) external payable ;
12+
13+ /// @notice AddStake adds stake to the collateral of a subnet.
14+ function addStake (uint256 amount ) external payable ;
15+
16+ /// @notice Release stake recovers some collateral of the subnet
17+ function releaseStake (uint256 amount ) external ;
18+
19+ /// @notice Kill propagates the kill signal from a subnet actor to unregister it from th
20+ /// hierarchy.
21+ function kill () external ;
22+
23+ /// @notice commitCheckpoint propagates the commitment of a checkpoint from a child
24+ function commitCheckpoint (BottomUpCheckpoint calldata bottomUpCheckpoint ) external ;
25+
26+ /// @notice fund locks the received funds —denominated in the native coin— and moves the value down the hierarchy,
27+ /// crediting the funds to the specified address in the destination network.
28+ ///
29+ /// This functions ends up minting supply in the subnet equal to the value of the transaction. It does so by
30+ /// committing the relevant top-down message, updating the top-down nonce along the way.
31+ ///
32+ /// Calling this method on a subnet whose supply source is not 'native' will revert with UnexpectedAsset().
33+ function fund (SubnetID calldata subnetId , FvmAddress calldata to ) external payable ;
34+
35+ /// @notice fundWithToken locks the specified amount of tokens in the ERC20 contract linked to the subnet, and
36+ /// moves the value down the hierarchy, crediting the funds as native coins to the specified address
37+ /// in the destination network.
38+ ///
39+ /// This method expects the caller to have approved the gateway to spend `amount` tokens on their behalf
40+ /// (usually done through IERC20#approve). Tokens are locked by calling IERC20#transferFrom(caller, address(this), amount).
41+ /// A failure in transferring tokens to the gateway will revert the call.
42+ ///
43+ /// It's possible to call this method from an EOA or a contract. Regardless, it's recommended to approve strictly
44+ /// the amount that will subsequently be deposited into the subnet. Keeping outstanding approvals is not recommended.
45+ ///
46+ /// Calling this method on a subnet whose supply source is not 'ERC20' will revert with UnexpectedAsset().
47+ function fundWithToken (SubnetID calldata subnetId , FvmAddress calldata to , uint256 amount ) external ;
48+
49+ /// @notice Release creates a new check message to release funds in parent chain
50+ ///
51+ /// This function burns the funds that will be released in the current subnet
52+ /// and propagates a new checkpoint message to the parent chain to signal
53+ /// the amount of funds that can be released for a specific address.
54+ function release (FvmAddress calldata to ) external payable ;
55+
56+ /// @notice sendContractXnetMessage sends an arbitrary cross-message to other subnet in the hierarchy.
57+ // TODO: add the right comment and function name here.
58+ function sendContractXnetMessage (
59+ IpcEnvelope calldata envelope
60+ ) external payable returns (IpcEnvelope memory committed );
61+
62+ /// @notice Propagates all the stored messages to destination subnet
63+ function propagateAll () external payable ;
64+
65+ /// @notice commit the ipc parent finality into storage
66+ function commitParentFinality (ParentFinality calldata finality ) external ;
67+
68+ /// @notice creates a new bottom-up checkpoint
69+ function createBottomUpCheckpoint (
70+ BottomUpCheckpoint calldata checkpoint ,
71+ bytes32 membershipRootHash ,
72+ uint256 membershipWeight ,
73+ FullActivityRollup calldata activity
74+ ) external ;
75+ }
0 commit comments