MCPcopy Create free account
hub / github.com/ddimaria/rust-blockchain-tutorial / it_gets_a_contract_code

Function it_gets_a_contract_code

web3/src/contract.rs:96–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94
95 #[tokio::test]
96 async fn it_gets_a_contract_code() {
97 let web3 = web3();
98 let tx_hash = deploy_contract(true).await;
99
100 // TODO(ddimaria): use polling or callbacks instead of waiting
101 sleep(Duration::from_millis(1000)).await;
102
103 let receipt = web3.transaction_receipt(tx_hash).await.unwrap();
104 let response = web3.code(receipt.contract_address.unwrap(), None).await;
105
106 // ensure the code matches what was deployed
107 assert_eq!(response.unwrap(), [0, 1]);
108 }
109}

Callers

nothing calls this directly

Calls 4

web3Function · 0.85
deploy_contractFunction · 0.85
transaction_receiptMethod · 0.80
codeMethod · 0.80

Tested by

no test coverage detected