-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
67 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,51 @@ | ||
## Foundry | ||
# astria bridgeable erc20s | ||
|
||
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** | ||
Forge project for the `AstriaMintableERC20` contract. | ||
|
||
Foundry consists of: | ||
Requirements: | ||
|
||
- **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. | ||
- foundry | ||
|
||
## Documentation | ||
Build: | ||
|
||
https://book.getfoundry.sh/ | ||
|
||
## Usage | ||
|
||
### Build | ||
|
||
```shell | ||
$ forge build | ||
```sh | ||
forge build | ||
``` | ||
|
||
### Test | ||
Copy the example .env: | ||
|
||
```shell | ||
$ forge test | ||
``` | ||
`cp local.env.example .env && source .env` | ||
|
||
### Format | ||
Deploy `AstriaMintableERC20.sol`: | ||
|
||
```shell | ||
$ forge fmt | ||
```sh | ||
forge script script/AstriaMintableERC20.s.sol:AstriaMintableERC20Script \ | ||
--rpc-url $RPC_URL --broadcast --sig "deploy()" -vvvv | ||
``` | ||
|
||
### Gas Snapshots | ||
|
||
```shell | ||
$ forge snapshot | ||
``` | ||
Take note of the deployed address. | ||
|
||
### Anvil | ||
Add the following to the genesis file under `astriaBridgeAddresses`: | ||
|
||
```shell | ||
$ anvil | ||
``` | ||
|
||
### Deploy | ||
|
||
```shell | ||
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key> | ||
"astriaBridgeAddresses": [ | ||
{ | ||
"bridgeAddress": "0x1c0c490f1b5528d8173c5de46d131160e4b2c0c3", | ||
"startHeight": 1, | ||
"assetDenom": "nria", | ||
"assetPrecision": 6, | ||
"erc20asset": { | ||
"contractAddress":"0x9Aae647A1CB2ec6b39afd552aD149F6A26Bb2aD6", | ||
"contractPrecision": 6 | ||
} | ||
} | ||
], | ||
``` | ||
|
||
### Cast | ||
Note: this mints `nria` as an erc20 instead of the native asset. | ||
|
||
```shell | ||
$ cast <subcommand> | ||
``` | ||
`bridgeAddress` is the bridge address that corresponds to this asset on the sequencer chain. | ||
`assetDenom` does not need to match the name of the token in the deployed contract, but it does need to match the denom of the token on the sequencer. | ||
`contractAddress` in `erc20asset` is the address of the contract deployed above. | ||
|
||
### Help | ||
|
||
```shell | ||
$ forge --help | ||
$ anvil --help | ||
$ cast --help | ||
``` | ||
Stop and restart the geth node. |
Submodule openzeppelin-contracts
added at
1224d1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# name of token to deploy | ||
NAME="token" | ||
|
||
# symbol of token to deploy | ||
SYMBOL="TKN" | ||
|
||
# the "astriaBridgeSenderAddress" built into the node; set in the genesis file | ||
BRIDGE="0x00000000000000000000000000000000000000aa" | ||
|
||
# private key to alloc account in genesis | ||
PRIVATE_KEY=0x0a6996ccaca77a1d48633da20062ae051e11c75f3f561dfd2ac01b0c9c874662 | ||
|
||
# default local rpc url | ||
RPC_URL="http://localhost:8545" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters