Skip to content

Commit

Permalink
Update chainlink dep and extend new interface
Browse files Browse the repository at this point in the history
  • Loading branch information
alexroan committed Aug 30, 2023
1 parent 0fc41e0 commit 37de9d4
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/chainlink"]
path = lib/chainlink
branch = develop
url = https://github.com/smartcontractkit/chainlink
2 changes: 1 addition & 1 deletion lib/chainlink
Submodule chainlink updated 1091 files
2 changes: 1 addition & 1 deletion script/DeployDepositAutomation.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ contract DeployDepositAutomation is Script, TestData {
depositAutomation = new DepositAutomation(dataStore, reader, depositHandler);
vm.stopBroadcast();
}
}
}
2 changes: 1 addition & 1 deletion script/DeployMarketAutomation.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ contract DeployMarketAutomation is Script, TestData {
marketAutomation = new MarketAutomation(dataStore, reader, orderHandler);
vm.stopBroadcast();
}
}
}
2 changes: 1 addition & 1 deletion script/DeployWithdrawalAutomation.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ contract DeployWithdrawalAutomation is Script, TestData {
withdrawalAutomation = new WithdrawalAutomation(dataStore, reader, withdrawalHandler);
vm.stopBroadcast();
}
}
}
2 changes: 1 addition & 1 deletion src/DepositAutomation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ contract DepositAutomation is ILogAutomation, FeedLookupCompatibleInterface, GMX
/// @dev Reverts with custom errors if the event name is not equal to the expected event name (DepositCreated).
/// @dev In the success case, reverts with FeedLookup error containing relevant information for the feed lookup
/// @dev This function is only ever simulated off-chain, so gas is not a concern.
function checkLog(Log calldata log) external returns (bool, bytes memory) {
function checkLog(Log calldata log, bytes memory checkData) external returns (bool, bytes memory) {
// Decode Event Log 1
(
, //msgSender,
Expand Down
2 changes: 1 addition & 1 deletion src/MarketAutomation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ contract MarketAutomation is ILogAutomation, FeedLookupCompatibleInterface, GMXA
/// @dev Reverts with custom errors if the event name is not equal to the expected event name (OrderCreated), or if the orderType is not equal to the expected orderType [2,4]
/// @dev In the success case, reverts with FeedLookup error containing relevant information for the feed lookup lookup
/// @dev This function is only ever simulated off-chain, so gas is not a concern.
function checkLog(Log calldata log) external returns (bool, bytes memory) {
function checkLog(Log calldata log, bytes memory checkData) external returns (bool, bytes memory) {
// Decode Event Log 2
(
, //msgSender,
Expand Down
2 changes: 1 addition & 1 deletion src/WithdrawalAutomation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ contract WithdrawalAutomation is ILogAutomation, FeedLookupCompatibleInterface,
/// @dev Reverts with custom errors if the event name is not equal to the expected event name (WithdrawalCreated).
/// @dev In the success case, reverts with FeedLookup error containing relevant information for the feed lookup
/// @dev This function is only ever simulated off-chain, so gas is not a concern.
function checkLog(Log calldata log) external returns (bool, bytes memory) {
function checkLog(Log calldata log, bytes memory checkData) external returns (bool, bytes memory) {
// Decode Event Log 1
(
, //msgSender,
Expand Down
8 changes: 4 additions & 4 deletions test/DepositAutomation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ contract DepositAutomation_End2End is Test, TestData {
abi.encode(KEY, expectedMarketAddresses)
);
vm.expectRevert(encodedRevert);
s_depositAutomation.checkLog(s_log);
s_depositAutomation.checkLog(s_log, EMPTY_BYTES);

// Off-chain, decode revert and construct callback data
bytes[] memory values = new bytes[](2);
Expand Down Expand Up @@ -167,7 +167,7 @@ contract DepositAutomationTest_checkLog is Test, TestData {
abi.encode(KEY, expectedMarketAddresses)
)
);
s_depositAutomation.checkLog(s_log);
s_depositAutomation.checkLog(s_log, EMPTY_BYTES);
}

function test_checkLog_IncorrectEventName() public {
Expand All @@ -190,7 +190,7 @@ contract DepositAutomationTest_checkLog is Test, TestData {
DepositAutomation.DepositAutomation_IncorrectEventName.selector, incorrectLogName, "DepositCreated"
)
);
s_depositAutomation.checkLog(s_log);
s_depositAutomation.checkLog(s_log, EMPTY_BYTES);
}

///////////////////////////
Expand Down Expand Up @@ -224,7 +224,7 @@ contract DepositAutomationTest_checkLog is Test, TestData {
shortTokenSwapPath
);
vm.expectRevert();
s_depositAutomation.checkLog(log);
s_depositAutomation.checkLog(log, EMPTY_BYTES);
}
}

Expand Down
10 changes: 5 additions & 5 deletions test/MarketAutomation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ contract MarketAutomationTest_End2End is Test, TestData {
abi.encode(KEY, expectedMarketAddresses)
);
vm.expectRevert(encodedRevert);
s_marketAutomation.checkLog(s_log);
s_marketAutomation.checkLog(s_log, EMPTY_BYTES);

// Off-chain, decode revert and construct callback data
bytes[] memory values = new bytes[](2);
Expand Down Expand Up @@ -167,7 +167,7 @@ contract MarketAutomationTest_checkLog is Test, TestData {
abi.encode(KEY, expectedMarketAddresses)
)
);
s_marketAutomation.checkLog(s_log);
s_marketAutomation.checkLog(s_log, EMPTY_BYTES);
}

function test_checkLog_MarketAutomation_IncorrectEventName_reverts() public {
Expand All @@ -190,7 +190,7 @@ contract MarketAutomationTest_checkLog is Test, TestData {
MarketAutomation.MarketAutomation_IncorrectEventName.selector, incorrectLogName, "OrderCreated"
)
);
s_marketAutomation.checkLog(s_log);
s_marketAutomation.checkLog(s_log, EMPTY_BYTES);
}

function test_checkLog_MarketAutomation_IncorrectOrderType_reverts() public {
Expand All @@ -208,7 +208,7 @@ contract MarketAutomationTest_checkLog is Test, TestData {
swapPath
);
vm.expectRevert(abi.encodeWithSelector(MarketAutomation.MarketAutomation_IncorrectOrderType.selector, 5));
s_marketAutomation.checkLog(s_log);
s_marketAutomation.checkLog(s_log, EMPTY_BYTES);
}

///////////////////////////
Expand Down Expand Up @@ -242,7 +242,7 @@ contract MarketAutomationTest_checkLog is Test, TestData {
shortTokenSwapPath
);
vm.expectRevert();
s_marketAutomation.checkLog(log);
s_marketAutomation.checkLog(log, EMPTY_BYTES);
}
}

