2024-03-29 17:49:24 +03:00
|
|
|
# `Hello-World` Consumer Contracts
|
|
|
|
|
|
|
|
This is a [foundry](https://book.getfoundry.sh/) project that implements a simple Consumer
|
2024-03-29 17:50:13 +03:00
|
|
|
contract, [`SaysGm`](./src/SaysGM.sol).
|
2024-03-29 17:49:24 +03:00
|
|
|
|
2024-03-29 17:50:13 +03:00
|
|
|
This readme explains how to compile and deploy the contract to the Infernet Anvil Testnet network.
|
2024-03-29 17:49:24 +03:00
|
|
|
For a detailed tutorial on how to write a consumer contract, refer to the [tutorial doc](./Tutorial.md).
|
|
|
|
|
|
|
|
|
2024-03-29 17:50:13 +03:00
|
|
|
> [!IMPORTANT]
|
|
|
|
> Ensure that you are running the following scripts with the Infernet Anvil Testnet network.
|
|
|
|
> The [tutorial](../hello-world) at the root of this repository explains how to
|
2024-03-29 17:49:24 +03:00
|
|
|
> bring up an infernet node.
|
|
|
|
|
|
|
|
### Installing the libraries
|
|
|
|
|
|
|
|
```bash
|
|
|
|
forge install
|
|
|
|
```
|
|
|
|
|
|
|
|
### Compiling the contracts
|
|
|
|
|
|
|
|
```bash
|
|
|
|
forge compile
|
|
|
|
```
|
|
|
|
|
|
|
|
### Deploying the contracts
|
|
|
|
The deploy script at `script/Deploy.s.sol` deploys the `SaysGM` contract to the Infernet Anvil Testnet network.
|
|
|
|
|
2024-03-29 17:50:13 +03:00
|
|
|
We have the [following make target](./Makefile#L9) to deploy the contract. Refer to the Makefile
|
2024-03-29 17:49:24 +03:00
|
|
|
for more understanding around the deploy scripts.
|
|
|
|
```bash
|
|
|
|
make deploy
|
|
|
|
```
|
|
|
|
|
|
|
|
### Requesting a job
|
|
|
|
We also have a script called `CallContract.s.sol` that requests a job to the `SaysGM` contract.
|
2024-03-29 17:50:13 +03:00
|
|
|
Refer to the [script](./script/CallContract.s.sol) for more details. Similar to deployment,
|
2024-03-29 17:49:24 +03:00
|
|
|
you can run that script using the following convenience make target.
|
|
|
|
```bash
|
|
|
|
make call-contract
|
|
|
|
```
|
|
|
|
Refer to the [Makefile](./Makefile#L14) for more details.
|