Skip to content

Commit

Permalink
rename events for return values
Browse files Browse the repository at this point in the history
  • Loading branch information
frangio committed Dec 30, 2022
1 parent 97d251b commit d914fd8
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 77 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.3.0

- Renamed events for return values from `$<function>_Returned` to `return$<function>`.

## 0.2.17

- Remove unnecessary dependency.
Expand Down
12 changes: 11 additions & 1 deletion contracts/Test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ library Lib {
return t.x;
}

function _testNonView() internal returns (uint) {
function _testNonView() internal returns (uint value) {
return msg.value;
}

Expand Down Expand Up @@ -236,6 +236,16 @@ contract WithInternalReturns {
counter++;
return true;
}

function dynamicReturnType() internal returns (string memory) {
counter++;
return "a";
}

function multipleReturns(uint256 x) internal returns (uint256, bytes32) {
counter++;
return (x, keccak256(abi.encode(x)));
}
}

contract HasReceiveFunction {
Expand Down
142 changes: 76 additions & 66 deletions src/core.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Generated by [AVA](https://avajs.dev).
constructor() {}␊
function $_testNotImported(NotImported ni) external {␊
return super._testNotImported(ni);␊
super._testNotImported(ni);␊
}␊
receive() external payable {}␊
Expand Down Expand Up @@ -75,7 +75,7 @@ Generated by [AVA](https://avajs.dev).
constructor() {}␊
function $_testNotImported(NotImported2 ni) external {␊
return super._testNotImported(ni);␊
super._testNotImported(ni);␊
}␊
receive() external payable {}␊
Expand Down Expand Up @@ -124,32 +124,32 @@ Generated by [AVA](https://avajs.dev).
return _x4;␊
}␊
function $_testFoo() external pure returns (uint256) {␊
return super._testFoo();␊
function $_testFoo() external pure returns (uint256 ret0) {␊
(ret0) = super._testFoo();␊
}␊
function $_testString() external pure returns (string memory) {␊
return super._testString();␊
function $_testString() external pure returns (string memory ret0) {␊
(ret0) = super._testString();␊
}␊
function $_testStruct() external pure returns (S memory) {␊
return super._testStruct();␊
function $_testStruct() external pure returns (S memory ret0) {␊
(ret0) = super._testStruct();␊
}␊
function $_testStructStorageOutput() external view returns (S memory) {␊
return super._testStructStorageOutput();␊
function $_testStructStorageOutput() external view returns (S memory ret0) {␊
(ret0) = super._testStructStorageOutput();␊
}␊
function $_testStructStorageInput(uint256 t) external view returns (S memory) {␊
return super._testStructStorageInput($v_S[t]);␊
function $_testStructStorageInput(uint256 t) external view returns (S memory ret0) {␊
(ret0) = super._testStructStorageInput($v_S[t]);␊
}␊
function $_testClash_S(uint256 t) external {␊
return super._testClash($v_S[t]);␊
super._testClash($v_S[t]);␊
}␊
function $_testClash_Foo_Z(uint256 t) external {␊
return super._testClash($v_Foo_Z[t]);␊
super._testClash($v_Foo_Z[t]);␊
}␊
receive() external payable {}␊
Expand Down Expand Up @@ -188,36 +188,36 @@ Generated by [AVA](https://avajs.dev).
return _x4;␊
}␊
function $_testBar() external pure returns (uint256) {␊
return super._testBar();␊
function $_testBar() external pure returns (uint256 ret0) {␊
(ret0) = super._testBar();␊
}␊
function $_testFoo() external pure returns (uint256) {␊
return super._testFoo();␊
function $_testFoo() external pure returns (uint256 ret0) {␊
(ret0) = super._testFoo();␊
}␊
function $_testString() external pure returns (string memory) {␊
return super._testString();␊
function $_testString() external pure returns (string memory ret0) {␊
(ret0) = super._testString();␊
}␊
function $_testStruct() external pure returns (S memory) {␊
return super._testStruct();␊
function $_testStruct() external pure returns (S memory ret0) {␊
(ret0) = super._testStruct();␊
}␊
function $_testStructStorageOutput() external view returns (S memory) {␊
return super._testStructStorageOutput();␊
function $_testStructStorageOutput() external view returns (S memory ret0) {␊
(ret0) = super._testStructStorageOutput();␊
}␊
function $_testStructStorageInput(uint256 t) external view returns (S memory) {␊
return super._testStructStorageInput($v_S[t]);␊
function $_testStructStorageInput(uint256 t) external view returns (S memory ret0) {␊
(ret0) = super._testStructStorageInput($v_S[t]);␊
}␊
function $_testClash_S(uint256 t) external {␊
return super._testClash($v_S[t]);␊
super._testClash($v_S[t]);␊
}␊
function $_testClash_Foo_Z(uint256 t) external {␊
return super._testClash($v_Foo_Z[t]);␊
super._testClash($v_Foo_Z[t]);␊
}␊
receive() external payable {}␊
Expand All @@ -228,7 +228,7 @@ Generated by [AVA](https://avajs.dev).
mapping(uint256 => S) internal $v_S;␊
event $_testNonView_Returned(uint256 arg0);␊
event return$_testNonView(uint256 value);␊
constructor() {}␊
Expand All @@ -240,22 +240,21 @@ Generated by [AVA](https://avajs.dev).
return Lib.PUBLIC_VAR;␊
}␊
function $_testLib() external pure returns (uint256) {␊
return Lib._testLib();␊
function $_testLib() external pure returns (uint256 ret0) {␊
(ret0) = Lib._testLib();␊
}␊
function $_testExt() external pure returns (uint256) {␊
return Lib._testExt();␊
function $_testExt() external pure returns (uint256 ret0) {␊
(ret0) = Lib._testExt();␊
}␊
function $_testStructStorageInput(uint256 t) external view returns (uint256) {␊
return Lib._testStructStorageInput($v_S[t]);␊
function $_testStructStorageInput(uint256 t) external view returns (uint256 ret0) {␊
(ret0) = Lib._testStructStorageInput($v_S[t]);␊
}␊
function $_testNonView() external payable returns (uint256) {␊
(uint256 ret0) = Lib._testNonView();␊
emit $_testNonView_Returned(ret0);␊
return (ret0);␊
function $_testNonView() external payable returns (uint256 value) {␊
(value) = Lib._testNonView();␊
emit return$_testNonView(value);␊
}␊
receive() external payable {}␊
Expand Down Expand Up @@ -299,7 +298,7 @@ Generated by [AVA](https://avajs.dev).
constructor(uint256 x) Parent1(x) {}␊
function $_testParent1() external {␊
return super._testParent1();␊
super._testParent1();␊
}␊
receive() external payable {}␊
Expand Down Expand Up @@ -327,7 +326,7 @@ Generated by [AVA](https://avajs.dev).
constructor(uint256 x) Parent1(x) {}␊
function $_testParent1() external {␊
return super._testParent1();␊
super._testParent1();␊
}␊
receive() external payable {}␊
Expand All @@ -339,7 +338,7 @@ Generated by [AVA](https://avajs.dev).
constructor(uint256 x, uint256 y) Parent1(x) Parent2(y) {}␊
function $_testParent1() external {␊
return super._testParent1();␊
super._testParent1();␊
}␊
receive() external payable {}␊
Expand All @@ -351,7 +350,7 @@ Generated by [AVA](https://avajs.dev).
constructor(uint256 x, uint256 y) Parent1(x) Parent2(y) {}␊
function $_testParent1() external {␊
return super._testParent1();␊
super._testParent1();␊
}␊
receive() external payable {}␊
Expand All @@ -363,7 +362,7 @@ Generated by [AVA](https://avajs.dev).
constructor(uint256 x, uint256 y, uint256 z, uint256 c) Parent1(x) Parent2(y) Parent3(z) Child4(c) {}␊
function $_testParent1() external {␊
return super._testParent1();␊
super._testParent1();␊
}␊
receive() external payable {}␊
Expand All @@ -377,15 +376,15 @@ Generated by [AVA](https://avajs.dev).
constructor() {}␊
function $_testEnumType(Types.Enum e) external {␊
return super._testEnumType(e);␊
super._testEnumType(e);␊
}␊
function $_testContractType(Types t) external {␊
return super._testContractType(t);␊
super._testContractType(t);␊
}␊
function $_testMappingType(uint256 m) external {␊
return super._testMappingType($v_mapping_uint256_uint256_[m]);␊
super._testMappingType($v_mapping_uint256_uint256_[m]);␊
}␊
receive() external payable {}␊
Expand All @@ -405,7 +404,7 @@ Generated by [AVA](https://avajs.dev).
constructor() {}␊
function $_chained() external {␊
return super._chained();␊
super._chained();␊
}␊
receive() external payable {}␊
Expand All @@ -417,7 +416,7 @@ Generated by [AVA](https://avajs.dev).
constructor() {}␊
function $_chained() external {␊
return super._chained();␊
super._chained();␊
}␊
receive() external payable {}␊
Expand All @@ -429,7 +428,7 @@ Generated by [AVA](https://avajs.dev).
constructor() {}␊
function $_chained() external {␊
return super._chained();␊
super._chained();␊
}␊
receive() external payable {}␊
Expand Down Expand Up @@ -478,30 +477,41 @@ Generated by [AVA](https://avajs.dev).
contract $WithInternalReturns is WithInternalReturns {␊
bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊
event $incrementInternal_Returned(uint256 arg0);␊
event return$incrementInternal(uint256 ret0);␊
event $someOverloaded_uint256_Returned(bool arg0);␊
event return$someOverloaded_uint256(bool ret0);␊
event $someOverloaded_bytes32_Returned(bool arg0);␊
event return$someOverloaded_bytes32(bool ret0);␊
event return$dynamicReturnType(string ret0);␊
event return$multipleReturns(uint256 ret0, bytes32 ret1);␊
constructor() {}␊
function $incrementInternal() external returns (uint256) {␊
(uint256 ret0) = super.incrementInternal();␊
emit $incrementInternal_Returned(ret0);␊
return (ret0);␊
function $incrementInternal() external returns (uint256 ret0) {␊
(ret0) = super.incrementInternal();␊
emit return$incrementInternal(ret0);␊
}␊
function $someOverloaded(uint256 arg0) external returns (bool ret0) {␊
(ret0) = super.someOverloaded(arg0);␊
emit return$someOverloaded_uint256(ret0);␊
}␊
function $someOverloaded(bytes32 arg0) external returns (bool ret0) {␊
(ret0) = super.someOverloaded(arg0);␊
emit return$someOverloaded_bytes32(ret0);␊
}␊
function $someOverloaded(uint256 arg0) external returns (bool) {␊
(bool ret0) = super.someOverloaded(arg0);␊
emit $someOverloaded_uint256_Returned(ret0);␊
return (ret0);␊
function $dynamicReturnType() external returns (string memory ret0) {␊
(ret0) = super.dynamicReturnType();␊
emit return$dynamicReturnType(ret0);␊
}␊
function $someOverloaded(bytes32 arg0) external returns (bool) {␊
(bool ret0) = super.someOverloaded(arg0);␊
emit $someOverloaded_bytes32_Returned(ret0);␊
return (ret0);␊
function $multipleReturns(uint256 x) external returns (uint256 ret0, bytes32 ret1) {␊
(ret0, ret1) = super.multipleReturns(x);␊
emit return$multipleReturns(ret0, ret1);␊
}␊
receive() external payable {}␊
Expand All @@ -519,7 +529,7 @@ Generated by [AVA](https://avajs.dev).
constructor() {}␊
function $_testNotImported(NotImported ni) external {␊
return super._testNotImported(ni);␊
super._testNotImported(ni);␊
}␊
receive() external payable {}␊
Expand Down
Binary file modified src/core.test.ts.snap
Binary file not shown.
Loading

0 comments on commit d914fd8

Please sign in to comment.