TokenRegister: Sanity checks on token_index
This commit is contained in:
parent
d1e3da2b75
commit
99360e69a3
|
@ -37,6 +37,7 @@ pub fn token_register(
|
||||||
ctx.accounts.mint.key()
|
ctx.accounts.mint.key()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
require_neq!(token_index, TokenIndex::MAX);
|
||||||
|
|
||||||
let now_ts: u64 = Clock::get()?.unix_timestamp.try_into().unwrap();
|
let now_ts: u64 = Clock::get()?.unix_timestamp.try_into().unwrap();
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@ pub fn token_register_trustless(
|
||||||
token_index: TokenIndex,
|
token_index: TokenIndex,
|
||||||
name: String,
|
name: String,
|
||||||
) -> Result<()> {
|
) -> 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 net_borrow_limit_window_size_ts = 24 * 60 * 60u64;
|
||||||
let now_ts: u64 = Clock::get()?.unix_timestamp.try_into().unwrap();
|
let now_ts: u64 = Clock::get()?.unix_timestamp.try_into().unwrap();
|
||||||
|
|
Loading…
Reference in New Issue