Skip to content

Commit 0ecfd73

Browse files
authored
Update migration to 0.0.1-rc.52-v0 (#568)
* Package version 0.2.75 * use migration 0.0.1-rc.52-v1 * migration 0.0.1-rc.52-v0
1 parent c3bc025 commit 0ecfd73

File tree

3 files changed

+446
-90
lines changed

3 files changed

+446
-90
lines changed

extract-abis.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const fs = require('fs')
2+
const path = require('path')
3+
4+
/**
5+
* Extract abis from Arc contracts folder into truffle compatible format
6+
*/
7+
async function extractAbis (base) {
8+
var files = fs.readdirSync(base)
9+
for (var i = 0; i < files.length; i++) {
10+
var filename = path.join(base, files[i])
11+
var stat = fs.lstatSync(filename)
12+
if (stat.isDirectory()) {
13+
extractAbis(filename) // recurse
14+
} else if (filename.indexOf('.json') >= 0 && filename.indexOf('.dbg') === -1) {
15+
console.log('-- found: ', filename)
16+
const contract = JSON.parse(fs.readFileSync(filename, 'utf-8'))
17+
fs.writeFileSync(
18+
path.join('./node_modules/@daostack/arc/build/contracts', files[i]),
19+
JSON.stringify(contract, undefined, 2),
20+
'utf-8'
21+
)
22+
}
23+
}
24+
}
25+
26+
if (require.main === module) {
27+
if (fs.existsSync('./node_modules/@daostack/arc/build/contracts/contracts')) {
28+
extractAbis('./node_modules/@daostack/arc/build/contracts/contracts').catch(err => {
29+
console.log(err)
30+
process.exit(1)
31+
})
32+
}
33+
} else {
34+
module.exports = {
35+
extractAbis
36+
}
37+
}

0 commit comments

Comments
 (0)