Expand Down
2 changes: 2 additions & 0 deletions test/TestData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ contract TestData {
string internal constant DEPOSIT_HANDLER_LABEL = "DEPOSIT_HANDLER";
string internal constant WITHDRAWAL_HANDLER_LABEL = "WITHDRAWAL_HANDLER";

bytes internal constant EMPTY_BYTES = "";

function _generateValidLog(
address msgSender,
uint256 blockNumber,
Expand Down
8 changes: 4 additions & 4 deletions test/WithdrawalAutomation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ contract WithdrawalAutomation_End2End is Test, TestData {
abi.encode(KEY, expectedMarketAddresses)
);
vm.expectRevert(encodedRevert);
s_withdrawalAutomation.checkLog(s_log);
s_withdrawalAutomation.checkLog(s_log, EMPTY_BYTES);

// Off-chain, decode revert and construct callback data
bytes[] memory values = new bytes[](2);
Expand Down Expand Up @@ -161,7 +161,7 @@ contract WithdrawalAutomationTest_checkLog is Test, TestData {
abi.encode(KEY, expectedMarketAddresses)
)
);
s_withdrawalAutomation.checkLog(s_log);
s_withdrawalAutomation.checkLog(s_log, EMPTY_BYTES);
}

function test_checkLog_IncorrectEventName() public {
Expand All @@ -186,7 +186,7 @@ contract WithdrawalAutomationTest_checkLog is Test, TestData {
"WithdrawalCreated"
)
);
s_withdrawalAutomation.checkLog(s_log);
s_withdrawalAutomation.checkLog(s_log, EMPTY_BYTES);
}

///////////////////////////
Expand Down Expand Up @@ -220,7 +220,7 @@ contract WithdrawalAutomationTest_checkLog is Test, TestData {
shortTokenSwapPath
);
vm.expectRevert();
s_withdrawalAutomation.checkLog(log);
s_withdrawalAutomation.checkLog(log, EMPTY_BYTES);
}
}

Expand Down

0 comments on commit 37de9d4

Please sign in to comment.