Skip to content

Commit

Permalink
Merge branch 'master' into demo-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Evalir committed Dec 3, 2020
2 parents 184291f + d6bf24f commit 4d646c5
Show file tree
Hide file tree
Showing 27 changed files with 240 additions and 806 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/contracts-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
path: |
packages/*/cache
packages/*/artifacts
packages/*/typechain
~/.cache/buidler-nodejs/
~/.cache/hardhat-nodejs/
key: contracts-${{ hashFiles('packages/*/contracts/**/*.sol') }}
Expand Down Expand Up @@ -72,7 +71,6 @@ jobs:
path: |
packages/*/cache
packages/*/artifacts
packages/*/typechain
~/.cache/buidler-nodejs/
~/.cache/hardhat-nodejs/
key: contracts-${{ hashFiles('packages/*/contracts/**/*.sol') }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"start:dev": "cd ./packages/govern-server/ && yarn start:containers",
"start:server": "yarn workspace @aragon/govern-server start:server",
"coverage": "lerna run --stream --concurrency 1 coverage",
"build:contracts": "lerna run --scope=@aragon/govern-core --scope=erc3k --scope=@aragon/govern-contract-utils --scope=@aragon/govern-create --stream build",
"build:contracts": "lerna run --scope=erc3k --scope=@aragon/govern-contract-utils --scope=@aragon/govern-core --scope=@aragon/govern-create --scope=@aragon/govern-token --stream compile",
"compile:cached": "lerna run --stream compile:cached",
"build:subgraph": "lerna run --scope=@aragon/govern-subgraph --stream build",
"deploy:subgraph:rinkeby": "lerna run --scope=@aragon/govern-subgraph --stream deploy-rinkeby",
Expand Down
2 changes: 1 addition & 1 deletion packages/erc3k/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
node_modules
yarn-error.log

#Buidler files
# Hardhat files
abi
artifacts
cache
Expand Down
31 changes: 0 additions & 31 deletions packages/erc3k/buidler.config.ts

This file was deleted.

28 changes: 28 additions & 0 deletions packages/erc3k/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { HardhatUserConfig } from 'hardhat/config'

import '@nomiclabs/hardhat-ethers'
import '@nomiclabs/hardhat-waffle'
import 'hardhat-abi-exporter'
import 'hardhat-typechain'
import 'solidity-coverage'

const ETH_KEY = process.env.ETH_KEY
const accounts = ETH_KEY ? ETH_KEY.split(',') : []

const config: HardhatUserConfig = {
solidity: {
version: '0.6.8',
},
networks: {
coverage: {
url: 'http://localhost:8555',
allowUnlimitedContractSize: true,
},
rinkeby: {
url: 'https://rinkeby.eth.aragon.network',
accounts,
},
},
}

export default config
32 changes: 15 additions & 17 deletions packages/erc3k/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,31 @@
"@aragon/govern-token": "^1.0.0-beta.12"
},
"devDependencies": {
"@nomiclabs/buidler": "^1.4.7",
"@nomiclabs/buidler-ethers": "^2.0.0",
"@nomiclabs/buidler-waffle": "^2.0.0",
"@typechain/ethers-v5": "^2.0.0",
"@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.0",
"@typechain/ethers-v5": "^4.0.0",
"@types/chai": "^4.2.13",
"@types/mocha": "^8.0.3",
"@types/node": "^14.11.8",
"buidler-extract": "^1.0.0",
"buidler-typechain": "^0.2.1",
"chai": "^4.2.0",
"ethereum-waffle": "^3.0.0",
"ethers": "^5.0.0",
"solidity-coverage": "^0.7.10",
"hardhat": "^2.0.3",
"hardhat-abi-exporter": "^2.0.6",
"hardhat-typechain": "^0.3.3",
"solidity-coverage": "^0.7.12",
"ts-generator": "0.1.1",
"ts-node": "^9.0.0",
"typechain": "3.0.0",
"typescript": "^4.0.3"
"typechain": "^4.0.0",
"typescript": "^4.1.2"
},
"scripts": {
"build": "yarn compile && buidler typechain",
"clean": "rm -rf artifacts",
"compile": "buidler compile --force",
"compile:cached": "buidler compile",
"test": "yarn build && buidler test",
"coverage": "yarn build && SOLIDITY_COVERAGE=true buidler coverage --network coverage",
"abi:extract": "buidler-extract --output abi/ --keys abi",
"prepublishOnly": "yarn test && yarn compile && yarn abi:extract -- --no-compile"
"clean": "rm -rf abi artifacts cache typechain",
"compile": "hardhat compile --force",
"compile:cached": "hardhat compile",
"test": "hardhat test",
"coverage": "hardhat coverage --network coverage --temp artifacts",
"prepublishOnly": "yarn clean && yarn compile && yarn test"
},
"gitHead": "aabbf6bd2dac11872ba9bb1f1dc8fffb6044aa7c"
}
36 changes: 20 additions & 16 deletions packages/erc3k/test/erc3k-data.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ethers } from '@nomiclabs/buidler'
import { ethers } from 'hardhat'
import { expect } from 'chai'
import { keccak256, defaultAbiCoder, solidityPack } from 'ethers/lib/utils'
import { Erc3000DataLibTest, Erc3000DataLibTestFactory } from '../typechain'
import { ERC3000DataLibTest, ERC3000DataLibTest__factory } from '../typechain'

let deposit = {
token: '0xb794f5ea0ba39494ce839613fffba74279579268',
Expand Down Expand Up @@ -86,39 +86,43 @@ function getConfigHash(): string {
)
}

describe.skip('ERC3000Data', function () {
let erc3kDataLib: Erc3000DataLibTest
describe('ERC3000Data', function () {
let erc3kDataLib: ERC3000DataLibTest
let chainId: number

beforeEach(async () => {
const ERC3000DataLibTest = (await ethers.getContractFactory(
'ERC3000DataLibTest'
)) as Erc3000DataLibTestFactory
)) as ERC3000DataLibTest__factory

erc3kDataLib = await ERC3000DataLibTest.deploy()
chainId = (await ethers.provider.getNetwork()).chainId
})

it('calls testConfigHash and returns the expected hash', async () => {
expect(
await erc3kDataLib.testConfigHash(container.config)
).to.be.equal(getConfigHash())
expect(await erc3kDataLib.testConfigHash(container.config)).to.be.equal(
getConfigHash()
)
})

it('calls testPayloadHash and returns the expected hash', async () => {
expect(
await erc3kDataLib.testPayloadHash(container.payload)
).to.be.equal(getPayloadHash())
expect(await erc3kDataLib.testPayloadHash(container.payload)).to.be.equal(
getPayloadHash()
)
})

it('calls testContainerHash and returns the expected hash', async () => {
expect(
await erc3kDataLib.testContainerHash(container)
).to.be.equal(
it.skip('calls testContainerHash and returns the expected hash', async () => {
expect(await erc3kDataLib.testContainerHash(container)).to.be.equal(
keccak256(
solidityPack(
['string', 'address', 'uint', 'bytes32', 'bytes32'],
['erc3k-v1', erc3kDataLib.address, chainId, getPayloadHash(), getConfigHash()]
[
'erc3k-v1',
erc3kDataLib.address,
chainId,
getPayloadHash(),
getConfigHash(),
]
)
)
)
Expand Down
8 changes: 4 additions & 4 deletions packages/erc3k/test/erc3k-exec.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ethers } from '@nomiclabs/buidler'
import { Erc3000ExecutorMock, Erc3000ExecutorMockFactory } from '../typechain'
import { ethers } from 'hardhat'
import { ERC3000ExecutorMock, ERC3000ExecutorMock__factory } from '../typechain'

describe('ERC3000 Executor', function () {
let erc3kExec: Erc3000ExecutorMock
let erc3kExec: ERC3000ExecutorMock

beforeEach(async () => {
const ERC3000Executor = (await ethers.getContractFactory(
'ERC3000ExecutorMock'
)) as Erc3000ExecutorMockFactory
)) as ERC3000ExecutorMock__factory
erc3kExec = await ERC3000Executor.deploy()
})
})
8 changes: 4 additions & 4 deletions packages/erc3k/test/erc3k.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ethers } from '@nomiclabs/buidler'
import { Erc3000Mock, Erc3000MockFactory } from '../typechain'
import { ethers } from 'hardhat'
import { ERC3000Mock, ERC3000Mock__factory } from '../typechain'

describe('ERC3000', function () {
let erc3k: Erc3000Mock
let erc3k: ERC3000Mock

beforeEach(async () => {
const ERC3000 = (await ethers.getContractFactory(
'ERC3000Mock'
)) as Erc3000MockFactory
)) as ERC3000Mock__factory
erc3k = await ERC3000.deploy()
})
})
16 changes: 0 additions & 16 deletions packages/erc3k/tsconfig.json

This file was deleted.

4 changes: 4 additions & 0 deletions packages/govern-contract-utils/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ yarn-error.log
cache
artifacts
typechain


coverage/
coverage.json
16 changes: 7 additions & 9 deletions packages/govern-contract-utils/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import { HardhatUserConfig, task } from 'hardhat/config'
import { HardhatUserConfig } from 'hardhat/config'

import '@nomiclabs/hardhat-ethers'
import '@nomiclabs/hardhat-waffle'
import 'hardhat-typechain'

task('accounts', 'Prints the list of accounts', async (_, { ethers }) => {
const accounts = await ethers.getSigners()

for (const account of accounts) {
console.log(await account.getAddress())
}
})
import 'solidity-coverage'

const config: HardhatUserConfig = {
solidity: {
version: '0.6.8',
},
networks: {
coverage: {
url: 'http://localhost:8555',
},
},
}

export default config
31 changes: 15 additions & 16 deletions packages/govern-contract-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,26 @@
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.0",
"chai": "^4.2.0",
"ethereum-waffle": "^3.0.0",
"ethers": "^5.0.0",
"hardhat": "^2.0.4"
},
"scripts": {
"build": "yarn compile && hardhat typechain",
"clean": "rm -rf artifacts",
"compile": "yarn hardhat compile --force",
"compile:cached": "yarn hardhat compile",
"test": "yarn build && yarn hardhat test",
"prepublishOnly": "yarn test && yarn compile"
},
"dependencies": {
"@typechain/ethers-v5": "^2.0.0",
"@typechain/ethers-v5": "^4.0.0",
"@types/chai": "^4.2.14",
"@types/mocha": "^8.0.3",
"@types/node": "^14.14.6",
"chai": "^4.2.0",
"ethereum-waffle": "^3.0.0",
"ethers": "^5.0.0",
"hardhat": "^2.0.3",
"hardhat-typechain": "^0.3.3",
"solidity-coverage": "^0.7.12",
"ts-generator": "^0.1.1",
"ts-node": "^9.0.0",
"typechain": "^3.0.0"
"typechain": "^4.0.0"
},
"scripts": {
"clean": "rm -rf artifacts cache typechain",
"compile": "hardhat compile --force",
"compile:cached": "hardhat compile",
"test": "hardhat test",
"coverage": "hardhat coverage --network coverage --temp artifacts",
"prepublishOnly": "yarn clean && yarn compile && yarn test"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { expect } from 'chai'
import { ethers } from 'hardhat'
import { Signer } from 'ethers'
import {
Acl,
AclFactory
ACL,
ACL__factory
} from '../typechain'

const ERRORS = {
Expand All @@ -27,8 +27,8 @@ describe('ACL', function () {
let signers: Signer[]
let root: string
let notRoot: string
let acl: Acl
let aclNotRoot: Acl
let acl: ACL
let aclNotRoot: ACL

before(async () => {
signers = await ethers.getSigners()
Expand All @@ -37,14 +37,14 @@ describe('ACL', function () {
})

beforeEach(async () => {
const ACL = (await ethers.getContractFactory('ACL')) as AclFactory
const ACL = (await ethers.getContractFactory('ACL')) as ACL__factory
acl = await ACL.deploy(root)
aclNotRoot = await acl.connect(signers[1])
})

const grant = (inst: Acl, role = ROLE, who = notRoot) => inst.grant(role, who)
const revoke = (inst: Acl, role = ROLE, who = notRoot) => inst.revoke(role, who)
const freeze = (inst: Acl, role = ROLE) => inst.freeze(role)
const grant = (inst: ACL, role = ROLE, who = notRoot) => inst.grant(role, who)
const revoke = (inst: ACL, role = ROLE, who = notRoot) => inst.revoke(role, who)
const freeze = (inst: ACL, role = ROLE) => inst.freeze(role)

const assertRole = async (shouldHaveRole = true, role = ROLE, who = notRoot) =>
expect(await acl.roles(role, who)).to.equal(shouldHaveRole ? ALLOW_ROLE : NO_ROLE)
Expand Down
Loading

0 comments on commit 4d646c5

Please sign in to comment.