Skip to content

Commit

Permalink
Updated round duration to 2 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
aii23 committed Oct 14, 2024
1 parent fc121b6 commit be61c70
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "l1-lottery-contracts",
"version": "0.7.36",
"version": "0.7.37",
"description": "",
"author": "",
"license": "Apache-2.0",
Expand Down
78 changes: 39 additions & 39 deletions scripts/generate_cache.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
// import * as fs from 'fs';
// import { Cache, PublicKey } from 'o1js';
// import { DistributionProgram } from '../src/Proofs/DistributionProof.js';
// import { TicketReduceProgram } from '../src/Proofs/TicketReduceProof.js';
// import { getPLottery } from '../src/PLottery.js';
// import { getRandomManager } from '../src/Random/RandomManager.js';

// // If no epoch is provided - last one will be used
// let deploy_epoch = process.argv[2] ? process.argv[2] : 'current';

// let addressesBuffer = fs.readFileSync(
// `./deploy/addresses/${deploy_epoch}.json`
// );
// let addresses: {
// randomManagerAddress: string;
// lotteryAddress: string;
// randomManagerOwner: string;
// } = JSON.parse(addressesBuffer.toString());

// let randomManagerAddress = PublicKey.fromBase58(addresses.randomManagerAddress);
// let lotteryAddress = PublicKey.fromBase58(addresses.lotteryAddress);
// let randomManagerOwner = PublicKey.fromBase58(addresses.randomManagerOwner);

// await DistributionProgram.compile({ cache: Cache.FileSystem('./cache/DP') });
// await TicketReduceProgram.compile({ cache: Cache.FileSystem('./cache/TRP') });

// let RandomManager = getRandomManager(randomManagerOwner);

// let PLottery = getPLottery(randomManagerAddress, randomManagerOwner);

// await RandomManager.compile({
// cache: Cache.FileSystem(
// `./cache/RandomManager/${addresses.randomManagerAddress}`
// ),
// });

// await PLottery.compile({
// cache: Cache.FileSystem(`./cache/PLottery/${addresses.lotteryAddress}`),
// });
import * as fs from 'fs';
import { Cache, PublicKey } from 'o1js';
import { DistributionProgram } from '../src/Proofs/DistributionProof.js';
import { TicketReduceProgram } from '../src/Proofs/TicketReduceProof.js';
import { RandomManager } from '../src/Random/RandomManager.js';
import { PLottery } from '../src/PLottery.js';
import { ZkonRequestCoordinator, ZkonZkProgram } from 'zkon-zkapp';

// If no epoch is provided - last one will be used
let deploy_epoch = process.argv[2] ? process.argv[2] : 'current';

let addressesBuffer = fs.readFileSync(
`./deploy/addresses/${deploy_epoch}.json`
);
let addresses: {
randomManagerAddress: string;
lotteryAddress: string;
randomManagerOwner: string;
} = JSON.parse(addressesBuffer.toString());

let randomManagerAddress = PublicKey.fromBase58(addresses.randomManagerAddress);
let lotteryAddress = PublicKey.fromBase58(addresses.lotteryAddress);
let randomManagerOwner = PublicKey.fromBase58(addresses.randomManagerOwner);

await DistributionProgram.compile({ cache: Cache.FileSystem('./cache/DP') });
await TicketReduceProgram.compile({ cache: Cache.FileSystem('./cache/TRP') });

await ZkonZkProgram.compile({ cache: Cache.FileSystem('cache') });
await ZkonRequestCoordinator.compile({ cache: Cache.FileSystem('cache') });

await RandomManager.compile({
cache: Cache.FileSystem(
`./cache/RandomManager/${addresses.randomManagerAddress}`
),
});

await PLottery.compile({
cache: Cache.FileSystem(`./cache/PLottery/${addresses.lotteryAddress}`),
});
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PublicKey, UInt64 } from 'o1js';
export const NUMBERS_IN_TICKET = 6;

export const TICKET_PRICE = UInt64.from(10 * 10 ** 9);
export const BLOCK_PER_ROUND = 20; // Approximate blocks per 1 hour
export const BLOCK_PER_ROUND = 40; // Approximate blocks per 2 hour

export const SCORE_COEFFICIENTS = [0, 90, 324, 2187, 26244, 590490, 31886460]; // Should be updated with appropriate probability

Expand Down
8 changes: 4 additions & 4 deletions vk.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit be61c70

Please sign in to comment.