Skip to content

Commit

Permalink
update to solidity 8.20
Browse files Browse the repository at this point in the history
  • Loading branch information
andresaiello committed Aug 30, 2024
1 parent 0250c90 commit 8ec9bee
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 62 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"@changesets/cli": "^2.23.1",
"@nomicfoundation/hardhat-verify": "2.0.3",
"@nomiclabs/hardhat-ethers": "^2.0.5",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@typechain/ethers-v5": "^10.0.0",
"@typechain/hardhat": "^6.0.0",
Expand All @@ -55,8 +55,8 @@
"eslint-plugin-typescript-sort-keys": "2.1.0",
"ethereum-waffle": "^4.0.9",
"ethereumjs-utils": "^5.2.5",
"ethers": "5.6.8",
"hardhat": "2.12.6",
"ethers": "5.7.2",
"hardhat": "2.22.6",
"inquirer": "^8.2.4",
"mocha": "^10.2.0",
"ts-mocha": "^10.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";

contract InstantRewards is Ownable, Pausable, ReentrancyGuard, EIP712 {
contract InstantRewards is Ownable2Step, Pausable, ReentrancyGuard, EIP712 {
bytes32 private constant CLAIM_TYPEHASH =
keccak256("Claim(address to,uint256 sigExpiration,bytes32 taskId,uint256 amount)");

Expand All @@ -23,6 +23,7 @@ contract InstantRewards is Ownable, Pausable, ReentrancyGuard, EIP712 {

address public signerAddress;

event SignerUpdated(address indexed signerAddress);
event Claimed(address indexed to, bytes32 indexed taskId, uint256 amount);
event Withdrawn(address indexed wallet, uint256 amount);

Expand Down Expand Up @@ -51,7 +52,7 @@ contract InstantRewards is Ownable, Pausable, ReentrancyGuard, EIP712 {
if (block.timestamp > claimData.sigExpiration) revert SignatureExpired();
}

function claim(ClaimData memory claimData) external whenNotPaused nonReentrant {
function claim(ClaimData memory claimData) external nonReentrant whenNotPaused {
claimData.to = msg.sender;
_verify(claimData);

Expand All @@ -68,12 +69,15 @@ contract InstantRewards is Ownable, Pausable, ReentrancyGuard, EIP712 {
function setSignerAddress(address signerAddress_) external onlyOwner {
if (signerAddress_ == address(0)) revert InvalidAddress();
signerAddress = signerAddress_;
emit SignerUpdated(signerAddress_);
}

function withdraw(address wallet, uint256 amount) external onlyOwner {
if (wallet == address(0)) revert InvalidAddress();
if (amount > address(this).balance) revert TransferFailed();
payable(wallet).transfer(amount);
(bool success, ) = wallet.call{value: amount}("");
if (!success) revert TransferFailed();

emit Withdrawn(wallet, amount);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
pragma solidity ^0.8.20;

import "../xpNFT.sol";

Expand Down
2 changes: 1 addition & 1 deletion packages/zevm-app-contracts/contracts/xp-nft/xpNFT.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
pragma solidity ^0.8.20;

import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
Expand Down
3 changes: 1 addition & 2 deletions packages/zevm-app-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@openzeppelin/hardhat-upgrades": "^1.7.0-rc.0",
"@uniswap/v2-periphery": "1.1.0-beta.0",
"@zetachain/networks": "^4.0.0",
"@zetachain/protocol-contracts": "^4.0.1",
"ethers": "5.6.8"
"@zetachain/protocol-contracts": "^4.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ describe("Instant Rewards Contract test", () => {
expect(ownerAddr).to.be.eq(owner.address);
}
await instantRewards.transferOwnership(user.address);
await instantRewards.connect(user).acceptOwnership();
{
const ownerAddr = await instantRewards.owner();
expect(ownerAddr).to.be.eq(user.address);
Expand Down
Loading

0 comments on commit 8ec9bee

Please sign in to comment.