Skip to content

Commit

Permalink
prettier -w ChainReaderTestContract.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
reductionista committed Dec 23, 2023
1 parent ff0bc8e commit cdb5565
Showing 1 changed file with 81 additions and 76 deletions.
157 changes: 81 additions & 76 deletions contracts/src/v0.8/tests/ChainReaderTestContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,102 @@
pragma solidity ^0.8;

struct TestStruct {
int32 Field;
string DifferentField;
uint8 OracleId;
uint8[32] OracleIds;
address Account;
address[] Accounts;
int192 BigField;
MidLevelTestStruct NestedStruct;
int32 Field;
string DifferentField;
uint8 OracleId;
uint8[32] OracleIds;
address Account;
address[] Accounts;
int192 BigField;
MidLevelTestStruct NestedStruct;
}

struct MidLevelTestStruct {
bytes2 FixedBytes;
InnerTestStruct Inner;
bytes2 FixedBytes;
InnerTestStruct Inner;
}

struct InnerTestStruct {
int64 I;
string S;
int64 I;
string S;
}

contract LatestValueHolder {
event Triggered(
int32 field,
string differentField,
uint8 oracleId,
uint8[32] oracleIds,
address Account,
address[] Accounts,
int192 bigField,
MidLevelTestStruct nestedStruct);
event Triggered(
int32 field,
string differentField,
uint8 oracleId,
uint8[32] oracleIds,
address Account,
address[] Accounts,
int192 bigField,
MidLevelTestStruct nestedStruct
);

TestStruct[] private seen;
uint64[] private arr;
TestStruct[] private seen;
uint64[] private arr;

constructor() {
// See chain_reader_interface_tests.go in chainlink-relay
arr.push(3);
arr.push(4);
}
constructor() {
// See chain_reader_interface_tests.go in chainlink-relay
arr.push(3);
arr.push(4);
}

function AddTestStruct(
int32 field,
string calldata differentField,
uint8 oracleId,
uint8[32] calldata oracleIds,
address account,
address[] calldata accounts,
int192 bigField,
MidLevelTestStruct calldata nestedStruct) public {
seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct));
}
function AddTestStruct(
int32 field,
string calldata differentField,
uint8 oracleId,
uint8[32] calldata oracleIds,
address account,
address[] calldata accounts,
int192 bigField,
MidLevelTestStruct calldata nestedStruct
) public {
seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct));
}

function ReturnSeen(
int32 field,
string calldata differentField,
uint8 oracleId,
uint8[32] calldata oracleIds,
address account,
address[] calldata accounts,
int192 bigField,
MidLevelTestStruct calldata nestedStruct) pure public returns (TestStruct memory) {
return TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct);
}
function ReturnSeen(
int32 field,
string calldata differentField,
uint8 oracleId,
uint8[32] calldata oracleIds,
address account,
address[] calldata accounts,
int192 bigField,
MidLevelTestStruct calldata nestedStruct
) public pure returns (TestStruct memory) {
return TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct);
}

function GetElementAtIndex(uint256 i) public view returns (TestStruct memory) {
// See chain_reader_interface_tests.go in chainlink-relay
return seen[i-1];
}
function GetElementAtIndex(uint256 i) public view returns (TestStruct memory) {
// See chain_reader_interface_tests.go in chainlink-relay
return seen[i - 1];
}

function GetPrimitiveValue() public pure returns (uint64) {
// See chain_reader_interface_tests.go in chainlink-relay
return 3;
}
function GetPrimitiveValue() public pure returns (uint64) {
// See chain_reader_interface_tests.go in chainlink-relay
return 3;
}

function GetDifferentPrimitiveValue() public pure returns (uint64) {
// See chain_reader_interface_tests.go in chainlink-relay
return 1990;
}
function GetDifferentPrimitiveValue() public pure returns (uint64) {
// See chain_reader_interface_tests.go in chainlink-relay
return 1990;
}

function GetSliceValue() public view returns (uint64[] memory) {
return arr;
}
function GetSliceValue() public view returns (uint64[] memory) {
return arr;
}

function TriggerEvent(int32 field,
string calldata differentField,
uint8 oracleId,
uint8[32] calldata oracleIds,
address account,
address[] calldata accounts,
int192 bigField,
MidLevelTestStruct calldata nestedStruct) public {
emit Triggered(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct);
}
}
function TriggerEvent(
int32 field,
string calldata differentField,
uint8 oracleId,
uint8[32] calldata oracleIds,
address account,
address[] calldata accounts,
int192 bigField,
MidLevelTestStruct calldata nestedStruct
) public {
emit Triggered(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct);
}
}

0 comments on commit cdb5565

Please sign in to comment.