@@ -21,16 +21,55 @@ mod integration_test {
2121 }
2222 }
2323
24+ const EXPECTED_ABI : & str = "\
25+ interface IContract {
26+ function setNumber(uint256 number) external;
27+
28+ function number() external view returns (uint256);
29+
30+ function owner() external view returns (address);
31+
32+ error Unauthorized();
33+ }" ;
34+ const EXPECTED_CONSTRUCTOR : & str = "constructor(uint256 initial_number) payable" ;
35+
2436 #[ tokio:: test]
2537 async fn constructor ( ) -> Result < ( ) > {
38+ let exporter = stylus_tools:: Exporter :: builder ( ) . build ( ) ;
39+ assert_eq ! ( exporter. export_abi( ) ?, EXPECTED_ABI ) ;
40+ assert_eq ! ( exporter. export_constructor( ) ?, EXPECTED_CONSTRUCTOR ) ;
41+
2642 let devnode = Node :: new ( ) . await ?;
2743 let rpc = devnode. rpc ( ) ;
44+
45+ println ! ( "Checking contract on Nitro ({rpc})..." ) ;
46+ stylus_tools:: Checker :: builder ( ) . rpc ( rpc) . build ( ) . check ( ) ?;
47+ println ! ( "Checked contract" ) ;
48+
49+ let deployer = stylus_tools:: Deployer :: builder ( )
50+ . rpc ( rpc. to_owned ( ) )
51+ . constructor_args ( vec ! [ "0xbeef" . to_owned( ) ] )
52+ . constructor_value ( "12.34" . to_owned ( ) )
53+ . build ( ) ;
54+ println ! ( "Estimating gas..." ) ;
55+ let gas_estimate = deployer. estimate_gas ( ) ?;
56+ println ! ( "Estimated deployment gas: {gas_estimate} ETH" ) ;
57+
2858 println ! ( "Deploying contract to Nitro ({rpc})..." ) ;
29- let address = stylus_tools:: Deployer :: new ( rpc. to_owned ( ) )
30- . with_constructor_args ( vec ! [ "0xbeef" . to_owned( ) ] )
31- . with_constructor_value ( "12.34" . to_owned ( ) )
32- . deploy ( ) ?;
59+ let ( address, _tx_hash, gas_used) = deployer. deploy ( ) ?;
3360 println ! ( "Deployed contract to {address}" ) ;
61+
62+ // Approximate equality is usually expected, but given the test conditions, the gas estimate equals the gas used
63+ assert_eq ! ( gas_used, gas_estimate) ;
64+
65+ println ! ( "Activating contract at {address} on Nitro ({rpc})..." ) ;
66+ stylus_tools:: Activator :: builder ( )
67+ . rpc ( rpc)
68+ . contract_address ( address. to_string ( ) )
69+ . build ( )
70+ . activate ( ) ?;
71+ println ! ( "Activated contract at {address}" ) ;
72+
3473 let provider = devnode. create_provider ( ) . await ?;
3574
3675 // Check balance sent in constructor
0 commit comments