Skip to content

Commit 838a7a0

Browse files
committed
Update burn
1 parent 70c0de3 commit 838a7a0

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

programs/autocrat_v0/src/lib.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ pub const THREE_DAYS_IN_SLOTS: u64 = 5 * 24 * 60 * 6 * SLOTS_PER_10_SECS;
3232
// by default, the pass price needs to be 5% higher than the fail price
3333
pub const DEFAULT_PASS_THRESHOLD_BPS: u16 = 500;
3434

35-
// start at 50 SOL ($1000 at current prices), decay by ~10 SOL per day
36-
pub const DEFAULT_BASE_BURN_LAMPORTS: u64 = 50 * solana_program::native_token::LAMPORTS_PER_SOL;
37-
pub const DEFAULT_BURN_DECAY_PER_SLOT_LAMPORTS: u64 = 46_300;
35+
// start at 10 SOL ($600 at current prices), decay by ~5 SOL per day
36+
pub const DEFAULT_BASE_BURN_LAMPORTS: u64 = 10 * solana_program::native_token::LAMPORTS_PER_SOL;
37+
pub const DEFAULT_BURN_DECAY_PER_SLOT_LAMPORTS: u64 = 23_150;
3838

3939
pub const MAX_BPS: u16 = 10_000;
4040

@@ -107,7 +107,7 @@ pub mod autocrat_v0 {
107107
dao.meta_mint = ctx.accounts.meta_mint.key();
108108
dao.usdc_mint = ctx.accounts.usdc_mint.key();
109109

110-
dao.proposal_count = 1;
110+
dao.proposal_count = 2;
111111

112112
dao.pass_threshold_bps = DEFAULT_PASS_THRESHOLD_BPS;
113113
dao.base_burn_lamports = DEFAULT_BASE_BURN_LAMPORTS;
@@ -388,18 +388,21 @@ pub mod autocrat_v0 {
388388
Ok(())
389389
}
390390

391-
pub fn set_last_proposal_slot(ctx: Context<Auth>, last_proposal_slot: u64) -> Result<()> {
391+
pub fn set_base_burn_lamports(ctx: Context<Auth>, base_burn_lamports: u64) -> Result<()> {
392392
let dao = &mut ctx.accounts.dao;
393393

394-
dao.last_proposal_slot = last_proposal_slot;
394+
dao.base_burn_lamports = base_burn_lamports;
395395

396396
Ok(())
397397
}
398398

399-
pub fn set_base_burn_lamports(ctx: Context<Auth>, base_burn_lamports: u64) -> Result<()> {
399+
pub fn set_burn_decay_per_slot_lamports(
400+
ctx: Context<Auth>,
401+
burn_decay_per_slot_lamports: u64,
402+
) -> Result<()> {
400403
let dao = &mut ctx.accounts.dao;
401404

402-
dao.base_burn_lamports = base_burn_lamports;
405+
dao.burn_decay_per_slot_lamports = burn_decay_per_slot_lamports;
403406

404407
Ok(())
405408
}

tests/autocratV0.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ describe("autocrat_v0", async function () {
190190
const daoAcc = await autocrat.account.dao.fetch(dao);
191191
assert(daoAcc.metaMint.equals(META));
192192
assert(daoAcc.usdcMint.equals(USDC));
193-
assert.equal(daoAcc.proposalCount, 1);
193+
assert.equal(daoAcc.proposalCount, 2);
194194
assert.equal(daoAcc.passThresholdBps, 500);
195-
assert.ok(daoAcc.baseBurnLamports.eq(new BN(1_000_000_000).muln(50)));
196-
assert.ok(daoAcc.burnDecayPerSlotLamports.eq(new BN(46_300)));
195+
assert.ok(daoAcc.baseBurnLamports.eq(new BN(1_000_000_000).muln(10)));
196+
assert.ok(daoAcc.burnDecayPerSlotLamports.eq(new BN(23_150)));
197197

198198
treasuryMetaAccount = await createAssociatedTokenAccount(
199199
banksClient,
@@ -229,7 +229,7 @@ describe("autocrat_v0", async function () {
229229
};
230230

231231
let currentClock = await context.banksClient.getClock();
232-
let newSlot = currentClock.slot + 432_000n; // 2 days
232+
let newSlot = currentClock.slot + 216_000n; // 1 day
233233
context.setClock(
234234
new Clock(
235235
newSlot,
@@ -255,10 +255,10 @@ describe("autocrat_v0", async function () {
255255

256256
let balanceAfter = await banksClient.getBalance(payer.publicKey);
257257

258-
// two days, so proposer should burn 30 SOL
259-
assert(balanceAfter < balanceBefore - 1_000_000_000n * 30n);
258+
// two days, so proposer should burn 5 SOL
259+
assert(balanceAfter < balanceBefore - 1_000_000_000n * 5n);
260260

261-
assert(balanceAfter > balanceBefore - 1_000_000_000n * 35n);
261+
assert(balanceAfter > balanceBefore - 1_000_000_000n * 10n);
262262
});
263263
});
264264

0 commit comments

Comments
 (0)