Skip to content

Instantly share code, notes, and snippets.

@ByteAtATime
Created May 27, 2024 03:25
Show Gist options
  • Save ByteAtATime/7e5463948302768ac400f96ab474221d to your computer and use it in GitHub Desktop.
Save ByteAtATime/7e5463948302768ac400f96ab474221d to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
contract BetterTxResultTest {
struct SimpleStruct {
uint256 val;
uint256 secondVal;
bool flag;
}
struct ComplexStruct {
uint256 val;
bytes data;
uint256[5] arr;
}
function simpleTuple(uint256 _val) public pure returns (uint256, uint256) {
return (_val, _val * 2);
}
function simpleStruct(uint256 _val) public pure returns (SimpleStruct memory) {
return Simple(_val, _val * 2, true);
}
function simpleInt(uint256 _val) public pure returns (uint256) {
return _val;
}
function complexStruct(uint256 _val) public pure returns (ComplexStruct memory) {
return RandomStruct(_val, abi.encodePacked(_val), [_val, _val * 2, _val * 3, _val * 4, _val * 5]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment