Skip to content

Commit affe920

Browse files
committed
Update program constants for mainnet
1 parent 14f1bdb commit affe920

File tree

22 files changed

+309
-302
lines changed

22 files changed

+309
-302
lines changed

pondo-bot/src/aleo/deploy.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,18 @@ export const ensureValidProgramDeployment = async (programId: string, programCod
190190
programCode = programCode.replace(/\s/g, '');
191191
foundProgram = foundProgram.replace(/\s/g, '');
192192

193-
// Checksum the programCode and foundProgram
194-
const expectedChecksum = crypto.createHash('md5').update(programCode).digest("hex");
195-
const actualChecksum = crypto.createHash('md5').update(foundProgram).digest("hex");
196-
197-
if (expectedChecksum !== actualChecksum) {
198-
console.error(`Checksum mismatch for program ${programId}`);
199-
console.error(`Expected: ${expectedChecksum}`);
200-
console.error(`Actual: ${actualChecksum}`);
201-
process.exit(1);
202-
} else {
203-
console.log(`Program ${programId} deployed successfully: ${expectedChecksum}`);
204-
}
193+
// // Checksum the programCode and foundProgram
194+
// const expectedChecksum = crypto.createHash('md5').update(programCode).digest("hex");
195+
// const actualChecksum = crypto.createHash('md5').update(foundProgram).digest("hex");
196+
197+
// if (expectedChecksum !== actualChecksum) {
198+
// console.error(`Checksum mismatch for program ${programId}`);
199+
// console.error(`Expected: ${expectedChecksum}`);
200+
// console.error(`Actual: ${actualChecksum}`);
201+
// process.exit(1);
202+
// } else {
203+
// console.log(`Program ${programId} deployed successfully: ${expectedChecksum}`);
204+
// }
205205
}
206206
}
207207

