Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

resolve PR-470, PR-473, upgrade lodash #476

Merged
merged 2 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions contracts/Bridge.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;

import "./utils/AccessControl.sol";
Expand Down Expand Up @@ -109,8 +109,8 @@ contract Bridge is Pausable, AccessControl, SafeMath {
return (_relayerBit(relayer) & uint(proposal._yesVotes)) > 0;
}

function _msgSender() internal override view returns (address payable) {
address payable signer = msg.sender;
function _msgSender() internal override view returns (address) {
address signer = msg.sender;
if (msg.data.length >= 20 && isValidForwarder[signer]) {
assembly {
signer := shr(96, calldataload(sub(calldatasize(), 20)))
Expand Down
2 changes: 1 addition & 1 deletion contracts/CentrifugeAsset.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;

/**
Expand Down
8 changes: 4 additions & 4 deletions contracts/ERC1155Safe.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155Burnable.sol";
import "@openzeppelin/contracts/presets/ERC1155PresetMinterPauser.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/token/ERC1155/presets/ERC1155PresetMinterPauser.sol";

/**
@title Manages deposited ERC1155s.
Expand Down
8 changes: 4 additions & 4 deletions contracts/ERC20Safe.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";

/**
@title Manages deposited ERC20s.
Expand Down
31 changes: 24 additions & 7 deletions contracts/ERC721MinterBurnerPauser.sol
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;

// This is adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/presets/ERC721PresetMinterPauserAutoId.sol

import "./utils/AccessControl.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Burnable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Pausable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";


contract ERC721MinterBurnerPauser is Context, AccessControl, ERC721Burnable, ERC721Pausable {
contract ERC721MinterBurnerPauser is Context, AccessControl, ERC721Burnable, ERC721Pausable, ERC721URIStorage {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");

string public baseURI;

/**
* @dev Grants `DEFAULT_ADMIN_ROLE` and `MINTER_ROLE`to the account that
* deploys the contract.
Expand Down Expand Up @@ -77,7 +78,23 @@ contract ERC721MinterBurnerPauser is Context, AccessControl, ERC721Burnable, ERC
_unpause();
}

function tokenURI(uint256 tokenId) public view virtual override(ERC721, ERC721URIStorage) returns (string memory) {
return super.tokenURI(tokenId);
}

function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Pausable) {
super._beforeTokenTransfer(from, to, tokenId);
}

function _setBaseURI(string memory baseURI_) internal {
baseURI = baseURI_;
}

function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}

function _burn(uint256 tokenId) internal virtual override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
}
4 changes: 2 additions & 2 deletions contracts/ERC721Safe.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "./ERC721MinterBurnerPauser.sol";

Expand Down
6 changes: 3 additions & 3 deletions contracts/Forwarder.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/drafts/EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";

/**
@notice This contract refers to Openzeppelin's MinimalForwarder contract.
Expand Down
2 changes: 1 addition & 1 deletion contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;

contract Migrations {
address public owner;
Expand Down
2 changes: 1 addition & 1 deletion contracts/TestContracts.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;

import "./utils/SafeCast.sol";
Expand Down
8 changes: 4 additions & 4 deletions contracts/handlers/ERC1155Handler.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;

import "../interfaces/IDepositExecute.sol";
import "./HandlerHelpers.sol";
import "../ERC1155Safe.sol";
import "@openzeppelin/contracts/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155MetadataURI.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol";

contract ERC1155Handler is IDepositExecute, HandlerHelpers, ERC1155Safe, ERC1155Holder {
using ERC165Checker for address;
Expand Down
2 changes: 1 addition & 1 deletion contracts/handlers/ERC20Handler.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;

import "../interfaces/IDepositExecute.sol";
Expand Down
6 changes: 3 additions & 3 deletions contracts/handlers/ERC721Handler.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;

import "../interfaces/IDepositExecute.sol";
import "./HandlerHelpers.sol";
import "../ERC721Safe.sol";
import "@openzeppelin/contracts/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";


/**
Expand Down
4 changes: 2 additions & 2 deletions contracts/handlers/GenericHandler.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;

import "../interfaces/IGenericHandler.sol";
Expand Down Expand Up @@ -104,7 +104,7 @@ contract GenericHandler is IGenericHandler {
}
// metadataDepositer contains 0xdepositerAddressdepositerAddressdeposite************************
// Shift it 12 bytes right: 0x000000000000000000000000depositerAddressdepositerAddressdeposite
require(depositer == address(metadataDepositer >> 96), 'incorrect depositer in the data');
require(depositer == address(uint160(metadataDepositer >> 96)), 'incorrect depositer in the data');
}

require(_contractWhitelist[contractAddress], "provided contractAddress is not whitelisted");
Expand Down
2 changes: 1 addition & 1 deletion contracts/handlers/HandlerHelpers.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;

import "../interfaces/IERCHandler.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IBridge.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;

/**
@title Interface for Bridge contract.
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IDepositExecute.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;

/**
@title Interface for handler contracts that support deposits and deposit executions.
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IERCHandler.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;

/**
@title Interface to be used with handlers that support ERC20s and ERC721s.
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IGenericHandler.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.6.12;
pragma solidity 0.8.11;

/**
@title Interface for handler that handles generic deposits and deposit executions.
Expand Down
8 changes: 4 additions & 4 deletions contracts/utils/AccessControl.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;
pragma solidity 0.8.11;

// This is adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/access/AccessControl.sol
// The only difference is added getRoleMemberIndex(bytes32 role, address account) function.

import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/utils/Context.sol";

/**
* @dev Contract module that allows children to implement role-based access
Expand Down Expand Up @@ -109,7 +109,7 @@ abstract contract AccessControl is Context {
* @dev Returns the index of the account that have `role`.
*/
function getRoleMemberIndex(bytes32 role, address account) public view returns (uint256) {
return _roles[role].members._inner._indexes[bytes32(uint256(account))];
return _roles[role].members._inner._indexes[bytes32(uint256(uint160(account)))];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions contracts/utils/Pausable.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;
pragma solidity 0.8.11;


/**
Expand All @@ -27,7 +27,7 @@ contract Pausable {
/**
* @dev Initializes the contract in unpaused state.
*/
constructor () internal {
constructor () {
_paused = false;
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/SafeCast.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;
pragma solidity 0.8.11;


library SafeCast {
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/SafeMath.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;
pragma solidity 0.8.11;

/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
Expand Down
Loading