File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,20 @@ impl MockTransport {
9393 address
9494 }
9595
96+ /// Deploys a new contract with the given ABI and address
97+ pub fn deploy_with_address ( & self , abi : & Abi , address : Address ) {
98+ let mut state = self . state . lock ( ) . unwrap ( ) ;
99+
100+ assert ! (
101+ state
102+ . contracts
103+ . insert( address, Contract :: new( address, abi) )
104+ . is_none( ) ,
105+ "replacing contract at address {:?}" ,
106+ address
107+ ) ;
108+ }
109+
96110 pub fn update_gas_price ( & self , gas_price : u64 ) {
97111 let mut state = self . state . lock ( ) . unwrap ( ) ;
98112 state. gas_price = gas_price;
Original file line number Diff line number Diff line change @@ -289,6 +289,17 @@ impl Mock {
289289 }
290290 }
291291
292+ /// Deploys a new mocked contract with specified address and returns an object that allows
293+ /// configuring expectations for contract methods.
294+ pub fn deploy_with_address ( & self , abi : Abi , address : Address ) -> Contract {
295+ self . transport . deploy_with_address ( & abi, address) ;
296+ Contract {
297+ transport : self . transport . clone ( ) ,
298+ address,
299+ abi,
300+ }
301+ }
302+
292303 /// Updates gas price that is returned by RPC call `eth_gasPrice`.
293304 ///
294305 /// Mock node does not simulate gas consumption, so this value does not
You can’t perform that action at this time.
0 commit comments