Upgrade to solidity ^0.8

pull/2435/head
yorhodes 3 years ago
parent a41755e7b9
commit 4c57fc8715
No known key found for this signature in database
GPG Key ID: 8C6573483BF95681
  1. 2
      .solhint.json
  2. 1
      contracts/AbcToken.sol
  3. 44
      contracts/TransferRouter.sol
  4. 23
      hardhat.config.ts
  5. 2
      interfaces/IAbcToken.sol
  6. 49
      package-lock.json
  7. 12
      package.json

@ -1,7 +1,7 @@
{ {
"extends": "solhint:recommended", "extends": "solhint:recommended",
"rules": { "rules": {
"compiler-version": ["error", "^0.6.11"], "compiler-version": ["error", ">=0.6.0"],
"func-visibility": ["warn", {"ignoreConstructors":true}], "func-visibility": ["warn", {"ignoreConstructors":true}],
"not-rely-on-time": "off" "not-rely-on-time": "off"
} }

@ -3,6 +3,7 @@ pragma solidity >=0.6.11;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {TransferRouter} from "./TransferRouter.sol";
import {IAbcToken} from "../interfaces/IAbcToken.sol"; import {IAbcToken} from "../interfaces/IAbcToken.sol";
contract AbcToken is IAbcToken, ERC20 { contract AbcToken is IAbcToken, ERC20 {

@ -1,19 +1,45 @@
// SPDX-License-Identifier: MIT OR Apache-2.0 // SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11; pragma solidity ^0.8.13;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {Router} from "@abacus-network/core/contracts/router/Router.sol";
// ============ Internal Imports ============
import {IAbcToken} from "../interfaces/IAbcToken.sol"; import {IAbcToken} from "../interfaces/IAbcToken.sol";
// ============ External Imports ============
import {Router} from "@abacus-network/core/contracts/router/Router.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract AbcRouter is Router { contract TransferRouter is Router {
// The address of the token contract. // The address of the token contract.
ERC20Mintable public token; IERC20 public token;
constructor(address _token) {
token = IERC20(_token);
}
error SenderNotToken();
modifier onlyToken() {
if (msg.sender != address(token)) {
revert SenderNotToken();
}
_;
}
// Dispatches a message to a remote router to mint `amount` to `recipient`. // Dispatches a message to a remote router to mint `amount` to `recipient`.
function transferRemote(uint32 domain, address sender, address recipient, uint256 amount) external onlyToken; function transferRemote(
uint32 domain,
address sender,
address recipient,
uint256 amount
) external onlyToken {}
// Mints message.amount to message.recipient. // Mints message.amount to message.recipient.
function handleTransferMessage(bytes memory message) internal; function handleTransferMessage(bytes memory message) internal {}
function handle(
uint32 _origin,
bytes32 _sender,
bytes calldata _message
) external override {
}
} }

@ -1,21 +1,28 @@
import 'solidity-coverage'; import '@abacus-network/hardhat';
import '@typechain/hardhat';
import '@nomiclabs/hardhat-waffle'; import '@nomiclabs/hardhat-waffle';
import '@typechain/hardhat';
import 'hardhat-gas-reporter'; import 'hardhat-gas-reporter';
import '@abacus-network/hardhat'; import 'solidity-coverage';
/** /**
* @type import('hardhat/config').HardhatUserConfig * @type import('hardhat/config').HardhatUserConfig
*/ */
module.exports = { module.exports = {
solidity: { solidity: {
version: '0.7.6', compilers: [
settings: { {
optimizer: { version: '0.8.13',
enabled: true,
runs: 999999,
}, },
{
version: '0.7.6',
// settings: {
// optimizer: {
// enabled: true,
// runs: 999999,
// },
// },
}, },
],
}, },
gasReporter: { gasReporter: {
currency: 'USD', currency: 'USD',

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0 // SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11; pragma solidity ^0.8.13;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

49
package-lock.json generated

@ -9,21 +9,21 @@
"version": "0.0.0", "version": "0.0.0",
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"dependencies": { "dependencies": {
"@abacus-network/apps": "file:../abacus-monorepo/solidity/apps",
"@abacus-network/core": "file:../abacus-monorepo/solidity/core",
"@abacus-network/hardhat": "file:../abacus-monorepo/typescript/hardhat",
"@abacus-network/sdk": "file:../abacus-monorepo/typescript/sdk", "@abacus-network/sdk": "file:../abacus-monorepo/typescript/sdk",
"@abacus-network/utils": "file:../abacus-monorepo/typescript/utils", "@abacus-network/utils": "file:../abacus-monorepo/typescript/utils",
"@ethersproject/bignumber": "^5.5.0", "@ethersproject/bignumber": "^5.5.0",
"@ethersproject/bytes": "^5.5.0", "@ethersproject/bytes": "^5.5.0",
"@openzeppelin/contracts": "~4.5.0",
"@openzeppelin/contracts-upgradeable": "~4.5.0",
"@summa-tx/memview-sol": "^2.0.0",
"ethers": "^5.4.7" "ethers": "^5.4.7"
}, },
"devDependencies": { "devDependencies": {
"@abacus-network/apps": "file:../abacus-monorepo/solidity/apps",
"@abacus-network/core": "file:../abacus-monorepo/solidity/core",
"@abacus-network/hardhat": "file:../abacus-monorepo/typescript/hardhat",
"@nomiclabs/hardhat-ethers": "^2.0.1", "@nomiclabs/hardhat-ethers": "^2.0.1",
"@nomiclabs/hardhat-waffle": "^2.0.1", "@nomiclabs/hardhat-waffle": "^2.0.1",
"@openzeppelin/contracts": "~3.4.2",
"@openzeppelin/contracts-upgradeable": "~3.4.2",
"@summa-tx/memview-sol": "^2.0.0",
"@typechain/ethers-v5": "~7.0.0", "@typechain/ethers-v5": "~7.0.0",
"@typechain/hardhat": "^2.0.1", "@typechain/hardhat": "^2.0.1",
"@types/mocha": "^9.1.0", "@types/mocha": "^9.1.0",
@ -44,7 +44,6 @@
"../abacus-monorepo/solidity/apps": { "../abacus-monorepo/solidity/apps": {
"name": "@abacus-network/apps", "name": "@abacus-network/apps",
"version": "0.0.0", "version": "0.0.0",
"dev": true,
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"dependencies": { "dependencies": {
"@abacus-network/core": "file:../core", "@abacus-network/core": "file:../core",
@ -79,7 +78,6 @@
"../abacus-monorepo/solidity/core": { "../abacus-monorepo/solidity/core": {
"name": "@abacus-network/core", "name": "@abacus-network/core",
"version": "0.0.1", "version": "0.0.1",
"dev": true,
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"dependencies": { "dependencies": {
"@abacus-network/utils": "^0.0.5", "@abacus-network/utils": "^0.0.5",
@ -111,7 +109,6 @@
"../abacus-monorepo/typescript/hardhat": { "../abacus-monorepo/typescript/hardhat": {
"name": "@abacus-network/hardhat", "name": "@abacus-network/hardhat",
"version": "0.0.5", "version": "0.0.5",
"dev": true,
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"dependencies": { "dependencies": {
"@abacus-network/core": "file:../../solidity/core", "@abacus-network/core": "file:../../solidity/core",
@ -1619,16 +1616,14 @@
} }
}, },
"node_modules/@openzeppelin/contracts": { "node_modules/@openzeppelin/contracts": {
"version": "3.4.2", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-3.4.2.tgz", "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.5.0.tgz",
"integrity": "sha512-z0zMCjyhhp4y7XKAcDAi3Vgms4T2PstwBdahiO0+9NaGICQKjynK3wduSRplTgk4LXmoO1yfDGO5RbjKYxtuxA==", "integrity": "sha512-fdkzKPYMjrRiPK6K4y64e6GzULR7R7RwxSigHS8DDp7aWDeoReqsQI+cxHV1UuhAqX69L1lAaWDxenfP+xiqzA=="
"dev": true
}, },
"node_modules/@openzeppelin/contracts-upgradeable": { "node_modules/@openzeppelin/contracts-upgradeable": {
"version": "3.4.2", "version": "4.5.2",
"resolved": "https://registry.npmjs.org/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-3.4.2.tgz", "resolved": "https://registry.npmjs.org/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.5.2.tgz",
"integrity": "sha512-mDlBS17ymb2wpaLcrqRYdnBAmP1EwqhOXMvqWk2c5Q1N1pm5TkiCtXM9Xzznh4bYsQBq0aIWEkFFE2+iLSN1Tw==", "integrity": "sha512-xgWZYaPlrEOQo3cBj97Ufiuv79SPd8Brh4GcFYhPgb6WvAq4ppz8dWKL6h+jLAK01rUqMRp/TS9AdXgAeNvCLA=="
"dev": true
}, },
"node_modules/@resolver-engine/core": { "node_modules/@resolver-engine/core": {
"version": "0.3.3", "version": "0.3.3",
@ -1887,8 +1882,7 @@
"node_modules/@summa-tx/memview-sol": { "node_modules/@summa-tx/memview-sol": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/@summa-tx/memview-sol/-/memview-sol-2.0.1.tgz", "resolved": "https://registry.npmjs.org/@summa-tx/memview-sol/-/memview-sol-2.0.1.tgz",
"integrity": "sha512-GuaXBYG6/aIjKae3UJSBS61J/IuK/NTuk2IJBpGxytkxN1p3ZdRNIp8HQAIOVoCKZQtvzdPaBWokzCk/LakA/Q==", "integrity": "sha512-GuaXBYG6/aIjKae3UJSBS61J/IuK/NTuk2IJBpGxytkxN1p3ZdRNIp8HQAIOVoCKZQtvzdPaBWokzCk/LakA/Q=="
"dev": true
}, },
"node_modules/@szmarczak/http-timer": { "node_modules/@szmarczak/http-timer": {
"version": "1.1.2", "version": "1.1.2",
@ -25000,16 +24994,14 @@
} }
}, },
"@openzeppelin/contracts": { "@openzeppelin/contracts": {
"version": "3.4.2", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-3.4.2.tgz", "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.5.0.tgz",
"integrity": "sha512-z0zMCjyhhp4y7XKAcDAi3Vgms4T2PstwBdahiO0+9NaGICQKjynK3wduSRplTgk4LXmoO1yfDGO5RbjKYxtuxA==", "integrity": "sha512-fdkzKPYMjrRiPK6K4y64e6GzULR7R7RwxSigHS8DDp7aWDeoReqsQI+cxHV1UuhAqX69L1lAaWDxenfP+xiqzA=="
"dev": true
}, },
"@openzeppelin/contracts-upgradeable": { "@openzeppelin/contracts-upgradeable": {
"version": "3.4.2", "version": "4.5.2",
"resolved": "https://registry.npmjs.org/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-3.4.2.tgz", "resolved": "https://registry.npmjs.org/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.5.2.tgz",
"integrity": "sha512-mDlBS17ymb2wpaLcrqRYdnBAmP1EwqhOXMvqWk2c5Q1N1pm5TkiCtXM9Xzznh4bYsQBq0aIWEkFFE2+iLSN1Tw==", "integrity": "sha512-xgWZYaPlrEOQo3cBj97Ufiuv79SPd8Brh4GcFYhPgb6WvAq4ppz8dWKL6h+jLAK01rUqMRp/TS9AdXgAeNvCLA=="
"dev": true
}, },
"@resolver-engine/core": { "@resolver-engine/core": {
"version": "0.3.3", "version": "0.3.3",
@ -25234,8 +25226,7 @@
"@summa-tx/memview-sol": { "@summa-tx/memview-sol": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/@summa-tx/memview-sol/-/memview-sol-2.0.1.tgz", "resolved": "https://registry.npmjs.org/@summa-tx/memview-sol/-/memview-sol-2.0.1.tgz",
"integrity": "sha512-GuaXBYG6/aIjKae3UJSBS61J/IuK/NTuk2IJBpGxytkxN1p3ZdRNIp8HQAIOVoCKZQtvzdPaBWokzCk/LakA/Q==", "integrity": "sha512-GuaXBYG6/aIjKae3UJSBS61J/IuK/NTuk2IJBpGxytkxN1p3ZdRNIp8HQAIOVoCKZQtvzdPaBWokzCk/LakA/Q=="
"dev": true
}, },
"@szmarczak/http-timer": { "@szmarczak/http-timer": {
"version": "1.1.2", "version": "1.1.2",

@ -20,17 +20,17 @@
"dependencies": { "dependencies": {
"@abacus-network/sdk": "file:../abacus-monorepo/typescript/sdk", "@abacus-network/sdk": "file:../abacus-monorepo/typescript/sdk",
"@abacus-network/utils": "file:../abacus-monorepo/typescript/utils", "@abacus-network/utils": "file:../abacus-monorepo/typescript/utils",
"@abacus-network/hardhat": "file:../abacus-monorepo/typescript/hardhat",
"@abacus-network/core": "file:../abacus-monorepo/solidity/core",
"@abacus-network/apps": "file:../abacus-monorepo/solidity/apps",
"@summa-tx/memview-sol": "^2.0.0",
"@openzeppelin/contracts": "~4.5.0",
"@openzeppelin/contracts-upgradeable": "~4.5.0",
"@ethersproject/bignumber": "^5.5.0", "@ethersproject/bignumber": "^5.5.0",
"@ethersproject/bytes": "^5.5.0", "@ethersproject/bytes": "^5.5.0",
"ethers": "^5.4.7" "ethers": "^5.4.7"
}, },
"devDependencies": { "devDependencies": {
"@abacus-network/hardhat": "file:../abacus-monorepo/typescript/hardhat",
"@abacus-network/core": "file:../abacus-monorepo/solidity/core",
"@abacus-network/apps": "file:../abacus-monorepo/solidity/apps",
"@openzeppelin/contracts": "~3.4.2",
"@openzeppelin/contracts-upgradeable": "~3.4.2",
"@summa-tx/memview-sol": "^2.0.0",
"@nomiclabs/hardhat-ethers": "^2.0.1", "@nomiclabs/hardhat-ethers": "^2.0.1",
"@nomiclabs/hardhat-waffle": "^2.0.1", "@nomiclabs/hardhat-waffle": "^2.0.1",
"@typechain/ethers-v5": "~7.0.0", "@typechain/ethers-v5": "~7.0.0",

Loading…
Cancel
Save