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

SignalBuy contract #197

Open
wants to merge 43 commits into
base: v5
Choose a base branch
from
Open

SignalBuy contract #197

wants to merge 43 commits into from

Conversation

NIC619
Copy link
Contributor

@NIC619 NIC619 commented May 18, 2023

  • Modified from LimitOrder contracts
  • It checks takerToken/makerToken ratio and make sure the ratio provided by taker is better than or equal to order's specified ratio
  • Since maker can receive more taker token if takerToken/makerToken ratio is better, the token type of the filled token amount record is changed from taker token to maker token.
    • added orderHashToMakerTokenFilledAmount to LibOrderStorage
  • add tests to check
    • worse takerToken/makerToken ratio can not be filled and
    • better takerToken/makerToken ratio can be filled fully/multiple times

@charlesjhongc
Copy link
Contributor

Overall no particular issues to me. I think the app can test on it first to see whether it fits the need or not.

contracts/PionexContract.sol Outdated Show resolved Hide resolved
contracts/PionexContract.sol Outdated Show resolved Hide resolved
test/forkMainnet/PionexContract.t.sol Outdated Show resolved Hide resolved
Copy link
Contributor

@charlesjhongc charlesjhongc left a comment

Choose a reason for hiding this comment

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

I think it's ready for them to test. Perhaps can consider remove coordinator first so it's easier to onboard them.

LimitOrder -> PionexContract;
fillLimitOrderByTrader -> fillLimitOrder
Order.pionexTokenAmount -> minPionexTokenAmount;
remainingAmount -> remainingUserTokenAmount
pilagod
pilagod previously approved these changes May 29, 2023

// Check provided pionexToken/userToken ratio is better than or equal to user's specfied pionexToken/userToken ratio
// -> _params.pionexTokenAmount/_params.userTokenAmount >= _order.pionexTokenAmount/_order.userTokenAmount
require(
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the minPionexTokenAmount should be checked after fee deducted, may be this require can be removed since it'd be reverted if pionexTokenForUser < _settlement.minPionexTokenAmount even the ratio here is better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Fixed in ed48d9b

@NIC619 NIC619 changed the title Pionex contract SignalBuy contract Jun 14, 2023
contracts/SignalBuyContract.sol Outdated Show resolved Hide resolved
contracts/interfaces/ISignalBuyContract.sol Outdated Show resolved Hide resolved
charlesjhongc
charlesjhongc previously approved these changes Jun 14, 2023
changwu-tw
changwu-tw previously approved these changes Jun 14, 2023
@NIC619 NIC619 dismissed stale reviews from changwu-tw and charlesjhongc via 91938e2 June 14, 2023 09:19
changwu-tw
changwu-tw previously approved these changes Jun 19, 2023
Copy link

@Jpk313183 Jpk313183 left a comment

Choose a reason for hiding this comment

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

Approving the merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants