Contracts chapter (#2281)

This commit is contained in:
Waylon Jepsen 2023-03-21 12:15:41 -06:00 committed by GitHub
parent 757314b082
commit 0356db1fae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 95 additions and 19 deletions

View File

@ -1,11 +1,13 @@
# Summary
# Getting started
- [Intro](./getting-started/intro.md)
- [Start a new project](./getting-started/start_a_new_project.md)
- [Connect to an Ethereum node](./getting-started/connect_to_an_ethereum_node.md)
# Reference guide
- [Providers](./providers/providers.md)
- [Http](./providers/http.md)
- [WebSocket](./providers/ws.md)
@ -26,16 +28,16 @@
- [Signer](./middleware/signer.md)
- [Time lag]()
- [Transformer]()
- [Contracts]()
- [Abigen]()
- [Compile]()
- [Creating Instances]()
- [Deploy Anvil]()
- [Deploy from ABI and bytecode]()
- [Deploy Moonbeam]()
- [Events]()
- [Events with meta]()
- [Methods]()
- [Contracts](./contracts/contracts.md)
- [Abigen](./contracts/abigen.md)
- [Compile](./contracts/compile.md)
- [Creating Instances](./contracts/creating-instances.md)
- [Deploy Anvil](./contracts/deploy-anvil.md)
- [Deploy from ABI and bytecode](./contracts/deploy-from-abi-and-bytecode.md)
- [Deploy Moonbeam](./contracts/doploy-moonbeam.md)
- [Events](./contracts/events.md)
- [Events with meta](./contracts/events-with-meta.md)
- [Methods](contracts/methods.md)
- [Events]()
- [Logs and filtering]()
- [Solidity topics]()

5
book/contracts/abigen.md Normal file
View File

@ -0,0 +1,5 @@
# Abigen
```rust
{{#include ../../examples/contracts/examples/abigen.rs}}
```

View File

@ -0,0 +1,5 @@
# Compile
```rust
{{#include ../../examples/contracts/examples/compile.rs}}
```

View File

@ -0,0 +1,29 @@
# Contracts
In ethers-rs, contracts are a way to interact with smart contracts on the Ethereum blockchain through rust bindings, which serve as a robust rust API to these objects.
The ethers-contracts module includes the following features:
- [Abigen](): A module for generating Rust code from Solidity contracts.
- [Compile](): A module for compiling Solidity contracts into bytecode and ABI files.
- [Creating Instances](): A module for creating instances of smart contracts.
- [Deploy Anvil](): A module for deploying smart contracts on the Anvil network.
- [Deploy from ABI and bytecode](): A module for deploying smart contracts from their ABI and bytecode files.
- [Deploy Moonbeam](): A module for deploying smart contracts on the Moonbeam network.
- [Events](): A module for listening to smart contract events.
- [Events with Meta](): A module for listening to smart contract events with metadata.
- [Methods](): A module for calling smart contract methods.
The ethers-contracts module provides a convenient way to work with Ethereum smart contracts in Rust. With this module, you can easily create instances of smart contracts, deploy them to the network, and interact with their methods and events.
The Abigen module allows you to generate Rust code from Solidity contracts, which can save you a lot of time and effort when writing Rust code for Ethereum smart contracts.
The Compile module makes it easy to compile Solidity contracts into bytecode and ABI files, which are required for deploying smart contracts.
The Deploy Anvil and Deploy Moonbeam modules allow you to deploy smart contracts to specific networks, making it easy to test and deploy your smart contracts on the desired network.
The Events and Events with Meta modules allow you to listen to smart contract events and retrieve event data, which is essential for building applications that interact with Ethereum smart contracts.
Finally, the Methods module provides a simple way to call smart contract methods from Rust code, allowing you to interact with smart contracts in a programmatic way.
Overall, the ethers-contracts module provides a comprehensive set of tools for working with Ethereum smart contracts in Rust, making it an essential tool for Rust developers building decentralized applications on the Ethereum network.

View File

@ -0,0 +1,5 @@
# Creating Instances
```rust
{{#include ../../examples/contracts/examples/instances.rs}}
```

View File

@ -0,0 +1,5 @@
# Deploy Anvil
```rust
{{#include ../../examples/contracts/examples/deploy_anvil.rs}}
```

View File

@ -0,0 +1,5 @@
# Deploying a Contract from ABI and Bytecode
```rust
{{#include ../../examples/contracts/examples/deploy_from_abi_and_bytecode.rs}}
```

View File

@ -0,0 +1,5 @@
# Deploy Moonbeam
```rust
{{#include ../../examples/contracts/examples/deploy_moonbeam.rs}}
```

View File

@ -0,0 +1,5 @@
# Events with meta
```rust
{{#include ../../examples/contracts/examples/events_with_meta.rs}}
```

5
book/contracts/events.md Normal file
View File

@ -0,0 +1,5 @@
# Events
```rust
{{#include ../../examples/contracts/examples/events.rs}}
```

View File

@ -0,0 +1,5 @@
# Methods
```rust
{{#include ../../examples/contracts/examples/methods.rs}}
```