Skip to content

Commit

Permalink
Merge pull request #3 from chain-notes-brussels/contracts
Browse files Browse the repository at this point in the history
Contracts
  • Loading branch information
jacksmithinsulander authored Jul 13, 2024
2 parents 9c30887 + bf40754 commit 7c29a54
Show file tree
Hide file tree
Showing 30 changed files with 1,070 additions and 541 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged --verbose
# yarn lint-staged --verbose
3 changes: 0 additions & 3 deletions packages/foundry/.env.example

This file was deleted.

34 changes: 34 additions & 0 deletions packages/foundry/.github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: test

on: workflow_dispatch

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test
2 changes: 1 addition & 1 deletion packages/foundry/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ cache/
out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

Expand All @@ -11,4 +12,3 @@ docs/

# Dotenv file
.env
localhost.json
3 changes: 3 additions & 0 deletions packages/foundry/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
6 changes: 0 additions & 6 deletions packages/foundry/.prettier.json

This file was deleted.

66 changes: 66 additions & 0 deletions packages/foundry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## Foundry

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**

Foundry consists of:

- **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.

## Documentation

https://book.getfoundry.sh/

## Usage

### Build

```shell
$ forge build
```

### Test

```shell
$ forge test
```

### Format

```shell
$ forge fmt
```

### Gas Snapshots

```shell
$ forge snapshot
```

### Anvil

```shell
$ anvil
```

### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```

### Cast

```shell
$ cast <subcommand>
```

### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"transactions": [
{
"hash": "0x38a939f1737f1b2461434242f8d04064118c133ecb3c112f34ea604d2ccd2d7f",
"transactionType": "CREATE",
"contractName": "Notes",
"contractAddress": "0x5c823632d432ab578d584d55809044e5f1a39780",
"function": null,
"arguments": null,
"transaction": {
"from": "0xf6da1082b2b8952c73ed7220db5df38aec56a1b2",
"gas": "0xdb297",
"value": "0x0",
"input": "0x6080604052348015600f57600080fd5b50610b888061001f6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063c70e012c11610066578063c70e012c14610151578063cead5f7a14610174578063d91c9bad146101c0578063da239bf1146101e0578063f559b79b146101e857600080fd5b8063223094e9146100a3578063256e025a146100ea5780633ddbfa0a146100f257806343e1ebf014610133578063918f867414610148575b600080fd5b6100d26100b136600461066b565b600160209081526000928352604080842090915290825290205461ffff1681565b60405161ffff90911681526020015b60405180910390f35b6100d2602881565b6101266101003660046106b0565b600460209081526000938452604080852082529284528284209052825290205460ff1681565b6040516100e19190610709565b610146610141366004610732565b610230565b005b6100d261271081565b61016461015f36600461076c565b61038d565b6040516100e194939291906107f0565b6101ab610182366004610833565b600260209081526000938452604080852082529284528284209052825290205463ffffffff1681565b60405163ffffffff90911681526020016100e1565b6101d36101ce36600461086d565b610473565b6040516100e19190610903565b6100d2600a81565b61021a6101f6366004610959565b600360209081526000928352604080842090915290825290205464ffffffffff1681565b60405164ffffffffff90911681526020016100e1565b33600090815260036020526040812090846002811115610252576102526106f3565b6002811115610263576102636106f3565b815260208101919091526040016000908120805464ffffffffff169161028883610999565b825464ffffffffff9182166101009390930a9283029190920219909116179055503360009081526004602090815260408083206001600160a01b0385168452825280832061ffff861684529091529020805484919060ff191660018360028111156102f5576102f56106f3565b02179055506001600160a01b038116600090815260026020818152604080842061ffff87168552909152822091908590811115610334576103346106f3565b6002811115610345576103456106f3565b815260208101919091526040016000908120805463ffffffff1691610369836109c0565b91906101000a81548163ffffffff021916908363ffffffff16021790555050505050565b600060205281600052604060002081815481106103a957600080fd5b6000918252602090912060029091020180546001820180546001600160a01b0383169550600160a01b830460ff169450600160a81b90920461ffff1692916103f0906109dc565b80601f016020809104026020016040519081016040528092919081815260200182805461041c906109dc565b80156104695780601f1061043e57610100808354040283529160200191610469565b820191906000526020600020905b81548152906001019060200180831161044c57829003601f168201915b5050505050905084565b60408051608081018252600080825260208201819052918101919091526060808201526040518060800160405280336001600160a01b031681526020018360018111156104c2576104c26106f3565b8152602001600061ffff16815260200185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509390945250506001600160a01b03888116825260208281526040832080546001808201835591855293829020865160029095020180546001600160a01b03198116959094169485178155918601519596508695919450909284926001600160a81b0319161790600160a01b908490811115610581576105816106f3565b02179055506040820151815461ffff909116600160a81b0261ffff60a81b19909116178155606082015160018201906105ba9082610a7b565b5050506001600160a01b03851660009081526001602081905260408220919084908111156105ea576105ea6106f3565b60018111156105fb576105fb6106f3565b815260208101919091526040016000908120805461ffff169161061d83610b3a565b91906101000a81548161ffff021916908361ffff16021790555050949350505050565b80356001600160a01b038116811461065757600080fd5b919050565b80356002811061065757600080fd5b6000806040838503121561067e57600080fd5b61068783610640565b91506106956020840161065c565b90509250929050565b803561ffff8116811461065757600080fd5b6000806000606084860312156106c557600080fd5b6106ce84610640565b92506106dc60208501610640565b91506106ea6040850161069e565b90509250925092565b634e487b7160e01b600052602160045260246000fd5b602081016003831061071d5761071d6106f3565b91905290565b80356003811061065757600080fd5b60008060006060848603121561074757600080fd5b61075084610723565b925061075e6020850161069e565b91506106ea60408501610640565b6000806040838503121561077f57600080fd5b61078883610640565b946020939093013593505050565b600281106107a6576107a66106f3565b9052565b6000815180845260005b818110156107d0576020818501810151868301820152016107b4565b506000602082860101526020601f19601f83011685010191505092915050565b6001600160a01b03851681526108096020820185610796565b61ffff8316604082015260806060820152600061082960808301846107aa565b9695505050505050565b60008060006060848603121561084857600080fd5b61085184610640565b925061085f6020850161069e565b91506106ea60408501610723565b6000806000806060858703121561088357600080fd5b61088c85610640565b9350602085013567ffffffffffffffff8111156108a857600080fd5b8501601f810187136108b957600080fd5b803567ffffffffffffffff8111156108d057600080fd5b8760208284010111156108e257600080fd5b602091909101935091506108f86040860161065c565b905092959194509250565b602080825282516001600160a01b03168282015282015160009061092a6040840182610796565b5061ffff6040840151166060830152606083015160808084015261095160a08401826107aa565b949350505050565b6000806040838503121561096c57600080fd5b61097583610640565b915061069560208401610723565b634e487b7160e01b600052601160045260246000fd5b600064ffffffffff821664ffffffffff81036109b7576109b7610983565b60010192915050565b600063ffffffff821663ffffffff81036109b7576109b7610983565b600181811c908216806109f057607f821691505b602082108103610a1057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b601f821115610a7657806000526020600020601f840160051c81016020851015610a535750805b601f840160051c820191505b81811015610a735760008155600101610a5f565b50505b505050565b815167ffffffffffffffff811115610a9557610a95610a16565b610aa981610aa384546109dc565b84610a2c565b6020601f821160018114610add5760008315610ac55750848201515b600019600385901b1c1916600184901b178455610a73565b600084815260208120601f198516915b82811015610b0d5787850151825560209485019460019092019101610aed565b5084821015610b2b5786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b600061ffff821661ffff81036109b7576109b761098356fea26469706673582212204cd3dc89fa495e4af31394da182a24cefacd6cfeeb1be554b869598f4eeebccf64736f6c634300081a0033",
"nonce": "0x5c",
"chainId": "0xaa36a7"
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"status": "0x1",
"cumulativeGasUsed": "0x5812a0",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"type": "0x0",
"transactionHash": "0x38a939f1737f1b2461434242f8d04064118c133ecb3c112f34ea604d2ccd2d7f",
"transactionIndex": "0x1f",
"blockHash": "0xf026727585dbf02ac4952646fb9540708b2fb442632c659fbd1d0722d15dcbdf",
"blockNumber": "0x601b2c",
"gasUsed": "0xa8a1d",
"effectiveGasPrice": "0x183b2fca4",
"from": "0xf6da1082b2b8952c73ed7220db5df38aec56a1b2",
"to": null,
"contractAddress": "0x5c823632d432ab578d584d55809044e5f1a39780"
}
],
"libraries": [],
"pending": [],
"returns": {},
"timestamp": 1720815359,
"chain": 11155111,
"commit": "9136288"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"transactions": [
{
"hash": "0x38e33b52499d2c18b1676c774b0fdaf0e6cdf157fc3bacd2008c93fc085cc0ef",
"transactionType": "CREATE",
"contractName": "Notes",
"contractAddress": "0xf0cba52b7b24277ba894346cc44da27df6993a9b",
"function": null,
"arguments": null,
"transaction": {
"from": "0x199d51a2be04c65f325908911430e6ff79a15ce3",
"gas": "0xdb297",
"value": "0x0",
"input": "0x6080604052348015600f57600080fd5b50610b888061001f6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063c70e012c11610066578063c70e012c14610151578063cead5f7a14610174578063d91c9bad146101c0578063da239bf1146101e0578063f559b79b146101e857600080fd5b8063223094e9146100a3578063256e025a146100ea5780633ddbfa0a146100f257806343e1ebf014610133578063918f867414610148575b600080fd5b6100d26100b136600461066b565b600160209081526000928352604080842090915290825290205461ffff1681565b60405161ffff90911681526020015b60405180910390f35b6100d2602881565b6101266101003660046106b0565b600460209081526000938452604080852082529284528284209052825290205460ff1681565b6040516100e19190610709565b610146610141366004610732565b610230565b005b6100d261271081565b61016461015f36600461076c565b61038d565b6040516100e194939291906107f0565b6101ab610182366004610833565b600260209081526000938452604080852082529284528284209052825290205463ffffffff1681565b60405163ffffffff90911681526020016100e1565b6101d36101ce36600461086d565b610473565b6040516100e19190610903565b6100d2600a81565b61021a6101f6366004610959565b600360209081526000928352604080842090915290825290205464ffffffffff1681565b60405164ffffffffff90911681526020016100e1565b33600090815260036020526040812090846002811115610252576102526106f3565b6002811115610263576102636106f3565b815260208101919091526040016000908120805464ffffffffff169161028883610999565b825464ffffffffff9182166101009390930a9283029190920219909116179055503360009081526004602090815260408083206001600160a01b0385168452825280832061ffff861684529091529020805484919060ff191660018360028111156102f5576102f56106f3565b02179055506001600160a01b038116600090815260026020818152604080842061ffff87168552909152822091908590811115610334576103346106f3565b6002811115610345576103456106f3565b815260208101919091526040016000908120805463ffffffff1691610369836109c0565b91906101000a81548163ffffffff021916908363ffffffff16021790555050505050565b600060205281600052604060002081815481106103a957600080fd5b6000918252602090912060029091020180546001820180546001600160a01b0383169550600160a01b830460ff169450600160a81b90920461ffff1692916103f0906109dc565b80601f016020809104026020016040519081016040528092919081815260200182805461041c906109dc565b80156104695780601f1061043e57610100808354040283529160200191610469565b820191906000526020600020905b81548152906001019060200180831161044c57829003601f168201915b5050505050905084565b60408051608081018252600080825260208201819052918101919091526060808201526040518060800160405280336001600160a01b031681526020018360018111156104c2576104c26106f3565b8152602001600061ffff16815260200185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509390945250506001600160a01b03888116825260208281526040832080546001808201835591855293829020865160029095020180546001600160a01b03198116959094169485178155918601519596508695919450909284926001600160a81b0319161790600160a01b908490811115610581576105816106f3565b02179055506040820151815461ffff909116600160a81b0261ffff60a81b19909116178155606082015160018201906105ba9082610a7b565b5050506001600160a01b03851660009081526001602081905260408220919084908111156105ea576105ea6106f3565b60018111156105fb576105fb6106f3565b815260208101919091526040016000908120805461ffff169161061d83610b3a565b91906101000a81548161ffff021916908361ffff16021790555050949350505050565b80356001600160a01b038116811461065757600080fd5b919050565b80356002811061065757600080fd5b6000806040838503121561067e57600080fd5b61068783610640565b91506106956020840161065c565b90509250929050565b803561ffff8116811461065757600080fd5b6000806000606084860312156106c557600080fd5b6106ce84610640565b92506106dc60208501610640565b91506106ea6040850161069e565b90509250925092565b634e487b7160e01b600052602160045260246000fd5b602081016003831061071d5761071d6106f3565b91905290565b80356003811061065757600080fd5b60008060006060848603121561074757600080fd5b61075084610723565b925061075e6020850161069e565b91506106ea60408501610640565b6000806040838503121561077f57600080fd5b61078883610640565b946020939093013593505050565b600281106107a6576107a66106f3565b9052565b6000815180845260005b818110156107d0576020818501810151868301820152016107b4565b506000602082860101526020601f19601f83011685010191505092915050565b6001600160a01b03851681526108096020820185610796565b61ffff8316604082015260806060820152600061082960808301846107aa565b9695505050505050565b60008060006060848603121561084857600080fd5b61085184610640565b925061085f6020850161069e565b91506106ea60408501610723565b6000806000806060858703121561088357600080fd5b61088c85610640565b9350602085013567ffffffffffffffff8111156108a857600080fd5b8501601f810187136108b957600080fd5b803567ffffffffffffffff8111156108d057600080fd5b8760208284010111156108e257600080fd5b602091909101935091506108f86040860161065c565b905092959194509250565b602080825282516001600160a01b03168282015282015160009061092a6040840182610796565b5061ffff6040840151166060830152606083015160808084015261095160a08401826107aa565b949350505050565b6000806040838503121561096c57600080fd5b61097583610640565b915061069560208401610723565b634e487b7160e01b600052601160045260246000fd5b600064ffffffffff821664ffffffffff81036109b7576109b7610983565b60010192915050565b600063ffffffff821663ffffffff81036109b7576109b7610983565b600181811c908216806109f057607f821691505b602082108103610a1057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b601f821115610a7657806000526020600020601f840160051c81016020851015610a535750805b601f840160051c820191505b81811015610a735760008155600101610a5f565b50505b505050565b815167ffffffffffffffff811115610a9557610a95610a16565b610aa981610aa384546109dc565b84610a2c565b6020601f821160018114610add5760008315610ac55750848201515b600019600385901b1c1916600184901b178455610a73565b600084815260208120601f198516915b82811015610b0d5787850151825560209485019460019092019101610aed565b5084821015610b2b5786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b600061ffff821661ffff81036109b7576109b761098356fea26469706673582212202340c8d771aebc9d6c0a0897bf4b14e70981cf88a2a72e99b7f034da89e57fb664736f6c634300081a0033",
"nonce": "0x1f4",
"chainId": "0xaa36a7"
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"status": "0x1",
"cumulativeGasUsed": "0x891334",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"type": "0x2",
"transactionHash": "0x38e33b52499d2c18b1676c774b0fdaf0e6cdf157fc3bacd2008c93fc085cc0ef",
"transactionIndex": "0x40",
"blockHash": "0x2804f3fe5b97e9fae5974c61ba90809a64991df9f850984ba2571d18c243e872",
"blockNumber": "0x601b8e",
"gasUsed": "0xa8a1d",
"effectiveGasPrice": "0x15ed08428",
"from": "0x199d51a2be04c65f325908911430e6ff79a15ce3",
"to": null,
"contractAddress": "0xf0cba52b7b24277ba894346cc44da27df6993a9b"
}
],
"libraries": [],
"pending": [],
"returns": {},
"timestamp": 1720816598,
"chain": 11155111,
"commit": "e6f0ddb"
}
Loading

0 comments on commit 7c29a54

Please sign in to comment.