-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onBehalf audit fixes + unit tests #996
Conversation
Coverage SummaryTotals
FilesExpand
|
Contract comparison - from 58a7e74 to 045e4ac
|
@@ -21,7 +28,7 @@ pub trait OriginalOwnerHelperModule { | |||
} else { | |||
require!( | |||
original_owner == payment_original_owner, | |||
"All position must have the same original owner" | |||
"Original owner is not the same for all payments" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't comment on the whole code, but instead of using ManagedAddress::zero()
as the default value, you could do this to make it more clear:
let mut opt_original_owner = None;
//// other code
for ...
{
/////
match opt_original_owner {
Some(original_owner) => require!(...),
None => opt_original_owner = Some(payment_original_owner),
}
}
require!( | ||
lp_original_owner != ManagedAddress::zero(), | ||
"LP Token original owner incorrect" | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the is_zero()
method of ManagedAddress
instead.
require!( | ||
lp_original_owner != ManagedAddress::zero(), | ||
"LP Token original owner incorrect" | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require!( | |
lp_original_owner != ManagedAddress::zero(), | |
"LP Token original owner incorrect" | |
); | |
require!( | |
!lp_original_owner.is_zero(), | |
"LP Token original owner incorrect" | |
); |
045e4ac
No description provided.