|
1 |
| -/// Config usd for Bridging Payment service initialization. |
2 |
| -type InitConfig = struct { |
3 |
| - /// Admin of this service. For detailed description see [State::admin_address]. |
| 1 | +/// Global state of the Bridging Payment service. |
| 2 | +type State = struct { |
| 3 | + /// Admin of this service. Admin is in charge of: |
| 4 | + /// - Changing fee |
| 5 | + /// - Withdrawing collected fees from the program address |
| 6 | + /// - Updating [Config] of this service |
4 | 7 | admin_address: actor_id,
|
5 |
| - /// Address of the `vft-manager` where bridging request will be sent. |
6 |
| - vft_manager_address: actor_id, |
7 |
| - /// [Config] that will be initially set for this service. |
8 |
| - config: Config, |
9 |
| -}; |
10 |
| - |
11 |
| -/// Config of the Bridging Payment service. |
12 |
| -type Config = struct { |
13 | 8 | /// Fee that will be taken from all the incoming bridging requests.
|
14 | 9 | fee: u128,
|
15 |
| - /// Gas that will be reserved for reply processing. |
16 |
| - gas_for_reply_deposit: u64, |
17 |
| - /// Gas that will be attached to a message to the `vft-manager`. |
18 |
| - gas_to_send_request_to_vft_manager: u64, |
19 |
| - /// Reply timeout that will be applied to a message to the `vft-manager`. |
20 |
| - reply_timeout: u32, |
21 |
| - /// Gas that's required to process `make_request` logic. |
22 |
| - gas_for_request_to_vft_manager_msg: u64, |
23 | 10 | };
|
24 | 11 |
|
25 | 12 | constructor {
|
26 | 13 | /// Create Bridging Payment program.
|
27 |
| - New : (init_config: InitConfig); |
| 14 | + New : (initial_state: State); |
28 | 15 | };
|
29 | 16 |
|
30 | 17 | service BridgingPayment {
|
31 |
| - /// Send request to the underlying `vft-manager` program. |
| 18 | + /// Pay fees for message processing to the relayer. |
32 | 19 | ///
|
33 |
| - /// This method will take additional fee from the message sender, so **exactly** [Config::fee] must |
| 20 | + /// This method requires that **exactly** [Config::fee] must |
34 | 21 | /// be attached as a value when sending message to this method.
|
35 | 22 | ///
|
36 | 23 | /// Current fee amount can be retreived by calling `get_config`.
|
37 |
| - MakeRequest : (amount: u256, receiver: h160, vara_token_id: actor_id) -> null; |
| 24 | + PayFees : (nonce: u256) -> null; |
38 | 25 | /// Withdraw fees that were collected from user requests.
|
39 | 26 | ///
|
40 | 27 | /// This method can be called only by admin.
|
41 | 28 | ReclaimFee : () -> null;
|
42 |
| - /// Set new config. |
| 29 | + /// Set new admin. |
43 | 30 | ///
|
44 | 31 | /// This method can be called only by admin.
|
45 |
| - SetConfig : (config: Config) -> null; |
| 32 | + SetAdmin : (new_admin: actor_id) -> null; |
46 | 33 | /// Set fee that this program will take from incoming requests.
|
47 | 34 | ///
|
48 | 35 | /// This method can be called only by admin.
|
49 | 36 | SetFee : (fee: u128) -> null;
|
50 |
| - /// Set new `vft-manager` address. |
51 |
| - /// |
52 |
| - /// This method can be called only by admin. |
53 |
| - UpdateVftManagerAddress : (new_vft_manager_address: actor_id) -> null; |
54 |
| - /// Get admin address. |
55 |
| - query AdminAddress : () -> actor_id; |
56 |
| - /// Get currently applied [Config]. |
57 |
| - query GetConfig : () -> Config; |
58 |
| - /// Get `vft-manager` address. |
59 |
| - query VftManagerAddress : () -> actor_id; |
| 37 | + /// Get current service [State]. |
| 38 | + query GetState : () -> State; |
60 | 39 |
|
61 | 40 | events {
|
62 |
| - /// Bridging of tokens from Gear to Ethereum is requested successfully. |
63 |
| - TeleportVaraToEth: struct { nonce: u256, sender: actor_id, amount: u256, receiver: h160, eth_token_id: h160 }; |
| 41 | + /// Fee for the message processing by relayer was paid. |
| 42 | + BridgingPaid: struct { nonce: u256 }; |
64 | 43 | }
|
65 | 44 | };
|
66 | 45 |
|
0 commit comments