├── .github ├── CODEOWNERS └── workflows │ └── book.yml ├── .gitignore ├── .gitmodules ├── CNAME ├── CONTRIBUTING.md ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── scripts └── update.sh └── vocs ├── README.md ├── bun.lockb ├── docs ├── pages │ ├── contract-interactions │ │ ├── queries.md │ │ ├── read-contract.mdx │ │ ├── using-sol!.mdx │ │ └── write-contract.mdx │ ├── examples │ │ ├── advanced │ │ │ ├── README.mdx │ │ │ ├── any_network.mdx │ │ │ ├── decoding_json_abi.mdx │ │ │ ├── encoding_dyn_abi.mdx │ │ │ ├── encoding_sol_static.mdx │ │ │ ├── foundry_fork_db.mdx │ │ │ ├── reth_db_layer.mdx │ │ │ └── reth_db_provider.mdx │ │ ├── big-numbers │ │ │ ├── README.mdx │ │ │ ├── comparison_equivalence.mdx │ │ │ ├── conversion.mdx │ │ │ ├── create_instances.mdx │ │ │ ├── math_operations.mdx │ │ │ └── math_utilities.mdx │ │ ├── comparison │ │ │ ├── README.mdx │ │ │ ├── compare_new_heads.mdx │ │ │ └── compare_pending_txs.mdx │ │ ├── contracts │ │ │ ├── README.mdx │ │ │ ├── arb_profit_calc.mdx │ │ │ ├── deploy_and_link_library.mdx │ │ │ ├── deploy_from_artifact.mdx │ │ │ ├── deploy_from_bytecode.mdx │ │ │ ├── deploy_from_contract.mdx │ │ │ ├── helpers.mdx │ │ │ ├── interact_with_abi.mdx │ │ │ ├── interact_with_contract_instance.mdx │ │ │ ├── jsonrpc_error_decoding.mdx │ │ │ ├── revert_decoding.mdx │ │ │ ├── simulation_uni_v2.mdx │ │ │ └── unknown_return_types.mdx │ │ ├── fillers │ │ │ ├── README.mdx │ │ │ ├── gas_filler.mdx │ │ │ ├── nonce_filler.mdx │ │ │ ├── recommended_fillers.mdx │ │ │ ├── urgent_filler.mdx │ │ │ └── wallet_filler.mdx │ │ ├── layers │ │ │ ├── README.mdx │ │ │ ├── delay_layer.mdx │ │ │ ├── fallback_layer.mdx │ │ │ ├── hyper_http_layer.mdx │ │ │ ├── logging_layer.mdx │ │ │ └── retry_layer.mdx │ │ ├── node-bindings │ │ │ ├── README.mdx │ │ │ ├── anvil_deploy_contract.mdx │ │ │ ├── anvil_fork_instance.mdx │ │ │ ├── anvil_fork_provider.mdx │ │ │ ├── anvil_local_instance.mdx │ │ │ ├── anvil_local_provider.mdx │ │ │ ├── anvil_set_storage_at.mdx │ │ │ ├── geth_local_instance.mdx │ │ │ └── reth_local_instance.mdx │ │ ├── primitives │ │ │ ├── README.mdx │ │ │ ├── bytes_and_address_types.mdx │ │ │ └── hashing_functions.mdx │ │ ├── providers │ │ │ ├── README.mdx │ │ │ ├── basic_provider.mdx │ │ │ ├── batch_rpc.mdx │ │ │ ├── builder.mdx │ │ │ ├── builtin.mdx │ │ │ ├── dyn_provider.mdx │ │ │ ├── embed_consensus_rpc.mdx │ │ │ ├── http.mdx │ │ │ ├── http_with_auth.mdx │ │ │ ├── ipc.mdx │ │ │ ├── mocking.mdx │ │ │ ├── multicall.mdx │ │ │ ├── multicall_batching.mdx │ │ │ ├── wrapped_provider.mdx │ │ │ ├── ws.mdx │ │ │ └── ws_with_auth.mdx │ │ ├── queries │ │ │ ├── README.mdx │ │ │ ├── query_contract_storage.mdx │ │ │ ├── query_deployed_bytecode.mdx │ │ │ └── query_logs.mdx │ │ ├── sol-macro │ │ │ ├── README.mdx │ │ │ ├── all_derives.mdx │ │ │ ├── contract.mdx │ │ │ ├── decode_returns.mdx │ │ │ ├── events_errors.mdx │ │ │ ├── extra_derives.mdx │ │ │ ├── structs_enums.mdx │ │ │ └── user_defined_types.mdx │ │ ├── subscriptions │ │ │ ├── README.mdx │ │ │ ├── event_multiplexer.mdx │ │ │ ├── poll_logs.mdx │ │ │ ├── subscribe_all_logs.mdx │ │ │ ├── subscribe_blocks.mdx │ │ │ ├── subscribe_logs.mdx │ │ │ └── subscribe_pending_transactions.mdx │ │ ├── transactions │ │ │ ├── README.mdx │ │ │ ├── debug_trace_call_many.mdx │ │ │ ├── decode_input.mdx │ │ │ ├── decode_receipt_log.mdx │ │ │ ├── encode_decode_eip1559.mdx │ │ │ ├── gas_price_usd.mdx │ │ │ ├── permit2_signature_transfer.mdx │ │ │ ├── send_eip1559_transaction.mdx │ │ │ ├── send_eip4844_transaction.mdx │ │ │ ├── send_eip7702_transaction.mdx │ │ │ ├── send_legacy_transaction.mdx │ │ │ ├── send_private_transaction.mdx │ │ │ ├── send_raw_transaction.mdx │ │ │ ├── trace_call.mdx │ │ │ ├── trace_call_many.mdx │ │ │ ├── trace_transaction.mdx │ │ │ ├── transfer_erc20.mdx │ │ │ ├── transfer_eth.mdx │ │ │ └── with_access_list.mdx │ │ └── wallets │ │ │ ├── README.mdx │ │ │ ├── aws_signer.mdx │ │ │ ├── create_keystore.mdx │ │ │ ├── ethereum_wallet.mdx │ │ │ ├── gcp_signer.mdx │ │ │ ├── keystore_signer.mdx │ │ │ ├── ledger_signer.mdx │ │ │ ├── mnemonic_signer.mdx │ │ │ ├── private_key_signer.mdx │ │ │ ├── sign_message.mdx │ │ │ ├── sign_permit_hash.mdx │ │ │ ├── trezor_signer.mdx │ │ │ ├── verify_message.mdx │ │ │ └── yubi_signer.mdx │ ├── guides │ │ ├── fillers.mdx │ │ ├── interacting-with-multiple-networks.md │ │ ├── layers.mdx │ │ ├── multicall.md │ │ ├── rpc-provider-abstraction.md │ │ ├── signers-vs-ethereum-wallet.md │ │ ├── speed-up-using-u256.md │ │ └── static-dynamic-abi-in-alloy.mdx │ ├── index.mdx │ ├── introduction │ │ ├── getting-started.md │ │ ├── installation.md │ │ └── why-alloy.mdx │ ├── migrating-from-ethers │ │ ├── conversions.md │ │ └── reference.md │ ├── migrating-to-core-1.0 │ │ ├── README.md │ │ ├── encoding-decoding-changes │ │ │ ├── README.md │ │ │ ├── encoding-return-structs.md │ │ │ └── removing-validate-bool.md │ │ ├── other-breaking-changes.md │ │ └── sol!-changes │ │ │ ├── README.md │ │ │ ├── changes-to-error-bindings.md │ │ │ ├── changes-to-event-bindings.md │ │ │ ├── changes-to-function-call-bindings.md │ │ │ ├── improving-function-return-types.md │ │ │ └── removing-T-generic.md │ ├── rpc-providers │ │ ├── http-provider.md │ │ ├── introduction.md │ │ ├── ipc-provider.md │ │ ├── understanding-fillers.md │ │ └── ws-provider.md │ ├── templates │ │ ├── advanced │ │ │ └── README.mdx │ │ ├── big-numbers │ │ │ └── README.mdx │ │ ├── comparison │ │ │ └── README.mdx │ │ ├── contracts │ │ │ └── README.mdx │ │ ├── fillers │ │ │ └── README.mdx │ │ ├── layers │ │ │ └── README.mdx │ │ ├── node-bindings │ │ │ └── README.mdx │ │ ├── primitives │ │ │ └── README.mdx │ │ ├── providers │ │ │ └── README.mdx │ │ ├── queries │ │ │ └── README.mdx │ │ ├── sol-macro │ │ │ └── README.mdx │ │ ├── subscriptions │ │ │ └── README.mdx │ │ ├── transactions │ │ │ └── README.mdx │ │ └── wallets │ │ │ └── README.mdx │ ├── transactions │ │ ├── introduction.mdx │ │ ├── sending-a-legacy-transaction.md │ │ ├── sending-an-EIP-1559-transaction.md │ │ ├── sending-an-EIP-4844-transaction.md │ │ ├── sending-an-EIP-7702-transaction.md │ │ ├── transaction-lifecycle.md │ │ ├── using-access-lists.md │ │ └── using-the-transaction-builder.md │ └── using-primitive-types │ │ ├── big-numbers.md │ │ ├── common-conversions.md │ │ ├── comparisons-and-equivalence.md │ │ ├── hash-and-address-types.md │ │ ├── introduction.mdx │ │ └── using-big-numbers.md ├── public │ ├── alloy-logo.png │ ├── banner.jpg │ ├── favicon.png │ ├── flashbots.png │ ├── foundry.png │ ├── guides-images │ │ ├── alloy_abi │ │ │ ├── dyn_encoding_bench.png │ │ │ └── static_encoding_bench.png │ │ ├── alloy_u256 │ │ │ └── u256_bench_chart.png │ │ └── layers │ │ │ ├── alloy_logs.png │ │ │ └── alloy_logs_tx.png │ ├── kona.png │ ├── reth.png │ ├── revm.png │ ├── sorella.png │ ├── stylus.png │ └── succinct.png ├── snippets │ ├── advanced │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── abi │ │ │ └── SimpleLending.json │ │ │ ├── any_network.rs │ │ │ ├── decoding_json_abi.rs │ │ │ ├── encoding_dyn_abi.rs │ │ │ ├── encoding_sol_static.rs │ │ │ ├── foundry_fork_db.rs │ │ │ ├── reth_db_layer.rs │ │ │ └── reth_db_provider.rs │ ├── big-numbers │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── comparison_equivalence.rs │ │ │ ├── conversion.rs │ │ │ ├── create_instances.rs │ │ │ ├── math_operations.rs │ │ │ └── math_utilities.rs │ ├── comparison │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── compare_new_heads.rs │ │ │ └── compare_pending_txs.rs │ ├── contracts │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── abi │ │ │ ├── Colors.json │ │ │ └── IWETH9.json │ │ │ ├── arb_profit_calc.rs │ │ │ ├── artifacts │ │ │ ├── Counter.json │ │ │ ├── FlashBotsMultiCall.json │ │ │ └── FlashBotsMultiCall.sol │ │ │ ├── deploy_and_link_library.rs │ │ │ ├── deploy_from_artifact.rs │ │ │ ├── deploy_from_bytecode.rs │ │ │ ├── deploy_from_contract.rs │ │ │ ├── helpers.rs │ │ │ ├── interact_with_abi.rs │ │ │ ├── interact_with_contract_instance.rs │ │ │ ├── jsonrpc_error_decoding.rs │ │ │ ├── revert_decoding.rs │ │ │ ├── simulation_uni_v2.rs │ │ │ └── unknown_return_types.rs │ ├── fillers │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── gas_filler.rs │ │ │ ├── nonce_filler.rs │ │ │ ├── recommended_fillers.rs │ │ │ ├── urgent_filler.rs │ │ │ └── wallet_filler.rs │ ├── layers │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── delay_layer.rs │ │ │ ├── fallback_layer.rs │ │ │ ├── hyper_http_layer.rs │ │ │ ├── logging_layer.rs │ │ │ └── retry_layer.rs │ ├── node-bindings │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── anvil_deploy_contract.rs │ │ │ ├── anvil_fork_instance.rs │ │ │ ├── anvil_fork_provider.rs │ │ │ ├── anvil_local_instance.rs │ │ │ ├── anvil_local_provider.rs │ │ │ ├── anvil_set_storage_at.rs │ │ │ ├── geth_local_instance.rs │ │ │ └── reth_local_instance.rs │ ├── primitives │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── bytes_and_address_types.rs │ │ │ └── hashing_functions.rs │ ├── providers │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── abi │ │ │ └── IWETH9.json │ │ │ ├── basic_provider.rs │ │ │ ├── batch_rpc.rs │ │ │ ├── builder.rs │ │ │ ├── builtin.rs │ │ │ ├── dyn_provider.rs │ │ │ ├── embed_consensus_rpc.rs │ │ │ ├── http.rs │ │ │ ├── http_with_auth.rs │ │ │ ├── ipc.rs │ │ │ ├── mocking.rs │ │ │ ├── multicall.rs │ │ │ ├── multicall_batching.rs │ │ │ ├── wrapped_provider.rs │ │ │ ├── ws.rs │ │ │ └── ws_with_auth.rs │ ├── queries │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── query_contract_storage.rs │ │ │ ├── query_deployed_bytecode.rs │ │ │ └── query_logs.rs │ ├── sol-macro │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── abi │ │ │ └── Colors.json │ │ │ ├── all_derives.rs │ │ │ ├── decode_returns.rs │ │ │ ├── events_errors.rs │ │ │ ├── extra_derives.rs │ │ │ ├── structs_enums.rs │ │ │ └── user_defined_types.rs │ ├── subscriptions │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── abi │ │ │ └── IWETH9.json │ │ │ ├── event_multiplexer.rs │ │ │ ├── poll_logs.rs │ │ │ ├── subscribe_all_logs.rs │ │ │ ├── subscribe_blocks.rs │ │ │ ├── subscribe_logs.rs │ │ │ └── subscribe_pending_transactions.rs │ ├── transactions │ │ ├── Cargo.toml │ │ └── examples │ │ │ ├── artifacts │ │ │ ├── ERC20Example.json │ │ │ ├── Permit2.json │ │ │ └── SimpleStorage.json │ │ │ ├── debug_trace_call_many.rs │ │ │ ├── decode_input.rs │ │ │ ├── decode_receipt_log.rs │ │ │ ├── encode_decode_eip1559.rs │ │ │ ├── gas_price_usd.rs │ │ │ ├── permit2_signature_transfer.rs │ │ │ ├── send_eip1559_transaction.rs │ │ │ ├── send_eip4844_transaction.rs │ │ │ ├── send_eip7702_transaction.rs │ │ │ ├── send_legacy_transaction.rs │ │ │ ├── send_private_transaction.rs │ │ │ ├── send_raw_transaction.rs │ │ │ ├── trace_call.rs │ │ │ ├── trace_call_many.rs │ │ │ ├── trace_transaction.rs │ │ │ ├── transfer_erc20.rs │ │ │ ├── transfer_eth.rs │ │ │ └── with_access_list.rs │ └── wallets │ │ ├── Cargo.toml │ │ └── examples │ │ ├── aws_signer.rs │ │ ├── create_keystore.rs │ │ ├── ethereum_wallet.rs │ │ ├── gcp_signer.rs │ │ ├── keystore │ │ └── alice.json │ │ ├── keystore_signer.rs │ │ ├── ledger_signer.rs │ │ ├── mnemonic_signer.rs │ │ ├── private_key_signer.rs │ │ ├── sign_message.rs │ │ ├── sign_permit_hash.rs │ │ ├── trezor_signer.rs │ │ ├── verify_message.rs │ │ └── yubi_signer.rs └── styles.css ├── example-items.ts ├── package.json ├── sidebar.ts ├── tsconfig.json └── vocs.config.tsx /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @zerosnacks -------------------------------------------------------------------------------- /.github/workflows/book.yml: -------------------------------------------------------------------------------- 1 | # Build and deploy the book to GitHub Pages 2 | 3 | name: book 4 | 5 | on: 6 | push: 7 | branches: [main] 8 | pull_request: 9 | branches: [main] 10 | merge_group: 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | timeout-minutes: 60 16 | steps: 17 | - uses: actions/checkout@v4 18 | with: 19 | submodules: recursive 20 | - uses: oven-sh/setup-bun@v2 21 | 22 | - name: Build Vocs 23 | run: cd vocs && bun install && bun run build 24 | 25 | # Only prepare for deploy if a push to main 26 | - name: Setup Pages 27 | if: github.ref_name == 'main' && github.event_name == 'push' 28 | uses: actions/configure-pages@v5 29 | 30 | # Only prepare for deploy if a push to main 31 | - name: Upload artifact 32 | if: github.ref_name == 'main' && github.event_name == 'push' 33 | uses: actions/upload-pages-artifact@v3 34 | with: 35 | path: "vocs/docs/dist" 36 | 37 | deploy: 38 | # Only deploy if a push to main 39 | if: github.ref_name == 'main' && github.event_name == 'push' 40 | runs-on: ubuntu-latest 41 | timeout-minutes: 60 42 | needs: [build] 43 | 44 | permissions: 45 | pages: write 46 | id-token: write 47 | 48 | environment: 49 | name: github-pages 50 | url: ${{ steps.deployment.outputs.page_url }} 51 | 52 | steps: 53 | - name: Deploy to GitHub Pages 54 | id: deployment 55 | uses: actions/deploy-pages@v4 56 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /book 2 | _cjs 3 | _esm 4 | _types 5 | *.local 6 | .DS_Store 7 | .attest 8 | .eslintcache 9 | .next 10 | bench 11 | cache 12 | coverage 13 | vocs/node_modules 14 | vocs/docs/dist 15 | tsconfig*.tsbuildinfo 16 | wagmi 17 | src/node/trustedSetups_esm.ts 18 | **/trusted-setups/**/*.txt 19 | .idea 20 | .pnpm-store 21 | 22 | # local env files 23 | .env 24 | .env.local 25 | .env.development.local 26 | .env.test.local 27 | .env.production.local 28 | .envrc 29 | 30 | # tests 31 | generated.ts 32 | vectors/**/*.json 33 | 34 | # docs 35 | site/dist 36 | .vercel 37 | vocs.config.tsx.timestamp* -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/examples"] 2 | path = lib/examples 3 | url = git@github.com:alloy-rs/examples.git 4 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | alloy.rs -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any 2 | person obtaining a copy of this software and associated 3 | documentation files (the "Software"), to deal in the 4 | Software without restriction, including without 5 | limitation the rights to use, copy, modify, merge, 6 | publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software 8 | is furnished to do so, subject to the following 9 | conditions: 10 | 11 | The above copyright notice and this permission notice 12 | shall be included in all copies or substantial portions 13 | of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 16 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 17 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 18 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 19 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 22 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 📖 Alloy Docs 2 | 3 | Documentation for all things Alloy. 4 | 5 | [![Telegram chat][telegram-badge]][telegram-url] 6 | 7 | [`alloy-rs`]: https://github.com/gakonst/ethers-rs 8 | [telegram-badge]: https://img.shields.io/endpoint?color=neon&style=for-the-badge&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fethers_rs 9 | [telegram-url]: https://t.me/ethers_rs 10 | 11 | View the docs [here](https://alloy.rs/). 12 | 13 | ## Contributing 14 | 15 | Thanks for your help improving the project! We are so happy to have you! We have 16 | [a contributing guide](./CONTRIBUTING.md) to help you get involved in the 17 | Alloy project. 18 | 19 | #### License 20 | 21 | 22 | Licensed under either of Apache License, Version 23 | 2.0 or MIT license at your option. 24 | 25 | 26 |
27 | 28 | 29 | Unless you explicitly state otherwise, any contribution intentionally submitted 30 | for inclusion in these crates by you, as defined in the Apache-2.0 license, 31 | shall be dual licensed as above, without any additional terms or conditions. 32 | 33 | -------------------------------------------------------------------------------- /vocs/README.md: -------------------------------------------------------------------------------- 1 | This is a [Vocs](https://vocs.dev) project bootstrapped with the Vocs CLI. 2 | -------------------------------------------------------------------------------- /vocs/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy-rs/docs/8f727022cd5de6882cc99a535513e1f8576bafa6/vocs/bun.lockb -------------------------------------------------------------------------------- /vocs/docs/pages/contract-interactions/queries.md: -------------------------------------------------------------------------------- 1 | ## Querying Contracts 2 | 3 | ### Query Contract Storage 4 | 5 | ```rust 6 | // [!include ~/snippets/queries/examples/query_contract_storage.rs] 7 | ``` 8 | 9 | ### Query Contract Code 10 | 11 | ```rust 12 | // [!include ~/snippets/queries/examples/query_deployed_bytecode.rs] 13 | ``` 14 | 15 | ### Query Logs 16 | 17 | ```rust 18 | // [!include ~/snippets/queries/examples/query_logs.rs] 19 | ``` 20 | -------------------------------------------------------------------------------- /vocs/docs/pages/contract-interactions/read-contract.mdx: -------------------------------------------------------------------------------- 1 | ## Reading a contract 2 | 3 | We shall leverage the `sol!` macro and its `rpc` attribute to get the [WETH](https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) balance of an address. 4 | 5 | The RPC interaction is enabled via the [`CallBuilder`](https://docs.rs/alloy/latest/alloy/contract/struct.CallBuilder.html) which handles transaction creation, setting fees and inserting the correct calldata. 6 | 7 | ```rust showLineNumbers [read_contract.rs] 8 | //! Demonstrates reading a contract by fetching the WETH balance of an address. 9 | use alloy::{primitives::address, providers::ProviderBuilder, sol}; 10 | use std::error::Error; 11 | 12 | // Generate the contract bindings for the ERC20 interface. 13 | sol! { // [!code focus] 14 | // The `rpc` attribute enables contract interaction via the provider. [!code focus] 15 | #[sol(rpc)] // [!code focus] 16 | contract ERC20 { // [!code focus] 17 | function balanceOf(address owner) public view returns (uint256); // [!code focus] 18 | } // [!code focus] 19 | } // [!code focus] 20 | 21 | #[tokio::main] 22 | async fn main() -> Result<(), Box> { 23 | // Initialize the provider. 24 | let provider = ProviderBuilder::new().connect("https://reth-ethereum.ithaca.xyz/rpc").await?; 25 | 26 | // Instantiate the contract instance. 27 | let weth = address!("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"); 28 | let erc20 = ERC20::new(weth, provider); // [!code focus] 29 | 30 | // Fetch the balance of WETH for a given address. 31 | let owner = address!("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"); // [!code focus] 32 | let balance = erc20.balanceOf(owner).call().await?; // [!code focus] 33 | 34 | println!("WETH Balance of {owner}: {balance}"); 35 | 36 | Ok(()) 37 | } 38 | ``` 39 | -------------------------------------------------------------------------------- /vocs/docs/pages/examples/advanced/README.mdx: -------------------------------------------------------------------------------- 1 | import Template from '../../templates/advanced/README.mdx' 2 | 3 |