Skip to content

Commit

Permalink
fix: dont overwrite if already claimed
Browse files Browse the repository at this point in the history
  • Loading branch information
pmespresso committed Apr 28, 2021
1 parent e74a42a commit aa605fb
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 73 deletions.
2 changes: 1 addition & 1 deletion allprotocols.json

Large diffs are not rendered by default.

54 changes: 24 additions & 30 deletions protocols/rally/index.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
{
"cname": "rally",
"name": "Rally",
"description": "",
"path": "rally",
"previousPaths": [],
"folder": "rally",
"type": "snapshot",
"suffix": "RLY",
"coinGeckoPriceString": "",
"tokenContractAddress": "null",
"isEnabled": false,
"hasOnchain": false,
{
"cname": "rally",
"name": "Rally",
"description": "Rally is a decentralized network enabling creators to monetize and align themselves with their community.",
"path": "rallygov.eth",
"previousPaths": ["rally"],
"folder": "rally",
"type": "snapshot",
"suffix": "RLY",
"coinGeckoPriceString": "rally-2",
"tokenContractAddress": "0xf1f955016EcbCd7321c7266BccFB96c68ea5E49b",
"isEnabled": true,
"claim": {
"isClaimed": false,
"claimer": "",
"signature": ""
},
"isHybrid": false,
"hasDelegation": false,
"snapshotSpaceName": "rally",
"invalidSnapshots": [],
"branding": {
"primaryColor": "",
"accentColor": ""
},
"discourseForum": {
"url": "",
"categoryId": ""
},
"safeAddress": null
"isClaimed": true,
"claimer": "",
"signature": ""
},
"hasOnchain": false,
"isHybrid": false,
"hasDelegation": false,
"snapshotSpaceName": "rallygov.eth",
"invalidSnapshots": [],
"branding": {},
"discourseForum": {},
"safeAddress": null
}
Empty file.
Empty file.
Empty file removed protocols/rallygov.eth/events.json
Empty file.
Empty file removed protocols/rallygov.eth/header.png
Empty file.
32 changes: 0 additions & 32 deletions protocols/rallygov.eth/index.json

This file was deleted.

Empty file removed protocols/rallygov.eth/logo.png
Empty file.
Empty file removed protocols/rallygov.eth/overview.md
Empty file.
28 changes: 18 additions & 10 deletions scripts/bulk_add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,27 @@ async function createSkeletons(spaces: Record<string, any>) {
const suffix = spaces[key].symbol;
const name = spaces[key].name;

exec(`sh ./scripts/add_new_protocol.sh ${key} ${tokenAddress} ${suffix} ${name}`, (error, stdout, stderr) => {
if (error !== null) {
console.log(`exec error: ${error}`);
}
});
const file = fs.readFileSync(`./protocols/${key}/index.json`);

if (tokenAddress) {
const tokenAbi = await extractTokenAbi(tokenAddress);
const fileAsJson: any = JSON.parse(file.toString());

fs.writeFileSync(`./protocols/${key}/contracts/token.json`, JSON.stringify(tokenAbi));
}
if (!fileAsJson.claim?.isClaimed) {
exec(`sh ./scripts/add_new_protocol.sh ${key} ${tokenAddress} ${suffix} ${name}`, (error, stdout, stderr) => {
if (error !== null) {
console.log(`exec error: ${error}`);
}
});

if (tokenAddress) {
const tokenAbi = await extractTokenAbi(tokenAddress);

await delay(1000); // workaround for Etherscan api request limit
fs.writeFileSync(`./protocols/${key}/contracts/token.json`, JSON.stringify(tokenAbi));
}

await delay(1000); // workaround for Etherscan api request limit
} else {
console.log("Already claimed!");
}
}
}

Expand Down

0 comments on commit aa605fb

Please sign in to comment.