Skip to content

Commit

Permalink
wip: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
wellitongervickas committed Dec 6, 2023
1 parent d3d362c commit 5c9ad11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contracts-right.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pnpm hardhat deploy-adapter-contract --network 43113 --adapter "CCIPAdapter" --b

=========================

pnpm hardhat set-chain-settings --network 43113 --bridge-address 0x0214f538B87996Dc42924DCeeb84023D01C50dFC --evm-chain-id 80001 --non-evm-chain-id 12532609583862916517 --adapter-address 0x01Dfab90DC8C8E5F66E3fB51009B4c5D8820e44f ---target-adapter-address 0x45ACa774719B311fF4DA05724866DdBC18f3e31c --is-enabled true --gas-limit 4000000
pnpm hardhat set-chain-settings --network 43113 --bridge-address 0x0214f538B87996Dc42924DCeeb84023D01C50dFC --evm-chain-id 80001 --non-evm-chain-id 0x01Dfab90DC8C8E5F66E3fB51009B4c5D8820e44f12532609583862916517 --adapter-address 0x01Dfab90DC8C8E5F66E3fB51009B4c5D8820e44f ---target-adapter-address 0x45ACa774719B311fF4DA05724866DdBC18f3e31c --is-enabled true --gas-limit 4000000

# Bridge ERC721 using ERC20 token as fee

Expand Down
12 changes: 8 additions & 4 deletions contracts/adapters/CCIPAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ contract CCIPAdapter is BaseAdapter, CCIPReceiver, AutomationCompatibleInterface
IBridge.ERC721Receive[] private s_pendingMessagesToExecute;

/// @dev updateInterval is used to check in seconds if upkeep is needed
uint256 public s_updateInterval = 60;
uint256 public s_lastTimeStamp;
uint256 public s_defaultExecutionLimit;
uint256 private s_updateInterval = 60;
uint256 private s_lastTimeStamp;
uint256 private s_defaultExecutionLimit = 10;

error NoMessagesAvailable();

Expand Down Expand Up @@ -46,8 +46,12 @@ contract CCIPAdapter is BaseAdapter, CCIPReceiver, AutomationCompatibleInterface
function checkUpkeep(
bytes calldata /* checkData */
) external view override returns (bool upkeepNeeded, bytes memory /* performData */) {
upkeepNeeded = (block.timestamp - s_lastTimeStamp) > s_updateInterval;
if (s_pendingMessagesToExecute.length == 0) {
upkeepNeeded = false;
return (upkeepNeeded, "");
}

upkeepNeeded = (block.timestamp - s_lastTimeStamp) > s_updateInterval;
return (upkeepNeeded, "");
}

Expand Down

0 comments on commit 5c9ad11

Please sign in to comment.