Skip to content

Commit 2c9821a

Browse files
authored
Merge 8f73322 into 32f7092
2 parents 32f7092 + 8f73322 commit 2c9821a

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

contracts/Proposals.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ library Proposals {
66
enum BallotBoxState {Uninitialized, PrepayingGas, Active, Inactive}
77
enum ProposalState {Uninitialized, Started, Accepted, Rejected, Contested, Completed}
88

9-
uint256 public constant PROPOSAL_START_PERIOD = 90 seconds; // 1 weeks;
10-
uint256 public constant CONTEST_PERIOD = 90 seconds; //
9+
uint256 public constant PROPOSAL_START_PERIOD = 15 minutes; // 1 weeks;
10+
uint256 public constant CONTEST_PERIOD = 15 minutes; //
1111

1212
uint256 constant MSB_SET = 1 << 255;
1313
uint256 constant UINT256_MAX = ~uint256(0);

test/ProposalsTest.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,22 @@ const PROPOSAL_STATE_COMPLETED = 5;
2525

2626
describe('TestKingAutomatonProposals 4 slots', async() => {
2727
const KingAutomaton = artifacts.require("KingAutomaton");
28+
const Proposals = artifacts.require("Proposals");
2829

2930
beforeEach(async() => {
3031
accounts = await web3.eth.getAccounts();
3132
account = accounts[0];
3233
slots = 4;
34+
35+
// Fetch constants from Proposals library.
36+
proposals = await Proposals.deployed();
37+
proposal_start_period = 1 * (await proposals.PROPOSAL_START_PERIOD());
38+
contest_period = 1 * (await proposals.CONTEST_PERIOD());
39+
40+
// Deploy contract and create proposal.
3341
koh = await KingAutomaton.new(slots, 16, "0x010000", "406080000", 10, -10, 2);
3442
id = await koh.createProposal.call(account, "", "", "0x", 30, 3, 20);
3543
await koh.createProposal(account, "", "", "0x", 30, 3, 20);
36-
proposal_start_period = 90;
37-
contest_period = 90;
3844
});
3945

4046
it("correct proposal creation", async() => {
@@ -220,16 +226,22 @@ describe('TestKingAutomatonProposals 4 slots', async() => {
220226

221227
describe('TestKingAutomatonProposals 256 slots', async() => {
222228
const KingAutomaton = artifacts.require("KingAutomaton");
229+
const Proposals = artifacts.require("Proposals");
223230

224231
beforeEach(async() => {
225232
accounts = await web3.eth.getAccounts();
226233
account = accounts[0];
227234
slots = 256;
235+
236+
// Fetch constants from Proposals library.
237+
proposals = await Proposals.deployed();
238+
proposal_start_period = 1 * (await proposals.PROPOSAL_START_PERIOD());
239+
contest_period = 1 * (await proposals.CONTEST_PERIOD());
240+
241+
// Deploy contract and create proposal.
228242
koh = await KingAutomaton.new(slots, 16, "0x010000", "406080000", 10, -10, 2);
229243
id = await koh.createProposal.call(account, "", "", "0x", 30, 3, 20);
230244
await koh.createProposal(account, "", "", "0x", 30, 3, 20);
231-
proposal_start_period = 90;
232-
contest_period = 90;
233245
});
234246

235247
it("rejection during initial voting", async() => {
@@ -417,6 +429,7 @@ describe('TestKingAutomatonProposals 256 slots', async() => {
417429

418430
describe('TestKingAutomatonProposals claiming reward', async() => {
419431
const KingAutomaton = artifacts.require("KingAutomaton");
432+
const Proposals = artifacts.require("Proposals");
420433

421434
beforeEach(async() => {
422435
accounts = await web3.eth.getAccounts();
@@ -426,14 +439,19 @@ describe('TestKingAutomatonProposals claiming reward', async() => {
426439
budget_period_len = 300;
427440
num_periods = 2;
428441
budget_per_period = 20;
442+
443+
// Fetch constants from Proposals library.
444+
proposals = await Proposals.deployed();
445+
proposal_start_period = 1 * (await proposals.PROPOSAL_START_PERIOD());
446+
contest_period = 1 * (await proposals.CONTEST_PERIOD());
447+
448+
// Deploy contract and create proposal.
429449
koh = await KingAutomaton.new(slots, 16, "0x010000", "406080000", 10, -10, treasury_percentage);
430450
await koh.setOwnerAllSlots();
431451
id = await koh.createProposal.call(account, "", "", "0x", budget_period_len, num_periods, budget_per_period);
432452
await koh.createProposal(account, "", "", "0x", budget_period_len, num_periods, budget_per_period);
433453
await koh.payForGas(id, slots - 1);
434454
await koh.updateProposalState(id);
435-
proposal_start_period = 90;
436-
contest_period = 90;
437455

438456
treasury_address = "0x0000000000000000000000000000000000000001";
439457
proposal_address = "0x0000000000000000000000000000000000000064";

0 commit comments

Comments
 (0)