-
Notifications
You must be signed in to change notification settings - Fork 260
fix(json-abi): handle globals and propagate attrs to globals #1047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
voith
wants to merge
9
commits into
alloy-rs:main
Choose a base branch
from
voith:fix/global-variables
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d0426c6
handle globals separately when emitting JSON ABI to solidity
voith 4a2884d
Improve JsonAbi printer indentation handling for globals and nested i…
voith 00b15c3
Propagate sol! derive attrs to non-interface JSON ABI items
voith 6586c7f
Merge branch 'main' into fix/global-variables
voith 02a9723
fix(json-abi): add regression test and adjust abi-to-sol formatting
voith 237c0f8
feat(sol-macro-input): add `#[sol(standalone_globals)]` to opt into r…
voith d6f5c2c
Merge branch 'main' into fix/global-variables
voith c7693ba
Merge branch 'main' into fix/global-variables
voith 2488678
Merge branch 'main' into fix/global-variables
DaniPopes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
|
voith marked this conversation as resolved.
|
This file contains hidden or 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,88 @@ | ||
| [ | ||
| { | ||
| "inputs": [ | ||
| { | ||
| "components": [ | ||
| { | ||
| "internalType": "uint256", | ||
| "name": "value", | ||
| "type": "uint256" | ||
| }, | ||
| { | ||
| "internalType": "enum GlobalEnum", | ||
| "name": "enum_", | ||
| "type": "uint8" | ||
| } | ||
| ], | ||
| "internalType": "struct GlobalStruct", | ||
| "name": "payload", | ||
| "type": "tuple" | ||
| } | ||
| ], | ||
| "name": "GlobalError", | ||
| "type": "error" | ||
| }, | ||
| { | ||
| "anonymous": false, | ||
| "inputs": [ | ||
| { | ||
| "components": [ | ||
| { | ||
| "internalType": "uint256", | ||
| "name": "value", | ||
| "type": "uint256" | ||
| }, | ||
| { | ||
| "internalType": "enum GlobalEnum", | ||
| "name": "enum_", | ||
| "type": "uint8" | ||
| } | ||
| ], | ||
| "indexed": false, | ||
| "internalType": "struct GlobalStruct", | ||
| "name": "payload", | ||
| "type": "tuple" | ||
| }, | ||
| { | ||
| "indexed": false, | ||
| "internalType": "GlobalUDT", | ||
| "name": "amount", | ||
| "type": "uint256" | ||
| } | ||
| ], | ||
| "name": "GlobalEvent", | ||
| "type": "event" | ||
| }, | ||
| { | ||
| "inputs": [ | ||
| { | ||
| "components": [ | ||
| { | ||
| "internalType": "enum GlobalEnum", | ||
| "name": "kind", | ||
| "type": "uint8" | ||
| }, | ||
| { | ||
| "internalType": "uint256", | ||
| "name": "count", | ||
| "type": "uint256" | ||
| } | ||
| ], | ||
| "internalType": "struct Interface.InterfaceStruct", | ||
| "name": "data", | ||
| "type": "tuple" | ||
| } | ||
| ], | ||
| "name": "emitGlobalEvent", | ||
| "outputs": [], | ||
| "stateMutability": "nonpayable", | ||
| "type": "function" | ||
| }, | ||
| { | ||
| "inputs": [], | ||
| "name": "triggerError", | ||
| "outputs": [], | ||
| "stateMutability": "pure", | ||
| "type": "function" | ||
| } | ||
| ] |
This file contains hidden or 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,22 @@ | ||
| library Interface { | ||
| struct InterfaceStruct { | ||
| GlobalEnum kind; | ||
| uint256 count; | ||
| } | ||
| } | ||
|
|
||
| interface ContractUsingGlobals { | ||
| type GlobalEnum is uint8; | ||
| type GlobalUDT is uint256; | ||
| struct GlobalStruct { | ||
| uint256 value; | ||
| GlobalEnum enum_; | ||
| } | ||
|
|
||
| error GlobalError(GlobalStruct payload); | ||
|
|
||
| event GlobalEvent(GlobalStruct payload, GlobalUDT amount); | ||
|
|
||
| function emitGlobalEvent(Interface.InterfaceStruct memory data) external; | ||
| function triggerError() external pure; | ||
| } |
This file contains hidden or 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,29 @@ | ||
| [ | ||
| { | ||
| "type": "function", | ||
| "name": "handle", | ||
| "inputs": [ | ||
| { | ||
| "name": "foobar", | ||
| "type": "tuple", | ||
| "internalType": "struct IHandler.FooBar", | ||
| "components": [ | ||
| { | ||
| "name": "foo", | ||
| "type": "tuple", | ||
| "internalType": "struct Foo", | ||
| "components": [ | ||
| { | ||
| "name": "newNumber", | ||
| "type": "uint256", | ||
| "internalType": "uint256" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "outputs": [], | ||
| "stateMutability": "nonpayable" | ||
| } | ||
| ] |
This file contains hidden or 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,13 @@ | ||
| library IHandler { | ||
| struct FooBar { | ||
| Foo foo; | ||
| } | ||
| } | ||
|
|
||
| interface Handler { | ||
| struct Foo { | ||
| uint256 newNumber; | ||
| } | ||
|
|
||
| function handle(IHandler.FooBar memory foobar) external; | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.