@@ -58,6 +58,7 @@ pub struct DAO {
5858 pub burn_decay_per_slot_lamports : u64 ,
5959 pub slots_per_proposal : u64 ,
6060 pub market_taker_fee : i64 ,
61+ pub twap_expected_value : u64 ,
6162}
6263
6364#[ derive( Clone , Copy , AnchorSerialize , AnchorDeserialize , PartialEq , Eq ) ]
@@ -114,6 +115,7 @@ pub mod autocrat_v0 {
114115 dao. burn_decay_per_slot_lamports = DEFAULT_BURN_DECAY_PER_SLOT_LAMPORTS ;
115116 dao. slots_per_proposal = THREE_DAYS_IN_SLOTS ;
116117 dao. market_taker_fee = 0 ;
118+ dao. twap_expected_value = 10_000 ; // 1 USDC per META
117119
118120 let ( treasury_pubkey, treasury_bump) =
119121 Pubkey :: find_program_address ( & [ dao. key ( ) . as_ref ( ) ] , ctx. program_id ) ;
@@ -226,11 +228,11 @@ pub mod autocrat_v0 {
226228 AutocratError :: TWAPMarketTooOld
227229 ) ;
228230 require ! (
229- openbook_twap_pass_market. twap_oracle. expected_value == 1000 ,
231+ openbook_twap_pass_market. twap_oracle. expected_value == dao . twap_expected_value ,
230232 AutocratError :: TWAPMarketInvalidExpectedValue
231233 ) ;
232234 require ! (
233- openbook_twap_fail_market. twap_oracle. expected_value == 1000 ,
235+ openbook_twap_fail_market. twap_oracle. expected_value == dao . twap_expected_value ,
234236 AutocratError :: TWAPMarketInvalidExpectedValue
235237 ) ;
236238
@@ -388,61 +390,6 @@ pub mod autocrat_v0 {
388390 Ok ( ( ) )
389391 }
390392
391- // pub fn set_pass_threshold_bps(ctx: Context<Auth>, pass_threshold_bps: u16) -> Result<()> {
392- // let dao = &mut ctx.accounts.dao;
393-
394- // dao.pass_threshold_bps = pass_threshold_bps;
395-
396- // Ok(())
397- // }
398-
399- // pub fn set_base_burn_lamports(ctx: Context<Auth>, base_burn_lamports: u64) -> Result<()> {
400- // let dao = &mut ctx.accounts.dao;
401-
402- // dao.base_burn_lamports = base_burn_lamports;
403-
404- // Ok(())
405- // }
406-
407- // pub fn set_burn_decay_per_slot_lamports(
408- // ctx: Context<Auth>,
409- // burn_decay_per_slot_lamports: u64,
410- // ) -> Result<()> {
411- // let dao = &mut ctx.accounts.dao;
412-
413- // dao.burn_decay_per_slot_lamports = burn_decay_per_slot_lamports;
414-
415- // Ok(())
416- // }
417-
418- // pub fn set_slots_per_proposal(ctx: Context<Auth>, slots_per_proposal: u64) -> Result<()> {
419- // let dao = &mut ctx.accounts.dao;
420-
421- // dao.slots_per_proposal = slots_per_proposal;
422-
423- // Ok(())
424- // }
425-
426- // pub fn set_market_taker_fee(ctx: Context<Auth>, market_taker_fee: i64) -> Result<()> {
427- // let dao = &mut ctx.accounts.dao;
428-
429- // dao.market_taker_fee = market_taker_fee;
430-
431- // Ok(())
432- // }
433-
434- #[ derive( Clone , Copy , AnchorSerialize , AnchorDeserialize ) ]
435- pub enum Test {
436- Boo ,
437- Foo ,
438- }
439-
440- #[ derive( Clone , Copy , AnchorSerialize , AnchorDeserialize , Eq , PartialEq , Debug ) ]
441- pub struct Testy {
442- pub thing : Option < u64 > ,
443- }
444-
445-
446393 pub fn update_dao (
447394 ctx : Context < UpdateDao > ,
448395 dao_params : UpdateDaoParams ,
@@ -469,6 +416,10 @@ pub mod autocrat_v0 {
469416 dao. market_taker_fee = market_taker_fee;
470417 }
471418
419+ if let Some ( twap_expected_value) = dao_params. twap_expected_value {
420+ dao. twap_expected_value = twap_expected_value;
421+ }
422+
472423 Ok ( ( ) )
473424 }
474425
@@ -569,6 +520,7 @@ pub struct UpdateDaoParams {
569520 pub burn_decay_per_slot_lamports : Option < u64 > ,
570521 pub slots_per_proposal : Option < u64 > ,
571522 pub market_taker_fee : Option < i64 > ,
523+ pub twap_expected_value : Option < u64 > ,
572524}
573525
574526#[ derive( Accounts ) ]
@@ -620,7 +572,7 @@ pub enum AutocratError {
620572 InvalidMarket ,
621573 #[ msg( "`TWAPMarket` must have an `initial_slot` within 50 slots of the proposal's `slot_enqueued`" ) ]
622574 TWAPMarketTooOld ,
623- #[ msg( "`TWAPMarket` must have an expected value of 1000, or 0.1 USDC per META " ) ]
575+ #[ msg( "`TWAPMarket` has the wrong `expected_value` " ) ]
624576 TWAPMarketInvalidExpectedValue ,
625577 #[ msg( "One of the vaults has an invalid `settlement_authority`" ) ]
626578 InvalidSettlementAuthority ,
0 commit comments