Skip to content

Commit 63420e0

Browse files
authored
fix: allow copeland voting method only on testnet (#505)
1 parent 556c109 commit 63420e0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/writer/proposal.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import db from '../helpers/mysql';
1010
import { getLimits, getSpaceType } from '../helpers/options';
1111
import { captureError, getQuorum, jsonParse, validateChoices } from '../helpers/utils';
1212

13+
const SNAPSHOT_ENV = process.env.NETWORK || 'testnet';
14+
const TESTNET_ONLY_VOTING_TYPES = ['copeland'];
15+
1316
const scoreAPIUrl = process.env.SCORE_API_URL || 'https://score.snapshot.org';
1417
const broviderUrl = process.env.BROVIDER_URL || 'https://rpc.snapshot.org';
1518

@@ -90,6 +93,10 @@ export async function verify(body): Promise<any> {
9093
return Promise.reject('proposal end date must be in the future');
9194
}
9295

96+
if (SNAPSHOT_ENV !== 'testnet' && TESTNET_ONLY_VOTING_TYPES.includes(msg.payload.type)) {
97+
return Promise.reject('voting type allowed only on testnet');
98+
}
99+
93100
const isChoicesValid = validateChoices({
94101
type: msg.payload.type,
95102
choices: msg.payload.choices

0 commit comments

Comments
 (0)