Skip to content

Commit

Permalink
feat: update README with project description, setup instructions, and…
Browse files Browse the repository at this point in the history
… usage guidelines
  • Loading branch information
cqlyj committed Dec 3, 2024
1 parent 4640483 commit 6a3b1d9
Showing 1 changed file with 56 additions and 37 deletions.
93 changes: 56 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,85 @@
## Foundry
# Simple Chainlink CCIP

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
This is a simple Chainlink CCIP that transfer the ERC20 Token from Sepolia to Amoy testnet

Foundry consists of:
# Getting Started

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
## Requirements

## Documentation
- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- You'll know you did it right if you can run `git --version` and you see a response like `git version x.x.x`
- [foundry](https://getfoundry.sh/)
- You'll know you did it right if you can run `forge --version` and you see a response like `forge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)`

https://book.getfoundry.sh/
## Quickstart

## Usage
```
git clone https://github.com/cqlyj/simple-chainlink-ccip.git
cd simple-chainlink-ccip
make
```

### Build
# Usage

```shell
$ forge build
1. Set up your environment variables:

```bash
cp .env.example .env
```

### Test
2. Fill in the `.env` file with your own values. And also replace the address anywhere you see in files with your own address.
3. Before running the demo, you need to set up your wallet:

```shell
$ forge test
```bash
cast wallet import YOUR_ACCOUNT_NAME --interactive
```

### Format
Here I would call it `burner`, and a interactive prompt will show as below:

```shell
$ forge fmt
```bash
Enter private key:
Enter password:
`your-account-name` keystore was saved successfully. Address: address-corresponding-to-private-key
```

### Gas Snapshots
Please keep in mind the password you entered, this will be needed for you moving forward with the private key.

And if you change the name from `burner` to something else, you need to update in the `Makefile` as well. Also the `sender` needs to be your address.

```shell
$ forge snapshot
```diff
deploy:
- @forge script script/DeployTokenTransfer.s.sol:DeployTokenTransfer --rpc-url $(SEPOLIA_RPC_URL) --account burner --sender 0xFB6a372F2F51a002b390D18693075157A459641F --broadcast --verify --verifier blockscout --verifier-url https://eth-sepolia.blockscout.com/api/ -vvvv
+ @forge script script/DeployTokenTransfer.s.sol:DeployTokenTransfer --rpc-url $(SEPOLIA_RPC_URL) --account YOUR_ACCOUNT_NAME --sender YOUR_ADDRESS --broadcast --verify --verifier blockscout --verifier-url https://eth-sepolia.blockscout.com/api/ -vvvv
```

### Anvil
Same for any other command in `Makefile` which ask for your account name and sender addresses.

```shell
$ anvil
```
4. Also update the address in `script/TransferTokenPayNative.s.sol` and `script/WithdrawBalance.s.sol` with your own address.

### Deploy
In `script/TransferTokenPayNative.s.sol`:

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```diff
address public constant RECEIVER =
- 0xFB6a372F2F51a002b390D18693075157A459641F;
+ YOUR_ADDRESS;
```

### Cast
In `script/WithdrawBalance.s.sol`:

```shell
$ cast <subcommand>
```diff
address public constant BENEFICIARY =
- 0xFB6a372F2F51a002b390D18693075157A459641F;
+ YOUR_ADDRESS;
```

### Help
5. Run the demo:

```shell
$ forge --help
$ anvil --help
$ cast --help
```bash
make demo
```

Wait for about 20 mins, and you will get the token in your Amoy testnet account.

## Contact

Luo Yingjie - [luoyingjie0721@gmail.com](luoyingjie0721@gmail.com)

0 comments on commit 6a3b1d9

Please sign in to comment.