-
Notifications
You must be signed in to change notification settings - Fork 6.1k
[isoltest] Add support to query balance. #10873
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
Merged
+67
−6
Merged
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions
29
test/libsolidity/semanticTests/isoltestTesting/balance_other_contract.sol
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 @@ | ||
contract Other { | ||
constructor() payable { | ||
} | ||
function getAddress() public returns (address) { | ||
return address(this); | ||
} | ||
} | ||
contract ClientReceipt { | ||
Other other; | ||
constructor() payable { | ||
other = new Other{value:500}(); | ||
} | ||
function getAddress() public returns (address) { | ||
return other.getAddress(); | ||
} | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// constructor(), 2000 wei -> | ||
// gas irOptimized: 191881 | ||
// gas legacy: 235167 | ||
// gas legacyOptimized: 180756 | ||
// balance -> 1500 | ||
// gas irOptimized: 191881 | ||
// gas legacy: 235167 | ||
// gas legacyOptimized: 180756 | ||
// getAddress() -> 0xf01f7809444bd9a93a854361c6fae3f23d9e23db | ||
// balance: 0xf01f7809444bd9a93a854361c6fae3f23d9e23db -> 500 |
8 changes: 8 additions & 0 deletions
8
test/libsolidity/semanticTests/isoltestTesting/balance_with_balance.sol
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,8 @@ | ||
contract ClientReceipt { | ||
constructor() payable {} | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// constructor(), 1000 wei -> | ||
// balance -> 1000 |
8 changes: 8 additions & 0 deletions
8
test/libsolidity/semanticTests/isoltestTesting/balance_with_balance2.sol
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,8 @@ | ||
contract ClientReceipt { | ||
constructor() payable {} | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// constructor(), 1 ether -> | ||
// balance -> 1000000000000000000 |
7 changes: 7 additions & 0 deletions
7
test/libsolidity/semanticTests/isoltestTesting/balance_without_balance.sol
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,7 @@ | ||
contract ClientReceipt { | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// balance -> 0 | ||
// balance: 0x0000000000000000000000000000000000000000 -> 0 | ||
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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 |
---|---|---|
|
@@ -14,7 +14,9 @@ contract C { | |
// compileViaYul: also | ||
// ---- | ||
// constructor(), 2 wei: 3 -> | ||
// gas legacy: 148000 | ||
// state() -> 3 | ||
// balance() -> 2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll use both. |
||
// balance -> 2 | ||
// update(uint256): 4 | ||
// state() -> 4 |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the wei/ether suffix works on the returned value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no