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", "cname": "rally",
"name": "Rally", "name": "Rally",
"description": "", "description": "Rally is a decentralized network enabling creators to monetize and align themselves with their community.",
"path": "rally", "path": "rallygov.eth",
"previousPaths": [], "previousPaths": ["rally"],
"folder": "rally", "folder": "rally",
"type": "snapshot", "type": "snapshot",
"suffix": "RLY", "suffix": "RLY",
"coinGeckoPriceString": "", "coinGeckoPriceString": "rally-2",
"tokenContractAddress": "null", "tokenContractAddress": "0xf1f955016EcbCd7321c7266BccFB96c68ea5E49b",
"isEnabled": false, "isEnabled": true,
"hasOnchain": false,
"claim": { "claim": {
"isClaimed": false, "isClaimed": true,
"claimer": "", "claimer": "",
"signature": "" "signature": ""
}, },
"hasOnchain": false,
"isHybrid": false, "isHybrid": false,
"hasDelegation": false, "hasDelegation": false,
"snapshotSpaceName": "rally", "snapshotSpaceName": "rallygov.eth",
"invalidSnapshots": [], "invalidSnapshots": [],
"branding": { "branding": {},
"primaryColor": "", "discourseForum": {},
"accentColor": ""
},
"discourseForum": {
"url": "",
"categoryId": ""
},
"safeAddress": null "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,6 +125,11 @@ async function createSkeletons(spaces: Record<string, any>) {
const suffix = spaces[key].symbol; const suffix = spaces[key].symbol;
const name = spaces[key].name; const name = spaces[key].name;
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) => { exec(`sh ./scripts/add_new_protocol.sh ${key} ${tokenAddress} ${suffix} ${name}`, (error, stdout, stderr) => {
if (error !== null) { if (error !== null) {
console.log(`exec error: ${error}`); console.log(`exec error: ${error}`);
@ -138,6 +143,9 @@ async function createSkeletons(spaces: Record<string, any>) {
} }
await delay(1000); // workaround for Etherscan api request limit await delay(1000); // workaround for Etherscan api request limit
} else {
console.log("Already claimed!");
}
} }
} }