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

Commit

Permalink
Upgrade to node 12 + first steps towards trading engine integration (#2)
Browse files Browse the repository at this point in the history
* import contracts from maker-otc

* simple_market: use our math and ERC-20 definitions instead
expiring_market: remove ability to stop prematurely

* remove note

* step towards trading engine deployment

* fix build

* fix build
  • Loading branch information
hiddentao committed Oct 31, 2019
1 parent 4382990 commit 4c6e3f1
Show file tree
Hide file tree
Showing 15 changed files with 2,237 additions and 1,863 deletions.
7 changes: 5 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2.1
executors:
smart_contracts:
docker:
- image: circleci/node:10.16.0
- image: circleci/node:12.13.0
- image: trufflesuite/ganache-cli
command: ganache-cli -a 10

Expand Down Expand Up @@ -36,12 +36,15 @@ jobs:
path: ~/repo
- install_node_modules:
executor: contracts
- run:
name: Setup submodules
command: git submodule init && git submodule update
- run:
name: Compile
command: yarn compile
- run:
name: Deploy initial contracts
command: yarn migrate
command: yarn deploy:local
- run:
name: Run tests with coverage
command: yarn coverage
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ log/*.log
.deployment.js
ganache.log
.0x*
scTopics
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "maker-otc"]
path = maker-otc
url = https://github.com/nayms/maker-otc.git
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,21 @@ console.log(events)

## Development

**Note: Requires Node 12+**

Install dependencies:

```
yarn
```

Initialize git submodules (for maker-otc trading engine):

```
git submodule init
git submodule update
```

First, run the dev network in a separate terminal:

```
Expand All @@ -82,7 +91,7 @@ yarn devnet
Now deploy the contracts to it:

```
yarn migrate
yarn deploy:local
```

Now you can run the tests:
Expand Down
1 change: 1 addition & 0 deletions maker-otc
Submodule maker-otc added at b5b2a0
5 changes: 5 additions & 0 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ module.exports = async (deployer, network, accounts) => {
await deployer.deploy(ACL)
await deployer.deploy(FUCImpl, ACL.address, "fucImplementation")
await deployer.deploy(FUCDeployer, ACL.address, FUCImpl.address)

if (network !== 'coverage') {
const MatchingMarket = artifacts.require("./MatchingMarket.sol")
await deployer.deploy(MatchingMarket, '0xFFFFFFFFFFFFFFFF')
}
}
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nayms/contracts",
"version": "1.0.0-2",
"version": "1.0.0",
"description": "Nayms smart contracts",
"main": "index.js",
"publishConfig": {
Expand All @@ -19,8 +19,8 @@
"profile": "MODE=profile yarn test && istanbul report lcov",
"test": "yarn truffle test --network test",
"trace": "MODE=trace yarn test",
"compile": "yarn truffle compile",
"migrate": "yarn truffle migrate",
"copy-maker-otc-artifacts": "cp maker-otc/build/contracts/*.json build/contracts",
"compile": "yarn truffle compile && yarn copy-maker-otc-artifacts",
"sol-compiler": "sol-compiler",
"sol-compiler:watch": "sol-compiler -w",
"deploy:mainnet": "yarn truffle networks --clean && yarn truffle migrate --network mainnet && scripts/extractDeployedAddresses.js",
Expand All @@ -33,7 +33,7 @@
"author": "Ramesh Nair <ram@hiddentao.com>",
"license": "ISC",
"devDependencies": {
"@0x/sol-compiler": "^3.1.9",
"@0x/sol-compiler": "^3.1.15",
"@0x/sol-profiler": "^3.1.8",
"@0x/sol-trace": "^2.0.14",
"argv": "0.0.2",
Expand Down Expand Up @@ -63,17 +63,16 @@
"truffle": "^5.0.40",
"truffle-hdwallet-provider": "^1.0.0-web3one.0",
"uuid": "^3.0.1",
"web3": "1.0.0-beta.33",
"web3": "1.2.2",
"web3-eth-abi": "^1.0.0-beta.55",
"web3-provider-engine": "^15.0.0",
"web3-utils": "^1.0.0-beta.36",
"yargs": "^9.0.1"
},
"dependencies": {
"chalk": "^2.4.2",
"ethereum-event-logs": "^1.3.1"
},
"engines": {
"node": ">=10.15.1"
"node": ">=12.0.0"
}
}
3 changes: 1 addition & 2 deletions test/acl.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { toHex, toWei, sha3 } from 'web3-utils'

import { ensureErc1820RegistryIsDeployed } from '../migrations/utils'
import { extractEventArgs } from './utils'
import { events } from '../'
import { toHex, toWei, sha3 } from './utils/web3'

const ACL = artifacts.require("./base/ACL.sol")

Expand Down
2 changes: 1 addition & 1 deletion test/fuc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toHex, toWei, sha3, asciiToHex } from 'web3-utils'
import { toHex, toWei, sha3, asciiToHex } from './utils/web3'

import {
parseEvents,
Expand Down
3 changes: 1 addition & 2 deletions test/fucDeployer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { toHex, toWei } from 'web3-utils'

import { toHex, toWei } from './utils/web3'
import { ensureErc1820RegistryIsDeployed } from '../migrations/utils'
import { extractEventArgs } from './utils'
import { events } from '../'
Expand Down
3 changes: 1 addition & 2 deletions test/proxy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { toHex, toWei, sha3 } from 'web3-utils'

import { toHex, toWei, sha3 } from './utils/web3'
import { ensureErc1820RegistryIsDeployed } from '../migrations/utils'
import { ADDRESS_ZERO, hdWallet } from './utils'
import { events } from '../'
Expand Down
2 changes: 1 addition & 1 deletion test/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { EthHdWallet } from 'eth-hd-wallet'
import _ from 'lodash'
import { toBN, isBN } from 'web3-utils'
import chai from 'chai'
import { parseLog } from 'ethereum-event-logs'
import chaiAsPromised from 'chai-as-promised'

import { toBN, isBN } from './web3'
import { ensureErc1820RegistryIsDeployed } from '../../migrations/utils'

chai.use((_chai, utils) => {
Expand Down
12 changes: 12 additions & 0 deletions test/utils/web3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const web3 = require('web3')

;[
'toBN',
'isBN',
'toHex',
'toWei',
'sha3',
'asciiToHex',
].forEach(m => {
exports[m] = web3.utils[m]
})
1 change: 1 addition & 0 deletions truffle-config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { Compiler } = require('@0x/sol-compiler')
const ProviderEngine = require("web3-provider-engine")
const WebsocketSubprovider = require("web3-provider-engine/subproviders/websocket.js")
const { TruffleArtifactAdapter, RevertTraceSubprovider } = require("@0x/sol-trace")
Expand Down
Loading

0 comments on commit 4c6e3f1

Please sign in to comment.