add support for mint decimals on bank, for easy look up
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
d95c5d80ab
commit
cc2d46bf4a
|
@ -131,6 +131,7 @@ pub fn register_token(
|
|||
token_index,
|
||||
bump: *ctx.bumps.get("bank").ok_or(MangoError::SomeError)?,
|
||||
reserved: Default::default(),
|
||||
mint_decimals: ctx.accounts.mint.decimals,
|
||||
};
|
||||
|
||||
// TODO: ALTs are unavailable
|
||||
|
|
|
@ -61,7 +61,9 @@ pub struct Bank {
|
|||
|
||||
pub bump: u8,
|
||||
|
||||
pub reserved: [u8; 5],
|
||||
pub mint_decimals: u8,
|
||||
|
||||
pub reserved: [u8; 4],
|
||||
}
|
||||
const_assert_eq!(size_of::<Bank>(), 16 + 32 * 4 + 8 + 16 * 18 + 3 + 5);
|
||||
const_assert_eq!(size_of::<Bank>() % 8, 0);
|
||||
|
|
|
@ -39,6 +39,7 @@ export class Bank {
|
|||
liquidationFee: I80F48Dto;
|
||||
dust: Object;
|
||||
tokenIndex: number;
|
||||
mintDecimals: number;
|
||||
},
|
||||
) {
|
||||
return new Bank(
|
||||
|
@ -68,6 +69,7 @@ export class Bank {
|
|||
obj.liquidationFee,
|
||||
obj.dust,
|
||||
obj.tokenIndex,
|
||||
obj.mintDecimals,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -98,6 +100,7 @@ export class Bank {
|
|||
liquidationFee: I80F48Dto,
|
||||
dust: Object,
|
||||
public tokenIndex: number,
|
||||
public mintDecimals: number,
|
||||
) {
|
||||
this.name = utf8.decode(new Uint8Array(name)).split('\x00')[0];
|
||||
this.depositIndex = I80F48.from(depositIndex);
|
||||
|
|
|
@ -1730,12 +1730,16 @@ export type MangoV4 = {
|
|||
"name": "bump",
|
||||
"type": "u8"
|
||||
},
|
||||
{
|
||||
"name": "mintDecimals",
|
||||
"type": "u8"
|
||||
},
|
||||
{
|
||||
"name": "reserved",
|
||||
"type": {
|
||||
"array": [
|
||||
"u8",
|
||||
5
|
||||
4
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -4626,12 +4630,16 @@ export const IDL: MangoV4 = {
|
|||
"name": "bump",
|
||||
"type": "u8"
|
||||
},
|
||||
{
|
||||
"name": "mintDecimals",
|
||||
"type": "u8"
|
||||
},
|
||||
{
|
||||
"name": "reserved",
|
||||
"type": {
|
||||
"array": [
|
||||
"u8",
|
||||
5
|
||||
4
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue