add gt 0 checks

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-03-31 16:02:18 +02:00
parent fce4edb79f
commit 9e2d5de914
2 changed files with 4 additions and 0 deletions

View File

@ -52,6 +52,8 @@ impl<'info> Deposit<'info> {
// That would save a lot of computation that needs to go into finding the
// right index for the mint.
pub fn deposit(ctx: Context<Deposit>, amount: u64) -> Result<()> {
require!(amount > 0, MangoError::SomeError);
let token_index = ctx.accounts.bank.load()?.token_index;
// Get the account's position for that token index

View File

@ -53,6 +53,8 @@ impl<'info> Withdraw<'info> {
// That would save a lot of computation that needs to go into finding the
// right index for the mint.
pub fn withdraw(ctx: Context<Withdraw>, amount: u64, allow_borrow: bool) -> Result<()> {
require!(amount > 0, MangoError::SomeError);
let group = ctx.accounts.group.load()?;
let token_index = ctx.accounts.bank.load()?.token_index;