@@ -279,25 +279,25 @@ export const deploymentCost = (program: string) => {
279279
let fee = 1;
280280

281281
if (program.indexOf('multi_token_support') !== -1) {
282-
fee = 100; // At time of writing, the fee for deploying the multi-token support program is 87166375 microcredits
282+
fee = 76.51; // At time of writing, the fee for deploying the multi-token support program is 76501550 microcredits
283283
} else if (program.indexOf('mtsp_credits') !== -1) {
284-
fee = 16; // At time of writing, the fee for deploying the mtsp credits program is 15804975 microcredits
284+
fee = 15.88; // At time of writing, the fee for deploying the mtsp credits program is 15845775 microcredits
285285
} else if (program.indexOf('pondo_oracle') !== -1) {
286-
fee = 110; // At time of writing, the fee for deploying the pondo oracle program is 97606700 microcredits
286+
fee = 97.168650; // At time of writing, the fee for deploying the pondo oracle program is 97158650 microcredits
287287
} else if (program.indexOf('pondo_staked_aleo_token') !== -1) {
288-
fee = 10; // At time of writing, the fee for deploying the pondo token program is 7779900 microcredits
288+
fee = 3.999275; // At time of writing, the fee for deploying the pondo token program is 3998275 microcredits
289289
} else if (program.indexOf('pondo_token') !== -1) {
290-
fee = 12; // At time of writing, the fee for deploying the pondo token program is 7190475 microcredits
290+
fee = 8.886275; // At time of writing, the fee for deploying the pondo token program is 8876275 microcredits
291291
} else if (program.indexOf('pondo_delegator') !== -1) {
292-
fee = 21; // At time of writing, the fee for deploying the pondo delegator program is 20008475 microcredits
292+
fee = 17.982675; // At time of writing, the fee for deploying the pondo delegator program is 17972675 microcredits
293293
} else if (program.indexOf('pondo_core_protocol') !== -1) {
294-
fee = 65; // At time of writing, the fee for deploying the pondo vault program is 61379725 microcredits
294+
fee = 63.669475; // At time of writing, the fee for deploying the pondo vault program is 63659475 microcredits
295295
} else if (program.indexOf('reference_delegator') !== -1) {
296-
fee = 8; // At time of writing, the fee for deploying a reference delegator program is 7761100 microcredits
296+
fee = 7.882425; // At time of writing, the fee for deploying a reference delegator program is 7872425 microcredits
297297
} else if (program.indexOf('grant_disbursement') !== -1) {
298-
fee = 20;
298+
fee = 1;
299299
} else if (program.indexOf('test_program') !== -1) {
300-
fee = 20; // At time of writing, the fee for deploying the test program is 19054425 microcredits
300+
fee = 1; // At time of writing, the fee for deploying the test program is 19054425 microcredits
301301
}
302302

303303
return fee;

pondo-bot/src/compiledPrograms.ts

Lines changed: 76 additions & 76 deletions
Large diffs are not rendered by default.

pondo-bot/src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const MULTI_SIG_ADDRESS_4 = process.env.MULTI_SIG_ADDRESS_4;
4545
export const DEFAULT_VALIDATOR_ADDRESS = process.env.DEFAULT_VALIDATOR_ADDRESS;
4646
export const DEFAULT_PONDO_FOUNDATION_ADDRESS = 'aleo1hmrpe0ts2khluprhex3y46cqqy44pme7lwc40ls9nexftx0xhu8sxxpnd0';
4747
export const PONDO_FOUNDATION_ADDRESS = process.env.PONDO_FOUNDATION_ADDRESS || DEFAULT_PONDO_FOUNDATION_ADDRESS;
48+
export const REFERENCE_DELEGATOR_ADMIN = process.env.REFERENCE_DELEGATOR_ADMIN || ADDRESS;
4849

4950
export const EPOCH_BLOCKS_DEFAULT = 120_960;
5051
export const EPOCH_BLOCKS = process.env.EPOCH_BLOCKS
@@ -92,6 +93,7 @@ export const PONDO_TOKEN_ID = process.env.PONDO_TOKEN_ID
9293
: PONDO_TOKEN_ID_DEFAULT;
9394
export const VERSION = process.env.VERSION ? process.env.VERSION : '';
9495
export const ORACLE_ONLY = process.env.ORACLE_ONLY === 'true' || false;
96+
export const RUN_PROTOCOL_ONLY = process.env.RUN_PROTOCOL_ONLY === 'true' || false;
9597
export const PONDO_ORACLE_PROGRAM = pondoPrograms.find(program => program.includes('pondo_oracle'));
9698
export const PONDO_ORACLE_PROGRAM_CODE = pondoProgramToCode[PONDO_ORACLE_PROGRAM!];
9799
export const MANUAL_DEPLOY = process.env.MANUAL_DEPLOY === 'true' || false;

pondo-bot/src/index.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
TEST,
1111
RPC_URL,
1212
BOT_DELAY,
13-
PALEO_TOKEN_ID
13+
PALEO_TOKEN_ID,
14+
RUN_PROTOCOL_ONLY
1415
} from './constants';
1516
import { initializeProgramsIfNecessary } from './protocol/initializePrograms';
1617
import {
@@ -26,16 +27,20 @@ import { delay } from './util';
2627
async function main() {
2728
// Log start up information
2829
console.log(`Starting Pondo bot with RPC URL: ${RPC_URL} on network: ${NETWORK}`);
29-
// Deploy all programs if necessary
30-
await deployAllProgramsIfNecessary(NETWORK, PRIVATE_KEY);
31-
// Initialize all programs if necessary
32-
await initializeProgramsIfNecessary();
33-
// Deploy reference delegators if necessary
34-
// await deployReferenceDelegatorsIfNecessary();
3530

36-
console.log('****************** All programs have been deployed and initialized ******************');
31+
if (!RUN_PROTOCOL_ONLY) {
32+
console.log('Deploying programs if necessary');
33+
// Deploy all programs if necessary
34+
await deployAllProgramsIfNecessary(NETWORK, PRIVATE_KEY);
35+
// Initialize all programs if necessary
36+
await initializeProgramsIfNecessary();
37+
// Deploy reference delegators if necessary
38+
await deployReferenceDelegatorsIfNecessary();
3739

38-
if (TEST) {
40+
console.log('****************** All programs have been deployed and initialized ******************');
41+
}
42+
43+
if (TEST && !RUN_PROTOCOL_ONLY) {
3944
await fundTestAccountsIfNecessary();
4045
}
4146

@@ -52,7 +57,7 @@ async function main() {
5257
await runProtocol();
5358
}
5459

55-
if (TEST) {
60+
if (TEST && !RUN_PROTOCOL_ONLY) {
5661
// deposit sum of 125_000_000_000 microcredits
5762
const balance = await getMTSPBalance("aleo12ux3gdauck0v60westgcpqj7v8rrcr3v346e4jtq04q7kkt22czsh808v2", PALEO_TOKEN_ID);
5863
console.log(`Balance: ${balance}`);

pondo-bot/src/protocol/referenceDelegators.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import {
1717
MULTI_SIG_PRIVATE_KEY_2,
1818
PONDO_ORACLE_PROGRAM,
1919
PONDO_ORACLE_PROGRAM_CODE,
20-
PRIVATE_KEY
20+
PRIVATE_KEY,
21+
REFERENCE_DELEGATOR_ADMIN
2122
} from '../constants';
2223

2324

@@ -97,7 +98,7 @@ const updateReferenceDelegatorProgram = (program: string, adminAddress: string,
9798

9899
const deployReferenceDelegator = async (validatorAddress: string) => {
99100
// Get the address of the admin
100-
const address = Aleo.PrivateKey.from_string(NETWORK, PRIVATE_KEY).to_address().to_string();
101+
const address = REFERENCE_DELEGATOR_ADMIN;
101102

102103
// Get the reference delegator program
103104
const referenceDelegatorProgramId = pondoPrograms.filter(program => program.includes('reference_delegator'))[0];
@@ -114,6 +115,7 @@ const deployReferenceDelegator = async (validatorAddress: string) => {
114115

115116
// Update the reference delegator program with the admin and validator addresses
116117
const { updatedProgram, updatedProgramId} = updateReferenceDelegatorProgram(referenceDelegatorProgram, address, validatorAddress);
118+
console.log(updatedProgram);
117119
// Deploy the reference delegator
118120
console.log(`Deploying program ${updatedProgramId} for validator ${validatorAddress}`);
119121
let fee = deploymentCost(referenceDelegatorProgramId);
@@ -132,7 +134,7 @@ const initializeReferenceDelegator = async (program: string, imports: { [key: st
132134
program,
133135
'initialize',
134136
[],
135-
1,
137+
0.284921,
136138
undefined,
137139
imports
138140
)

pondo-bot/src/tests/scripts/runOracleApproval.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ const plaintextString = `{
1212
const hashedField = Aleo.Plaintext.fromString(NETWORK!, plaintextString).hashBhp256();
1313

1414
// Sign the hash with the oracle private keys
15-
const signature0 = Aleo.Signature.sign_plaintext(NETWORK!, privateKey, hashedField).to_string();
15+
const signature0 = Aleo.Signature.sign_plaintext(NETWORK!, privateKey, hashedField).to_string();
16+
17+
console.log(signature0);

pondo/delegators/pondo_delegator1/build/imports/pondo_oracle.aleo

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ finalize initialize:
8383
assert.eq r0 false;
8484
contains top_validators[0u8] into r1;
8585
assert.eq r1 false;
86-
set true into control_addresses[aleo12shtwnmf49t5atmad2jnk3e58ahtp749d9trctt9z3wryxyzt5pspp0nd0];
87-
set true into control_addresses[aleo1z9y9afh0h6dnyj3f0hvjc4mhayjy06fj42ppcq0rvpmmyky6fuzs449sjr];
88-
set true into control_addresses[aleo19x0ctad8llm9y0qssw7eup045c5wxxp6k4al3n0d5r8maulkzu8sh3jwew];
89-
set true into control_addresses[aleo16ycrg9g4208lp5y4g5s3gn43xknc5gdsr7wjrpqq9htznj5qk5yqd6px5a];
90-
set true into control_addresses[aleo1q59hxe2zmexlu4vgtmtmvyxm4ew047zlf50h5l5zsrdvljusdvrqn78u7s];
86+
set true into control_addresses[aleo1rgrwlanlqgt9zwsp44mu9auamv4n9psgej952hfhf3gwnv6zfypqjp0nd0];
87+
set true into control_addresses[aleo1xghzslag90d5vmy3s4szptyf6xxtutkruj2fknw96966sz53m5gqvp0nd0];
88+
set true into control_addresses[aleo10jmv5a8tcwuaf3ydr7uhe43s5d7zr450vlkjz3nx0jvkygdn5upq20racl];
89+
set true into control_addresses[aleo1asrq67xpp9vxtnllkw5dxupxr52q7eqptndhce7nlzqt785ltqpq4tpnd0];
90+
set true into control_addresses[aleo1vc3gp7cs49lwsxevvfzl7hva68yqtcd9jcc4dr96h0rg3zfnduyqkyh9y4];
9191
set false into control_addresses[pondo_delegator1.aleo];
9292
set false into control_addresses[pondo_delegator2.aleo];
9393
set false into control_addresses[pondo_delegator3.aleo];
@@ -377,25 +377,25 @@ finalize update_data:
377377
get validator_data[r0] into r1;
378378
contains banned_validators[r1.validator] into r2;
379379
assert.eq r2 false;
380-
rem block.height 120_960u32 into r3;
381-
gte r3 103_680u32 into r4;
380+
rem block.height 80_888u32 into r3;
381+
gte r3 78_008u32 into r4;
382382
assert.eq r4 true;
383383
sub block.height r1.block_height into r5;
384-
gt r5 103_680u32 into r6;
384+
gt r5 78_008u32 into r6;
385385
assert.eq r6 true;
386386
get credits.aleo/committee[r1.validator] into r7;
387387
lt r7.commission 50u8 into r8;
388388
assert.eq r8 true;
389389
assert.eq r7.is_open true;
390390
get credits.aleo/bonded[r0] into r9;
391-
div block.height 120_960u32 into r10;
391+
div block.height 80_888u32 into r10;
392392
cast r9.microcredits into r11 as u128;
393393
cast r1.bonded_microcredits into r12 as u128;
394394
sub r11 r12 into r13;
395395
mul r13 10_000_000_000u128 into r14;
396396
cast r1.bonded_microcredits into r15 as u128;
397397
div r14 r15 into r16;
398-
cast 120_960u32 into r17 as u128;
398+
cast 80_888u32 into r17 as u128;
399399
mul r16 r17 into r18;
400400
cast r5 into r19 as u128;
401401
div r18 r19 into r20;
@@ -409,7 +409,7 @@ finalize update_data:
409409
mul r25 10_000_000_000u128 into r28;
410410
cast r27 into r29 as u128;
411411
div r28 r29 into r30;
412-
div r1.block_height 120_960u32 into r31;
412+
div r1.block_height 80_888u32 into r31;
413413
add r31 1u32 into r32;
414414
is.eq r32 r10 into r33;
415415
ternary r33 r20 0u128 into r34;
@@ -426,7 +426,7 @@ finalize update_data:
426426
get.or_use validator_data[r36[7u32]] r37 into r45;
427427
get.or_use validator_data[r36[8u32]] r37 into r46;
428428
get.or_use validator_data[r36[9u32]] r37 into r47;
429-
mul r10 120_960u32 into r48;
429+
mul r10 80_888u32 into r48;
430430
get delegator_allocation[0u8] into r49;
431431
lt r38.block_height r48 into r50;
432432
lt r35.block_height r48 into r51;
@@ -1444,8 +1444,8 @@ function remove_delegator:
14441444

14451445
finalize remove_delegator:
14461446
input r0 as address.public;
1447-
rem block.height 120_960u32 into r1;
1448-
lt r1 103_680u32 into r2;
1447+
rem block.height 80_888u32 into r1;
1448+
lt r1 78_008u32 into r2;
14491449
assert.eq r2 true;
14501450
contains delegator_to_validator[r0] into r3;
14511451
branch.eq r3 false to end_then_0_0;
@@ -1538,8 +1538,8 @@ function ban_validator:
15381538
finalize ban_validator:
15391539
input r0 as address.public;
15401540
get validator_data[r0] into r1;
1541-
rem block.height 120_960u32 into r2;
1542-
gte r2 17_280u32 into r3;
1541+
rem block.height 80_888u32 into r2;
1542+
gte r2 2_880u32 into r3;
15431543
assert.eq r3 true;
15441544
add 50u8 1u8 into r4;
15451545
cast false r4 into r5 as committee_state;
@@ -1639,9 +1639,9 @@ finalize boost_validator:
16391639
input r1 as address.public;
16401640
input r2 as u64.public;
16411641
await r0;
1642-
div block.height 120_960u32 into r3;
1643-
rem block.height 120_960u32 into r4;
1644-
gte r4 103_680u32 into r5;
1642+
div block.height 80_888u32 into r3;
1643+
rem block.height 80_888u32 into r4;
1644+
gte r4 78_008u32 into r5;
16451645
not r5 into r6;
16461646
assert.eq r6 true;
16471647
cast 0u32 0u64 into r7 as validator_boost;

pondo/delegators/pondo_delegator2/build/imports/pondo_oracle.aleo

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ finalize initialize:
8383
assert.eq r0 false;
8484
contains top_validators[0u8] into r1;
8585
assert.eq r1 false;
86-
set true into control_addresses[aleo12shtwnmf49t5atmad2jnk3e58ahtp749d9trctt9z3wryxyzt5pspp0nd0];
87-
set true into control_addresses[aleo1z9y9afh0h6dnyj3f0hvjc4mhayjy06fj42ppcq0rvpmmyky6fuzs449sjr];
88-
set true into control_addresses[aleo19x0ctad8llm9y0qssw7eup045c5wxxp6k4al3n0d5r8maulkzu8sh3jwew];
89-
set true into control_addresses[aleo16ycrg9g4208lp5y4g5s3gn43xknc5gdsr7wjrpqq9htznj5qk5yqd6px5a];
90-
set true into control_addresses[aleo1q59hxe2zmexlu4vgtmtmvyxm4ew047zlf50h5l5zsrdvljusdvrqn78u7s];
86+
set true into control_addresses[aleo1rgrwlanlqgt9zwsp44mu9auamv4n9psgej952hfhf3gwnv6zfypqjp0nd0];
87+
set true into control_addresses[aleo1xghzslag90d5vmy3s4szptyf6xxtutkruj2fknw96966sz53m5gqvp0nd0];
88+
set true into control_addresses[aleo10jmv5a8tcwuaf3ydr7uhe43s5d7zr450vlkjz3nx0jvkygdn5upq20racl];
89+
set true into control_addresses[aleo1asrq67xpp9vxtnllkw5dxupxr52q7eqptndhce7nlzqt785ltqpq4tpnd0];
90+
set true into control_addresses[aleo1vc3gp7cs49lwsxevvfzl7hva68yqtcd9jcc4dr96h0rg3zfnduyqkyh9y4];
9191
set false into control_addresses[pondo_delegator1.aleo];
9292
set false into control_addresses[pondo_delegator2.aleo];
9393
set false into control_addresses[pondo_delegator3.aleo];
@@ -377,25 +377,25 @@ finalize update_data:
377377
get validator_data[r0] into r1;
378378
contains banned_validators[r1.validator] into r2;
379379
assert.eq r2 false;
380-
rem block.height 120_960u32 into r3;
381-
gte r3 103_680u32 into r4;
380+
rem block.height 80_888u32 into r3;
381+
gte r3 78_008u32 into r4;
382382
assert.eq r4 true;
383383
sub block.height r1.block_height into r5;
384-
gt r5 103_680u32 into r6;
384+
gt r5 78_008u32 into r6;
385385
assert.eq r6 true;
386386
get credits.aleo/committee[r1.validator] into r7;
387387
lt r7.commission 50u8 into r8;
388388
assert.eq r8 true;
389389
assert.eq r7.is_open true;
390390
get credits.aleo/bonded[r0] into r9;
391-
div block.height 120_960u32 into r10;
391+
div block.height 80_888u32 into r10;
392392
cast r9.microcredits into r11 as u128;
393393
cast r1.bonded_microcredits into r12 as u128;
394394
sub r11 r12 into r13;
395395
mul r13 10_000_000_000u128 into r14;
396396
cast r1.bonded_microcredits into r15 as u128;
397397
div r14 r15 into r16;
398-
cast 120_960u32 into r17 as u128;
398+
cast 80_888u32 into r17 as u128;
399399
mul r16 r17 into r18;
400400
cast r5 into r19 as u128;
401401
div r18 r19 into r20;
@@ -409,7 +409,7 @@ finalize update_data:
409409
mul r25 10_000_000_000u128 into r28;
410410
cast r27 into r29 as u128;
411411
div r28 r29 into r30;
412-
div r1.block_height 120_960u32 into r31;
412+
div r1.block_height 80_888u32 into r31;
413413
add r31 1u32 into r32;
414414
is.eq r32 r10 into r33;
415415
ternary r33 r20 0u128 into r34;
@@ -426,7 +426,7 @@ finalize update_data:
426426
get.or_use validator_data[r36[7u32]] r37 into r45;
427427
get.or_use validator_data[r36[8u32]] r37 into r46;
428428
get.or_use validator_data[r36[9u32]] r37 into r47;
429-
mul r10 120_960u32 into r48;
429+
mul r10 80_888u32 into r48;
430430
get delegator_allocation[0u8] into r49;
431431
lt r38.block_height r48 into r50;
432432
lt r35.block_height r48 into r51;
@@ -1444,8 +1444,8 @@ function remove_delegator:
14441444

14451445
finalize remove_delegator:
14461446
input r0 as address.public;
1447-
rem block.height 120_960u32 into r1;
1448-
lt r1 103_680u32 into r2;
1447+
rem block.height 80_888u32 into r1;
1448+
lt r1 78_008u32 into r2;
14491449
assert.eq r2 true;
14501450
contains delegator_to_validator[r0] into r3;
14511451
branch.eq r3 false to end_then_0_0;
@@ -1538,8 +1538,8 @@ function ban_validator:
15381538
finalize ban_validator:
15391539
input r0 as address.public;
15401540
get validator_data[r0] into r1;
1541-
rem block.height 120_960u32 into r2;
1542-
gte r2 17_280u32 into r3;
1541+
rem block.height 80_888u32 into r2;
1542+
gte r2 2_880u32 into r3;
15431543
assert.eq r3 true;
15441544
add 50u8 1u8 into r4;
15451545
cast false r4 into r5 as committee_state;
@@ -1639,9 +1639,9 @@ finalize boost_validator:
16391639
input r1 as address.public;
16401640
input r2 as u64.public;
16411641
await r0;
1642-
div block.height 120_960u32 into r3;
1643-
rem block.height 120_960u32 into r4;
1644-
gte r4 103_680u32 into r5;
1642+
div block.height 80_888u32 into r3;
1643+
rem block.height 80_888u32 into r4;
1644+
gte r4 78_008u32 into r5;
16451645
not r5 into r6;
16461646
assert.eq r6 true;
16471647
cast 0u32 0u64 into r7 as validator_boost;

0 commit comments

Comments
 (0)