Skip to content
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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

feat: sui contract #1

wants to merge 17 commits into from

Conversation

ibrizsabin
Copy link
Collaborator

@ibrizsabin ibrizsabin commented Sep 20, 2024

Description:

Commit Message

type: commit message

see the guidelines for commit messages.

Changelog Entry

version: <log entry>

Checklist:

  • I have performed a self-review of my own code
  • I have documented my code in accordance with the documentation guidelines
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have run the unit tests
  • I only have one commit (if not, squash them into one commit).
  • I have a descriptive commit message that adheres to the commit message guidelines

Please review the CONTRIBUTING.md file for detailed contributing guidelines.

@ibrizsabin ibrizsabin self-assigned this Sep 20, 2024
@ibrizsabin ibrizsabin added the enhancement New feature or request label Sep 25, 2024
Copy link

@AntonAndell AntonAndell left a 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

contracts/sui/intent_v1/sources/main.move Outdated Show resolved Hide resolved
connection: cluster_connection::new(ctx.sender(), ctx),
orders: table::new(ctx),
finished_orders: table::new(ctx),
fee: 1,

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());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);

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")

Comment on lines 284 to 288
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);

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?

Copy link
Collaborator Author

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-commenter
Copy link

codecov-commenter commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@81f4cbd). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main       #1   +/-   ##
=======================================
  Coverage        ?   88.41%           
=======================================
  Files           ?        7           
  Lines           ?      535           
  Branches        ?        0           
=======================================
  Hits            ?      473           
  Misses          ?       62           
  Partials        ?        0           
Flag Coverage Δ
solidity 88.41% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link

@AntonAndell AntonAndell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants