insurance fund for trustless vs not trustful
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
e31ad9ce34
commit
59dd3aa66e
|
@ -31,6 +31,7 @@ pub struct LiqTokenBankruptcy<'info> {
|
|||
#[account(
|
||||
has_one = group,
|
||||
constraint = liab_mint_info.load()?.token_index == liab_token_index,
|
||||
constraint = liab_mint_info.load()?.elligible_for_group_insurance_fund()
|
||||
)]
|
||||
pub liab_mint_info: AccountLoader<'info, MintInfo>,
|
||||
|
||||
|
|
|
@ -153,7 +153,8 @@ pub fn token_register(
|
|||
vaults: Default::default(),
|
||||
oracle: ctx.accounts.oracle.key(),
|
||||
registration_time: Clock::get()?.unix_timestamp,
|
||||
reserved: [0; 256],
|
||||
group_insurance_fund: 1,
|
||||
reserved: [0; 255],
|
||||
};
|
||||
|
||||
mint_info.banks[0] = ctx.accounts.bank.key();
|
||||
|
|
|
@ -123,7 +123,8 @@ pub fn token_register_trustless(
|
|||
vaults: Default::default(),
|
||||
oracle: ctx.accounts.oracle.key(),
|
||||
registration_time: Clock::get()?.unix_timestamp,
|
||||
reserved: [0; 256],
|
||||
group_insurance_fund: 0,
|
||||
reserved: [0; 255],
|
||||
};
|
||||
|
||||
mint_info.banks[0] = ctx.accounts.bank.key();
|
||||
|
|
|
@ -28,12 +28,13 @@ pub struct MintInfo {
|
|||
pub oracle: Pubkey,
|
||||
|
||||
pub registration_time: i64,
|
||||
pub group_insurance_fund: u8,
|
||||
|
||||
pub reserved: [u8; 256],
|
||||
pub reserved: [u8; 255],
|
||||
}
|
||||
const_assert_eq!(
|
||||
size_of::<MintInfo>(),
|
||||
MAX_BANKS * 2 * 32 + 3 * 32 + 2 + 8 + 6 + 256
|
||||
MAX_BANKS * 2 * 32 + 3 * 32 + 2 + 8 + 6 + 1 + 255
|
||||
);
|
||||
const_assert_eq!(size_of::<MintInfo>() % 8, 0);
|
||||
|
||||
|
@ -67,4 +68,8 @@ impl MintInfo {
|
|||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn elligible_for_group_insurance_fund(&self) -> bool {
|
||||
self.group_insurance_fund == 1
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue