-
Notifications
You must be signed in to change notification settings - Fork 0
feat(payments): implement setter and getter methods #4
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
feat(payments): implement setter and getter methods #4
Conversation
a2dd43e to
380911b
Compare
27b5608 to
0d5819b
Compare
0d5819b to
2e796d7
Compare
ishay-starkware
left a comment
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.
you can also separate each getter and setter to a different PR.
also - no tests
Reviewed 1 of 3 files at r1, all commit messages.
Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @MohammadNassar1)
src/payments.cairo line 138 at r1 (raw file):
self.fulfillment.write(order_hash, order.amount_a.abs()); } }
separate this to a different PR - this pr is only for getters and setters as the title suggest.
you can also add the Order struct in a different PR and then you won't need the TODO
Code quote:
fn cancel_orders(ref self: ContractState, orders: Span<Order>) {
let caller = get_caller_address();
for order in orders {
assert(*order.address == caller, INVALID_CALLER_ADDRESS);
// TODO(Mohammad): Replace with actual hash computation logic.
let order_hash: HashType = Default::default();
self.fulfillment.write(order_hash, order.amount_a.abs());
}
}|
also in a different pr after you have the hash. Code quote: fn is_order_fulfilled(self: @ContractState, order: Order) -> bool {
// TODO(Mohammad): Replace with actual hash computation logic.
let order_hash: HashType = Default::default();
let fulfilled_amount = self.fulfillment.read(order_hash);
let ordered_amount = order.amount_a.abs();
ordered_amount == fulfilled_amount
} |
|
do this in a private fn called Code quote: assert(fee <= MAX_BASIS_POINTS.into(), INVALID_HIGH_FEE);
self.fee.write(fee); |
|
same Code quote: assert(recipient.is_non_zero(), INVALID_ZERO_ADDRESS);
self.fee_recipient.write(recipient); |
|
you should probably have a |
|
here call the |
|
|
MohammadNassar1
left a comment
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.
Reviewable status: 1 of 3 files reviewed, 7 unresolved discussions (waiting on @ishay-starkware)
src/payments.cairo line 114 at r1 (raw file):
Previously, ishay-starkware wrote…
you should probably have a
is_token_registeredfn as well
Done.
here
src/payments.cairo line 114 at r1 (raw file):
Previously, ishay-starkware wrote…
register_tokenandremove_tokenshould be in a separate PR
Done.
here
src/payments.cairo line 118 at r1 (raw file):
Previously, ishay-starkware wrote…
here call the
is_token_registered
Done.
here
2e796d7 to
f46b7bd
Compare
MohammadNassar1
left a comment
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.
Reviewable status: 1 of 3 files reviewed, 7 unresolved discussions (waiting on @ishay-starkware and @MohammadNassar1)
src/payments.cairo line 138 at r1 (raw file):
Previously, ishay-starkware wrote…
separate this to a different PR - this pr is only for getters and setters as the title suggest.
you can also add the Order struct in a different PR and then you won't need the TODO
Moved to another PR.
I'll keep it for now with the todo, as I got stuck with the order hash.
src/payments.cairo line 146 at r1 (raw file):
Previously, ishay-starkware wrote…
do this in a private fn called
_set_feeand then call it from the constructor as well
Done.
src/payments.cairo line 152 at r1 (raw file):
Previously, ishay-starkware wrote…
same
Done.
src/payments.cairo line 170 at r1 (raw file):
Previously, ishay-starkware wrote…
also in a different pr after you have the hash.
Moved to another PR.
I'll keep it for now with the todo, as I got stuck with the order hash.
f46b7bd to
c6cff51
Compare
MohammadNassar1
left a comment
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.
done
Reviewable status: 0 of 4 files reviewed, 7 unresolved discussions (waiting on @ishay-starkware and @MohammadNassar1)
|
i assume there should be some max fee as setting the fee to MAX_BASIS_POINTS doesn't make much sense |
ishay-starkware
left a comment
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.
Reviewed 2 of 4 files at r2, all commit messages.
Reviewable status: 2 of 4 files reviewed, 2 unresolved discussions (waiting on @MohammadNassar1)
src/errors.cairo line 1 at r2 (raw file):
pub const INVALID_CALLER_ADDRESS: felt252 = 'INVALID_CALLER_ADDRESS';
remove
Code quote:
ub const INVALID_CALLER_ADDRESS: felt252 = 'INVALID_CALLER_ADDRESS';c6cff51 to
9a02957
Compare
MohammadNassar1
left a comment
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.
Reviewable status: 2 of 4 files reviewed, 2 unresolved discussions (waiting on @ishay-starkware and @MohammadNassar1)
src/errors.cairo line 1 at r2 (raw file):
Previously, ishay-starkware wrote…
remove
Done.
src/payments.cairo line 159 at r2 (raw file):
Previously, ishay-starkware wrote…
i assume there should be some max fee as setting the fee to MAX_BASIS_POINTS doesn't make much sense
Done.
9a02957 to
91ec3bb
Compare
91ec3bb to
2360859
Compare
ishay-starkware
left a comment
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.
Reviewed 4 of 4 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @MohammadNassar1)
This change is