-
Notifications
You must be signed in to change notification settings - Fork 0
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: sui contract #1
base: main
Are you sure you want to change the base?
Conversation
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.
Just a few minors. Looks good
connection: cluster_connection::new(ctx.sender(), ctx), | ||
orders: table::new(ctx), | ||
finished_orders: table::new(ctx), | ||
fee: 1, |
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.
We should take this as a input
|
||
assert!(keccak256(&order.encode()) == keccak256(&fill.get_order_bytes())); | ||
assert!(order.get_dst_nid() == srcNid); | ||
let take= self.funds.remove<u128,Coin<T>>(fill.get_id()); |
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.
let take= self.funds.remove<u128,Coin<T>>(fill.get_id()); | |
let take = self.funds.remove<u128,Coin<T>>(fill.get_id()); |
) { | ||
let order_hash = keccak256(&order_bytes); | ||
let order = swap_order::decode(&order_bytes); | ||
|
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.
Missing check
If order.srcNID != srcNetwork:
ThrowError("Mismatched order")
assert!(!self.finished_orders.contains<vector<u8>,bool>(order_hash),EAlreadyFinished); | ||
|
||
// make sure user is filling token wanted by order | ||
assert!(string::from_ascii(type_name::get<F>().into_string())== order.get_to_token(),EInvalidFillToken); | ||
assert!((fill_token.value() as u128)==order.get_to_amount(),EInvalidPayoutAmount); |
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 one add error messages to asserts?
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.
ya only error numbers though
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1 +/- ##
=======================================
Coverage ? 88.41%
=======================================
Files ? 7
Lines ? 535
Branches ? 0
=======================================
Hits ? 473
Misses ? 62
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. |
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.
LGMT
Description:
Commit Message
see the guidelines for commit messages.
Changelog Entry
Checklist: