From 362b18006961822a4b4f8494de1b15903e2b6fc2 Mon Sep 17 00:00:00 2001 From: microwavedcola1 Date: Mon, 28 Feb 2022 14:44:08 +0100 Subject: [PATCH] add oracle to to token registration Signed-off-by: microwavedcola1 --- programs/mango-v4/src/instructions/register_token.rs | 3 +++ programs/mango-v4/src/state/token_bank.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/programs/mango-v4/src/instructions/register_token.rs b/programs/mango-v4/src/instructions/register_token.rs index ef03347c5..395537ecc 100644 --- a/programs/mango-v4/src/instructions/register_token.rs +++ b/programs/mango-v4/src/instructions/register_token.rs @@ -40,6 +40,8 @@ pub struct RegisterToken<'info> { )] pub vault: Account<'info, TokenAccount>, + pub oracle: UncheckedAccount<'info>, + #[account(mut)] pub payer: Signer<'info>, @@ -81,6 +83,7 @@ pub fn register_token( group: ctx.accounts.group.key(), mint: ctx.accounts.mint.key(), vault: ctx.accounts.vault.key(), + oracle: ctx.accounts.oracle.key(), deposit_index: INDEX_START, borrow_index: INDEX_START, indexed_total_deposits: I80F48::ZERO, diff --git a/programs/mango-v4/src/state/token_bank.rs b/programs/mango-v4/src/state/token_bank.rs index a90267d89..a871cb623 100644 --- a/programs/mango-v4/src/state/token_bank.rs +++ b/programs/mango-v4/src/state/token_bank.rs @@ -8,6 +8,7 @@ pub struct TokenBank { pub group: Pubkey, pub mint: Pubkey, pub vault: Pubkey, + pub oracle: Pubkey, /// the index used to scale the value of an IndexedPosition /// TODO: should always be >= 0, add checks?