Skip to content

Commit

Permalink
Merge pull request #64 from Proof-Of-Humanity/fix/init-params
Browse files Browse the repository at this point in the history
fix: renewal duration, transfer cooldown, subcourts
  • Loading branch information
martillansky authored Sep 3, 2024
2 parents bab5585 + 7a3ec8f commit 4082bbd
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 18 deletions.
17 changes: 11 additions & 6 deletions scripts/consts/consts-mainnets.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
import { AddressSetFixed, InitParamSet } from "./interfaces/i-sets";
import { AddressSetFixed, InitSpecificParamSet, InitGeneralParamSet } from "./interfaces/i-sets";
import { Chain } from "./chains/chains-mainnets";

import { Addresses } from "./addresses/addresses-mainnets";
//import { Addresses } from "./addresses/addresses-mainnets-old";

export { Addresses };

export const InitParams: InitParamSet = {
ARBITRATOR_EXTRA_DATA:
"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
export const InitSpecificParams: InitSpecificParamSet = {
ARBITRATOR_EXTRA_DATA_MAINNET:
"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023", // PoH Court ID (MAIN)
ARBITRATOR_EXTRA_DATA_SIDECHAIN:
"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", // PoH Court ID (GNOSIS)
REQUEST_BASE_DEPOSIT_MAINNET: 47500000000000000n, // 0.0475 ETHs
REQUEST_BASE_DEPOSIT_SIDECHAIN: 110000000000000000000n, // 110 XDAI
}

export const InitParams: InitGeneralParamSet = {
HUMANITY_LIFESPAN: 31557600,
RENEWAL_DURATION: 2592000, // One month before expiration
RENEWAL_DURATION: 7889400, // Three months before expiration
CHALLENGE_DURATION: 302400,
FAILED_REV_COOL_DOWN: 302400,
SHARED_MULTIPLIER: 10000,
WINNER_MULTIPLIER: 10000,
LOSER_MULTIPLIER: 20000,
NB_VOUCHES: 1,
TRANSFER_COOLDOWN: 7,
TRANSFER_COOLDOWN: 3600, // Set to 1 hour
}

export const getForeignCCProxy = (chainId: number): string => {
Expand Down
13 changes: 9 additions & 4 deletions scripts/consts/consts-testnets.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import { WeiPerEther } from "ethers";
import { AddressSetFixed, InitParamSet } from "./interfaces/i-sets";
import { AddressSetFixed, InitGeneralParamSet, InitSpecificParamSet } from "./interfaces/i-sets";
import { Chain } from "./chains/chains-testnets";

import { Addresses } from "./addresses/addresses-testnets-new";
//import { Addresses } from "./addresses/addresses-testnets-old";

export { Addresses };

export const InitParams: InitParamSet = {
ARBITRATOR_EXTRA_DATA:
"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
export const InitSpecificParams: InitSpecificParamSet = {
ARBITRATOR_EXTRA_DATA_MAINNET:
"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", // PoH Court ID
ARBITRATOR_EXTRA_DATA_SIDECHAIN:
"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", // PoH Court ID
REQUEST_BASE_DEPOSIT_MAINNET: WeiPerEther / 100n, // Used by pohlegacy to simulate pohv1 in Sepolia
REQUEST_BASE_DEPOSIT_SIDECHAIN: WeiPerEther / 100n,
}

export const InitParams: InitGeneralParamSet = {
HUMANITY_LIFESPAN: 864000,
RENEWAL_DURATION: 863940,
CHALLENGE_DURATION: 60,
Expand Down
8 changes: 6 additions & 2 deletions scripts/consts/interfaces/i-sets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ export interface AddressSetFixed {
W_NATIVE: string;
}

export interface InitParamSet {
ARBITRATOR_EXTRA_DATA: string,
export interface InitSpecificParamSet {
ARBITRATOR_EXTRA_DATA_MAINNET: string,
ARBITRATOR_EXTRA_DATA_SIDECHAIN: string,
REQUEST_BASE_DEPOSIT_MAINNET: bigint,
REQUEST_BASE_DEPOSIT_SIDECHAIN: bigint,
}

export interface InitGeneralParamSet {
HUMANITY_LIFESPAN: number,
RENEWAL_DURATION: number,
CHALLENGE_DURATION: number,
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy/extended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ async function main() {
const poh = (await upgrades.deployProxy(PoH, [
module.FixedAddresses[chainId].W_NATIVE,
module.FixedAddresses[chainId].ARBITRATOR,
module.InitParams.ARBITRATOR_EXTRA_DATA,
module.InitSpecificParams.ARBITRATOR_EXTRA_DATA_MAINNET,
REGISTRATION_META_EVIDENCE,
CLEARING_META_EVIDENCE,
module.InitParams.REQUEST_BASE_DEPOSIT_MAINNET,
module.InitSpecificParams.REQUEST_BASE_DEPOSIT_MAINNET,
module.InitParams.HUMANITY_LIFESPAN,
module.InitParams.RENEWAL_DURATION,
module.InitParams.FAILED_REV_COOL_DOWN,
Expand Down
5 changes: 3 additions & 2 deletions scripts/deploy/poh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ async function main() {
const [deployer] = await ethers.getSigners();
const chainId = +(await getChainId());


const module = await getRouteToConsts(chainId);

const PoH = await ethers.getContractFactory("ProofOfHumanity", deployer);
const poh = (await upgrades.deployProxy(PoH, [
module.FixedAddresses[chainId].W_NATIVE,
module.FixedAddresses[chainId].ARBITRATOR,
module.InitParams.ARBITRATOR_EXTRA_DATA,
module.InitSpecificParams.ARBITRATOR_EXTRA_DATA_SIDECHAIN,
REGISTRATION_META_EVIDENCE,
CLEARING_META_EVIDENCE,
module.InitParams.REQUEST_BASE_DEPOSIT_SIDECHAIN,
module.InitSpecificParams.REQUEST_BASE_DEPOSIT_SIDECHAIN,
module.InitParams.HUMANITY_LIFESPAN,
module.InitParams.RENEWAL_DURATION,
module.InitParams.FAILED_REV_COOL_DOWN,
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy/pohlegacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ async function main() {

const pohold = await new ProofOfHumanityOld__factory(deployer).deploy(
module.FixedAddresses[chainId].ARBITRATOR,
module.InitParams.ARBITRATOR_EXTRA_DATA,
module.InitSpecificParams.ARBITRATOR_EXTRA_DATA_MAINNET,
REGISTRATION_META_EVIDENCE,
CLEARING_META_EVIDENCE,
module.InitParams.REQUEST_BASE_DEPOSIT_MAINNET,
module.InitSpecificParams.REQUEST_BASE_DEPOSIT_MAINNET,
module.InitParams.HUMANITY_LIFESPAN,
module.InitParams.RENEWAL_DURATION,
module.InitParams.CHALLENGE_DURATION,
Expand Down

0 comments on commit 4082bbd

Please sign in to comment.