Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions graft/subnet-evm/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ tasks:
generate-bindings:
desc: Generates Go bindings from Solidity contracts in precompile
cmds:
- cmd: |
# Find and remove generated binding files in precompile directories only
find ./precompile -type f -name 'gen_*binding.go' -exec grep -l '^// Code generated - DO NOT EDIT\.$' {} \; | xargs -r rm
- cmd: find ./precompile -type f -name 'gen_*binding.go' -exec grep -l '^// Code generated - DO NOT EDIT\.$' {} \; | xargs -r rm
- cmd: find ./precompile -type f -name '*.abi' | xargs -r rm
- cmd: go generate ./precompile/...

lint:
Expand Down
3 changes: 3 additions & 0 deletions graft/subnet-evm/precompile/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
**/artifacts/
**/artifacts/*.abi
**/artifacts/*.bin

# IAllowList.abi gets generated as a side effect when compiling interfaces that inherit from it
contracts/*/IAllowList.abi
2 changes: 1 addition & 1 deletion graft/subnet-evm/precompile/allowlist/allowlist.abi
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@
"stateMutability": "nonpayable",
"type": "function"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

package bindings

// Step 1: Compile Solidity contracts to generate ABI and bin files
//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path . precompile/=../../../ --evm-version cancun AllowListTest.sol
// Step 2: Generate Go bindings from the compiled artifacts
//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IAllowList --abi artifacts/IAllowList.abi --bin artifacts/IAllowList.bin --out gen_allowlist_binding.go
// Step 1: Compile interface to generate ABI at top level
//go:generate sh -c "solc-v0.8.30 -o ../.. --overwrite --abi --pretty-json --evm-version cancun ../../IAllowList.sol && mv ../../IAllowList.abi ../../allowlist.abi"
// Step 2: Compile test contracts to generate ABI and bin files
//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path . --metadata-hash none precompile/=../../../ --evm-version cancun AllowListTest.sol
// Step 3: Generate Go bindings from the compiled artifacts
//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IAllowList --abi ../../allowlist.abi --bin artifacts/IAllowList.bin --out gen_allowlist_binding.go
//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type AllowListTest --abi artifacts/AllowListTest.abi --bin artifacts/AllowListTest.bin --out gen_allowlisttest_binding.go
// Step 3: Replace import paths in generated binding to use subnet-evm instead of libevm
// Step 4: Replace import paths in generated binding to use subnet-evm instead of libevm
// This is necessary because the libevm bindings package is not compatible with the subnet-evm simulated backend, which is used for testing.
//go:generate sh -c "sed -i.bak -e 's|github.com/ava-labs/libevm/accounts/abi|github.com/ava-labs/avalanchego/graft/subnet-evm/accounts/abi|g' -e 's|github.com/ava-labs/libevm/accounts/abi/bind|github.com/ava-labs/avalanchego/graft/subnet-evm/accounts/abi/bind|g' gen_allowlist_binding.go gen_allowlisttest_binding.go && rm -f gen_allowlist_binding.go.bak gen_allowlisttest_binding.go.bak"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 32 additions & 1 deletion graft/subnet-evm/precompile/contracts/feemanager/contract.abi
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,37 @@
"name": "FeeConfigChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "role",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "oldRole",
"type": "uint256"
}
],
"name": "RoleSet",
"type": "event"
},
{
"inputs": [],
"name": "getFeeConfig",
Expand Down Expand Up @@ -288,4 +319,4 @@
"stateMutability": "nonpayable",
"type": "function"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

package bindings

// Step 1: Compile Solidity contracts to generate ABI and bin files
//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path ../../../../.. precompile/=precompile/ --evm-version cancun FeeManagerTest.sol
// Step 2: Generate Go bindings from the compiled artifacts
//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IFeeManager --abi artifacts/IFeeManager.abi --bin artifacts/IFeeManager.bin --out gen_ifeemanager_binding.go
// Step 1: Compile interface to generate ABI at top level
//go:generate sh -c "solc-v0.8.30 -o ../.. --overwrite --abi --base-path ../../../../.. --pretty-json --evm-version cancun ../../IFeeManager.sol && mv ../../IFeeManager.abi ../../contract.abi"
// Step 2: Compile test contracts to generate ABI and bin files
//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path ../../../../.. --metadata-hash none --evm-version cancun FeeManagerTest.sol
// Step 3: Generate Go bindings from the compiled artifacts
//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IFeeManager --abi ../../contract.abi --bin artifacts/IFeeManager.bin --out gen_ifeemanager_binding.go
//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type FeeManagerTest --abi artifacts/FeeManagerTest.abi --bin artifacts/FeeManagerTest.bin --out gen_feemanagertest_binding.go
// Step 3: Replace import paths in generated binding to use subnet-evm instead of libevm
// Step 4: Replace import paths in generated binding to use subnet-evm instead of libevm
// This is necessary because the libevm bindings package is not compatible with the subnet-evm simulated backend, which is used for testing.
//go:generate sh -c "sed -i.bak -e 's|github.com/ava-labs/libevm/accounts/abi|github.com/ava-labs/avalanchego/graft/subnet-evm/accounts/abi|g' -e 's|github.com/ava-labs/libevm/accounts/abi/bind|github.com/ava-labs/avalanchego/graft/subnet-evm/accounts/abi/bind|g' gen_ifeemanager_binding.go gen_feemanagertest_binding.go && rm -f gen_ifeemanager_binding.go.bak gen_feemanagertest_binding.go.bak"
Loading