Transition from buidler to hardhat

pull/2466/head
Hadrien Croubois 2 years ago
parent 0db76e98f9
commit a0323d446c
  1. 20
      buidler.config.js
  2. 28
      hardhat.config.js
  3. 0
      hardhat/env-contract.js
  4. 4442
      package-lock.json
  5. 13
      package.json
  6. 2
      test/proxy/BeaconProxy.test.js
  7. 2
      test/proxy/TransparentUpgradeableProxy.behaviour.js
  8. 6
      test/proxy/UpgradeableProxy.behaviour.js

@ -1,20 +0,0 @@
const fs = require('fs');
const path = require('path');
usePlugin('solidity-coverage');
usePlugin('@nomiclabs/buidler-truffle5');
for (const f of fs.readdirSync(path.join(__dirname, 'buidler'))) {
require(path.join(__dirname, 'buidler', f));
}
module.exports = {
networks: {
buidlerevm: {
blockGasLimit: 10000000,
},
},
solc: {
version: '0.8.0',
},
};

@ -0,0 +1,28 @@
const fs = require('fs');
const path = require('path');
require("@nomiclabs/hardhat-truffle5");
require("@nomiclabs/hardhat-solhint");
require("solidity-coverage");
for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) {
require(path.join(__dirname, 'hardhat', f));
}
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.8.0",
settings: {
optimizer: {
enabled: false,
runs: 200,
},
},
networks: {
hardhat: {
blockGasLimit: 10000000,
},
},
};

4442
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -9,8 +9,8 @@
"/test/behaviors"
],
"scripts": {
"compile": "buidler compile",
"coverage": "buidler coverage",
"compile": "hardhat compile",
"coverage": "hardhat coverage",
"docs": "oz-docs",
"docs:watch": "npm run docs watch contracts 'docs/*.hbs'",
"prepare-docs": "scripts/prepare-docs.sh",
@ -24,7 +24,7 @@
"prepack": "scripts/prepack.sh",
"release": "scripts/release/release.sh",
"version": "scripts/release/version.sh",
"test": "buidler test"
"test": "hardhat test"
},
"repository": {
"type": "git",
@ -45,9 +45,9 @@
},
"homepage": "https://openzeppelin.com/contracts/",
"devDependencies": {
"@nomiclabs/buidler": "^1.4.8",
"@nomiclabs/buidler-truffle5": "^1.3.4",
"@nomiclabs/buidler-web3": "^1.3.4",
"@nomiclabs/hardhat-solhint": "^2.0.0",
"@nomiclabs/hardhat-truffle5": "^2.0.0",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@openzeppelin/docs-utils": "^0.1.0",
"@openzeppelin/gsn-helpers": "^0.2.3",
"@openzeppelin/gsn-provider": "^0.1.10",
@ -63,6 +63,7 @@
"eth-sig-util": "^3.0.0",
"ethereumjs-util": "^7.0.7",
"ethereumjs-wallet": "^1.0.1",
"hardhat": "^2.0.6",
"lodash.startcase": "^4.4.0",
"lodash.zip": "^4.2.0",
"micromatch": "^4.0.2",

@ -12,7 +12,7 @@ const BadBeaconNoImpl = artifacts.require('BadBeaconNoImpl');
const BadBeaconNotContract = artifacts.require('BadBeaconNotContract');
function toChecksumAddress (address) {
return ethereumjsUtil.toChecksumAddress('0x' + address.replace(/^0x/, '').padStart(40, '0'));
return ethereumjsUtil.toChecksumAddress('0x' + address.replace(/^0x/, '').padStart(40, '0').substr(-40));
}
const BEACON_LABEL = 'eip1967.proxy.beacon';

@ -20,7 +20,7 @@ const IMPLEMENTATION_LABEL = 'eip1967.proxy.implementation';
const ADMIN_LABEL = 'eip1967.proxy.admin';
function toChecksumAddress (address) {
return ethereumjsUtil.toChecksumAddress('0x' + address.replace(/^0x/, '').padStart(40, '0'));
return ethereumjsUtil.toChecksumAddress('0x' + address.replace(/^0x/, '').padStart(40, '0').substr(-40));
}
module.exports = function shouldBehaveLikeTransparentUpgradeableProxy (createProxy, accounts) {

@ -5,6 +5,10 @@ const { expect } = require('chai');
const DummyImplementation = artifacts.require('DummyImplementation');
function toChecksumAddress (address) {
return ethereumjsUtil.toChecksumAddress('0x' + address.replace(/^0x/, '').padStart(40, '0').substr(-40));
}
const IMPLEMENTATION_LABEL = 'eip1967.proxy.implementation';
function toChecksumAddress (address) {
@ -29,7 +33,7 @@ module.exports = function shouldBehaveLikeUpgradeableProxy (createProxy, proxyAd
const assertProxyInitialization = function ({ value, balance }) {
it('sets the implementation address', async function () {
const slot = '0x' + new BN(ethereumjsUtil.keccak256(Buffer.from(IMPLEMENTATION_LABEL))).subn(1).toString(16);
const implementation = toChecksumAddress(await web3.eth.getStorageAt(this.proxy, slot));
const implementation = toChecksumAddress((await web3.eth.getStorageAt(this.proxy, slot)).substr(-40));
expect(implementation).to.be.equal(this.implementation);
});

Loading…
Cancel
Save