@@ -10,6 +10,7 @@ mod Orderbook {
10
10
StoragePointerReadAccess , StoragePointerWriteAccess ,
11
11
};
12
12
use starknet :: {ContractAddress , get_caller_address, get_contract_address, get_block_number};
13
+ use starknet :: {SyscallResultTrait , syscalls :: call_contract_syscall};
13
14
14
15
#[storage]
15
16
struct Storage {
@@ -28,12 +29,14 @@ mod Orderbook {
28
29
inscription_locks : Map <u32 , (ContractAddress , ByteArray , u64 )>,
29
30
// STRK fee token.
30
31
strk_token : ERC20ABIDispatcher ,
32
+ // Address of the contract checking transaction inclusion.
33
+ relay_address : ContractAddress ,
31
34
}
32
35
33
36
#[constructor]
34
- fn constructor (ref self : ContractState , strk_token : ContractAddress ) {
37
+ fn constructor (ref self : ContractState , strk_token : ContractAddress , relay_address : ContractAddress ) {
35
38
// initialize contract
36
- self . initializer (: strk_token );
39
+ self . initializer (: strk_token , : relay_address );
37
40
}
38
41
39
42
#[abi(embed_v0)]
@@ -159,7 +162,14 @@ mod Orderbook {
159
162
let (_ , precomputed_tx_hash , _ ) = self . inscription_locks. read (inscription_id );
160
163
assert (precomputed_tx_hash == tx_hash , ' Precomputed hash != submitted' );
161
164
162
- // TODO: process the submitted transaction hash, verify that it is on Bitcoin
165
+ const selector : felt252 = selector! (" prove_inclusion" );
166
+ let to = self . relay_address. read ();
167
+ let calldata : Array <felt252 > = array! [];
168
+
169
+ // TODO: assert successful inclusion call
170
+ call_contract_syscall (to , selector , calldata . span ()). unwrap_syscall ();
171
+
172
+ // TODO: assert that the witness data contains the requested inscription
163
173
164
174
self . inscription_statuses. write (inscription_id , Status :: Closed );
165
175
}
@@ -182,8 +192,9 @@ mod Orderbook {
182
192
pub impl InternalImpl of InternalTrait {
183
193
/// Executed once when the Orderbook contract is deployed. Used to set
184
194
/// initial values for contract storage variables for the fee tokens.
185
- fn initializer (ref self : ContractState , strk_token : ContractAddress ) {
195
+ fn initializer (ref self : ContractState , strk_token : ContractAddress , relay_address : ContractAddress ) {
186
196
self . strk_token. write (ERC20ABIDispatcher { contract_address : strk_token });
197
+ self . relay_address. write (relay_address );
187
198
}
188
199
}
189
200
}
0 commit comments