Skip to content

Commit

Permalink
Merge pull request #59 from studydefi/uma/update-addresses
Browse files Browse the repository at this point in the history
update addresses for UMA
  • Loading branch information
adrianmcli authored Jun 2, 2020
2 parents 2fe8b6e + ec93df7 commit 923885d
Show file tree
Hide file tree
Showing 22 changed files with 182 additions and 2,761 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
.env
.temp_*
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studydefi/money-legos",
"version": "2.2.1",
"version": "2.3.1",
"main": "index.js",
"types": "index.d.ts",
"repository": "[email protected]:studydefi/money-legos.git",
Expand Down
46 changes: 46 additions & 0 deletions scripts/getAbisFromUMA.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const path = require("path");
const fs = require("fs");

// Usage: node scripts/getAbisFromUMA.js <path-to-uma-protocol>

// only include the following contracts
const fileFilter = [
"Finder",
"VotingToken",
"IdentifierWhitelist",
"Voting",
"Registry",
"FinancialContractsAdmin",
"Store",
"Governor",
"DesignatedVotingFactory",
"WETH9",
"ExpiringMultiPartyLib",
"TokenFactory",
"AddressWhitelist",
"ExpiringMultiPartyCreator",
];

// get all JSON files from their artifacts directory
const inputPath = process.argv[2];
const artifactPath = path.join(inputPath, "./core/build/contracts");
const filenames = fs.readdirSync(artifactPath);

// create a fresh temp folder to hold ABIs
const outputDir = path.join(process.cwd(), "./src/uma/abi");
if (fs.existsSync(outputDir)) {
fs.rmdirSync(outputDir, { recursive: true });
}
fs.mkdirSync(outputDir);

// write ABIs to new files
filenames.forEach((filename) => {
const contents = require(path.join(artifactPath, filename));
const name = filename.split(".").slice(0, -1).join(".");

if (fileFilter.includes(name)) {
const outputPath = path.join(outputDir, filename);
fs.writeFileSync(outputPath, JSON.stringify(contents.abi, null, 2));
console.log("written:", outputPath);
}
});
15 changes: 5 additions & 10 deletions src/uma/abi/AddressWhitelist.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
}
],
"stateMutability": "view",
"type": "function",
"constant": true
"type": "function"
},
{
"inputs": [],
Expand Down Expand Up @@ -95,8 +94,7 @@
}
],
"stateMutability": "view",
"type": "function",
"constant": true
"type": "function"
},
{
"inputs": [
Expand All @@ -115,8 +113,7 @@
}
],
"stateMutability": "view",
"type": "function",
"constant": true
"type": "function"
},
{
"inputs": [
Expand Down Expand Up @@ -161,8 +158,7 @@
}
],
"stateMutability": "view",
"type": "function",
"constant": true
"type": "function"
},
{
"inputs": [],
Expand All @@ -175,7 +171,6 @@
}
],
"stateMutability": "view",
"type": "function",
"constant": true
"type": "function"
}
]
9 changes: 3 additions & 6 deletions src/uma/abi/DesignatedVotingFactory.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@
}
],
"stateMutability": "view",
"type": "function",
"constant": true
"type": "function"
},
{
"inputs": [
Expand All @@ -140,8 +139,7 @@
}
],
"stateMutability": "view",
"type": "function",
"constant": true
"type": "function"
},
{
"inputs": [
Expand All @@ -165,8 +163,7 @@
}
],
"stateMutability": "view",
"type": "function",
"constant": true
"type": "function"
},
{
"inputs": [
Expand Down
Loading

1 comment on commit 923885d

@vercel
Copy link

@vercel vercel bot commented on 923885d Jun 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.