fix: dont overwrite if already claimed

This commit is contained in:
yj 2021-04-27 20:40:32 -05:00
parent e74a42a431
commit aa605fb796
10 changed files with 43 additions and 73 deletions

File diff suppressed because one or more lines are too long

View File

@ -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
}

View File

@ -1,32 +0,0 @@
{
"cname": "rallygov.eth",
"name": "Rally",
"description": "",
"path": "rallygov.eth",
"previousPaths": [],
"folder": "rallygov.eth",
"type": "snapshot",
"suffix": "RLY",
"coinGeckoPriceString": "",
"tokenContractAddress": "null",
"isEnabled": false,
"hasOnchain": false,
"claim": {
"isClaimed": false,
"claimer": "",
"signature": ""
},
"isHybrid": false,
"hasDelegation": false,
"snapshotSpaceName": "rallygov.eth",
"invalidSnapshots": [],
"branding": {
"primaryColor": "",
"accentColor": ""
},
"discourseForum": {
"url": "",
"categoryId": ""
},
"safeAddress": null
}

View File

@ -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`);
const fileAsJson: any = JSON.parse(file.toString());
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);
fs.writeFileSync(`./protocols/${key}/contracts/token.json`, JSON.stringify(tokenAbi));
}
});
if (tokenAddress) {
const tokenAbi = await extractTokenAbi(tokenAddress);
fs.writeFileSync(`./protocols/${key}/contracts/token.json`, JSON.stringify(tokenAbi));
await delay(1000); // workaround for Etherscan api request limit
} else {
console.log("Already claimed!");
}
await delay(1000); // workaround for Etherscan api request limit
}
}