TokenRegister: Sanity checks on token_index

This commit is contained in:
Christian Kamm 2023-03-20 13:42:30 +01:00
parent d1e3da2b75
commit 99360e69a3
2 changed files with 3 additions and 1 deletions

View File

@ -37,6 +37,7 @@ pub fn token_register(
ctx.accounts.mint.key()
);
}
require_neq!(token_index, TokenIndex::MAX);
let now_ts: u64 = Clock::get()?.unix_timestamp.try_into().unwrap();

View File

@ -17,7 +17,8 @@ pub fn token_register_trustless(
token_index: TokenIndex,
name: String,
) -> Result<()> {
require_neq!(token_index, 0);
require_neq!(token_index, QUOTE_TOKEN_INDEX);
require_neq!(token_index, TokenIndex::MAX);
let net_borrow_limit_window_size_ts = 24 * 60 * 60u64;
let now_ts: u64 = Clock::get()?.unix_timestamp.try_into().unwrap();