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/derivatives fix command close potision #388

Merged

Conversation

mkXultra
Copy link
Contributor

No description provided.

…nto feat/derivatives-fix-command-close-potision

 Conflicts:
	x/derivatives/keeper/perpetual_options.go
	x/derivatives/keeper/positions.go
@mkXultra mkXultra requested a review from taiki1frsh February 21, 2023 04:11
@mkXultra mkXultra self-assigned this Feb 21, 2023
@@ -78,13 +79,17 @@ jq '.app_state.derivatives.params.perpetual_futures.commission_rate = "0.001"' $
jq '.app_state.derivatives.params.perpetual_futures.margin_maintenance_rate = "0.5"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json;
jq '.app_state.derivatives.params.perpetual_futures.imaginary_funding_rate_proportional_coefficient = "0.0005"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json;
jq '.app_state.derivatives.params.perpetual_futures.markets = [{"base_denom": "ubtc", "quote_denom": "uusd" }]' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json;
Copy link
Collaborator

Choose a reason for hiding this comment

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

please change "uusd" to "uusdc".
didn't check it, sorry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -12,8 +12,11 @@ $BINARY tx derivatives burn-lpt 1 ubtc --from=$USER1 $conf | jq .raw_log | sed '
$BINARY tx derivatives burn-lpt 1 ubtc --from=$USER1 $conf | jq .raw_log | sed 's/\\n/\n/g'

# open-position perpetual-futures
$BINARY tx derivatives open-position perpetual-futures 100ubtc ubtc uusdc long --from=$USER1 $conf | jq .raw_log | sed 's/\\n/\n/g'
$BINARY tx derivatives open-position perpetual-futures 100uusdc ubtc uusdc short --from=$USER1 $conf | jq .raw_log | sed 's/\\n/\n/g'
$BINARY tx derivatives open-position perpetual-futures 100ubtc ubtc uusd long --from=$USER1 $conf | jq .raw_log | sed 's/\\n/\n/g'
Copy link
Collaborator

Choose a reason for hiding this comment

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

plz change "uusd" to "uusdc" after the change of the markets values in genesis.json.
plz refer init.sh file comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

uusdc does't work.
uusd is working

Copy link
Collaborator

Choose a reason for hiding this comment

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

with this modification (#388 (comment)), it should work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it does not work.
I have tried that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry, needed one more modification.
#388 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's working

positionId := string(positionKey)
lastPosition, err := k.GetLastPosition(ctx)
if err != nil {
panic("failed to get last position")
Copy link
Collaborator

@taiki1frsh taiki1frsh Feb 21, 2023

Choose a reason for hiding this comment

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

maybe better to define Error case and return err, instead of executing panic?

Copy link
Contributor Author

@mkXultra mkXultra Feb 21, 2023

Choose a reason for hiding this comment

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

This case is usually not possible.
In such cases, Chain should be stopped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I made a mistake.
I've fixed it

@mkXultra
Copy link
Contributor Author

@taiki1frsh
plz review again

jq '.app_state.derivatives.params.perpetual_futures.markets = [{"base_denom": "ubtc", "quote_denom": "uusdc" }]' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json;
jq '.app_state.bank.denom_metadata = [
{"base" : "ubtc" , "symbol": "ubtc"},
{"base" : "uusd", "symbol": "uusdc"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

plz change "uusd" to "uusdc" here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@mkXultra mkXultra merged commit a22fb11 into feat/derivatives Feb 22, 2023
@mkXultra mkXultra deleted the feat/derivatives-fix-command-close-potision branch February 22, 2023 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants