This repository has been archived by the owner on May 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* work towards policy flow * final tests * deploy the market too * publish to npm after contract deployment * fix config error in circleci * update * deployedAddresses in gitignore * make poliy flow test more robust by increasing premium interval to 100 seconds
- Loading branch information
Showing
20 changed files
with
392 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
const contractsForEvents = { | ||
Proxy: require('./build/contracts/Proxy.json'), | ||
IEtherToken: require('./build/contracts/IEtherToken.json'), | ||
IACL: require('./build/contracts/IACL.json'), | ||
IEntityDeployer: require('./build/contracts/IEntityDeployer.json'), | ||
IEntityImpl: require('./build/contracts/IEntityImpl.json'), | ||
IPolicyImpl: require('./build/contracts/IPolicyImpl.json'), | ||
IERC20: require('./build/contracts/IERC20.json'), | ||
IERC777: require('./build/contracts/IERC777.json'), | ||
} | ||
let deployedAddresses | ||
try { | ||
deployedAddresses = require('./deployedAddresses.json') | ||
} catch (_ignore) {} | ||
|
||
const contractsThatAreEntryPoints = { | ||
ACL: require('./build/contracts/ACL.json'), | ||
EntityDeployer: require('./build/contracts/EntityDeployer.json'), | ||
} | ||
const rawContracts = require('./contracts.generated.js') | ||
|
||
const coreContracts = [ | ||
{ name: 'Settings', actual: 'ISettingsImpl' }, | ||
{ name: 'ACL', actual: 'IACL' }, | ||
{ name: 'Policy', actual: 'IPolicyImpl' }, | ||
{ name: 'EntityDeployer', actual: 'IEntityDeployer' }, | ||
{ name: 'Entity', actual: 'IEntityImpl' }, | ||
{ name: 'MatchingMarket', actual: 'IMarket' }, | ||
{ name: 'EtherToken', actual: 'IEtherToken' }, | ||
{ name: 'Proxy', actual: 'Proxy' }, | ||
{ name: 'ERC20', actual: 'IERC20' }, | ||
{ name: 'ERC777', actual: 'IERC777' }, | ||
].reduce((m, n) => { | ||
m[n.name] = rawContracts[n.actual] | ||
return m | ||
}, {}) | ||
|
||
const extractEventsFromAbis = abis => abis.reduce((output, contract) => { | ||
contract.abi.filter(({ type, name }) => type === 'event').forEach(e => { | ||
if (output[e.name]) { | ||
throw new Error(`Already got an event named ${e.name}`) | ||
if (!output[e.name]) { | ||
output[e.name] = e | ||
} | ||
output[e.name] = e | ||
}) | ||
return output | ||
}, {}) | ||
|
||
module.exports = { | ||
addresses: require('./deployedAddresses.json'), | ||
contracts: Object.assign({}, contractsForEvents, contractsThatAreEntryPoints), | ||
events: extractEventsFromAbis(Object.values(contractsForEvents)), | ||
addresses: deployedAddresses, | ||
contracts: coreContracts, | ||
rawContracts, | ||
events: extractEventsFromAbis(Object.values(coreContracts)), | ||
extractEventsFromAbis, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { createLog } = require('./log') | ||
const { deploy } = require('./functions') | ||
|
||
export const ensureMarketIsDeployed = async ({ deployer, artifacts, logger }, settingsAddress) => { | ||
const log = createLog(logger) | ||
|
||
log('Deploying Market ...') | ||
|
||
// deploy market | ||
const Market = artifacts.require('./MatchingMarket') | ||
const market = await Market.new('0xFFFFFFFFFFFFFFFF') | ||
|
||
log(`... deployed at ${market.address}`) | ||
|
||
log('Saving market address to settings ...') | ||
|
||
// save to settings | ||
const Settings = artifacts.require('./ISettingsImpl') | ||
const settings = await Settings.at(settingsAddress) | ||
await settings.setMatchingMarket(market.address) | ||
|
||
log('... saved') | ||
|
||
return market | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env node | ||
|
||
/* This script copies Maker OTC contract artifacts from git submodule into build folder */ | ||
|
||
const fse = require('fs-extra') | ||
const path = require('path') | ||
|
||
const projectDir = path.join(__dirname, '..') | ||
|
||
fse.copySync(path.join(projectDir, 'maker-otc', 'build', 'contracts', 'MatchingMarket.json'), path.join(projectDir, 'build', 'contracts', 'MatchingMarket.json')) |
Oops, something went wrong.