-
Notifications
You must be signed in to change notification settings - Fork 97
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: NTRN-332. Add tokenfactory module #131
Conversation
go.mod
Outdated
@@ -137,5 +135,6 @@ replace ( | |||
github.com/cosmos/admin-module => github.com/Ethernal-Tech/admin-module v0.0.0-20221102105340-e693f4d379c3 | |||
github.com/cosmos/ibc-go/v3 => github.com/informalsystems/ibc-go/v3 v3.0.0-beta1.0.20220816140824-aba9c2f2b943 | |||
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 | |||
github.com/osmosis-labs/osmosis/v10 v10.2.0 => github.com/neutron-org/osmosis/v10 v10.2.0-native-sdk-4 |
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.
I think we need a separate branch in our osmosis fork (like we did with wasmd fork) where we will push necessary changes for us.
Also it's easier to see the diff
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
02b1904
to
2de813c
Compare
9494728
to
4c674b1
Compare
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 leave an info that this module is a copy paste from Osmosis.
And maybe some License file
ICYMI, there is a maintained standalone repo for token-factory, so you can perhaps avoid copy-pasting the entire module codebase into this repo: https://github.com/CosmWasm/token-factory |
Also, I don't see wasm bindings for token-factory. The bindings are needed for contracts to actually use the module. See Osmosis' bindings here: https://github.com/osmosis-labs/osmosis/blob/main/wasmbinding/bindings/msg.go#L6-L17 |
Yes we saw it but thank you anyway. We decided to copypaste code because we also want to integrate ibc hooks module as well and wanted to have everything under our control. |
Thanks for pointing this out. I will implement it as well! |
@albertandrejev there has been some recent development on the token factory in the osmosis repo to introduce side effects. osmosis-labs/osmosis#4382 Any chance these features could be included in the integration of token factory into neutron. It would be extremely useful 🙏 |
Thank you for your message but there is difficulties to implement some of these features:
|
6703089
to
5ea153d
Compare
The base branch was changed.
07c6cae
to
c797f61
Compare
c797f61
to
d73669a
Compare
CreateDenom *CreateDenom `json:"create_denom,omitempty"` | ||
/// Contracts can change the admin of a denom that they are the admin of. | ||
ChangeAdmin *ChangeAdmin `json:"change_admin,omitempty"` | ||
/// Contracts can mint native tokens for an existing factory denom | ||
/// that they are the admin of. | ||
MintTokens *MintTokens `json:"mint_tokens,omitempty"` | ||
/// Contracts can burn native tokens for an existing factory denom | ||
/// that they are the admin of. | ||
/// Currently, the burn from address must be the admin contract. | ||
BurnTokens *BurnTokens `json:"burn_tokens,omitempty"` |
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.
There are bindings on Neutron side but I don't necessary changes in our cosmwasm neurton-sdk. Am I wrong?
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.
missed this point, thanks!
wasmbinding/custom_querier.go
Outdated
|
||
bz, err := json.Marshal(res) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to JSON marshal DenomAdminResponse response: %w", err) |
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 use sdkerrors.Wrap
everywhere above, but here you use fmt.Errorf
. Why?
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.
wasmbinding/custom_querier.go
Outdated
case contractQuery.DenomAdmin != nil: | ||
res, err := qp.GetDenomAdmin(ctx, contractQuery.DenomAdmin.Subdenom) | ||
if err != nil { | ||
return nil, err |
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.
Please wrap an error with some meaningful description
_, err = msgServer.Mint(sdk.WrapSDKContext(ctx), sdkMsg) | ||
if err != nil { | ||
return sdkerrors.Wrap(err, "minting coins from message") | ||
} |
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.
Not critical, but we usually leave \n
after error handling
Osmosis has the token factory module that allows anyone to create new native tokens. We want to have it in Neutron, so we need to see if it’s possible to easily include it to our codebase: osmosis/x/tokenfactory at main · osmosis-labs/osmosis
Main reason why we decided to copypaste code because we also want to integrate ibc hooks module as well and wanted to have everything under our control.
Dependent:
neutron-org/neutron-integration-tests#75
neutron-org/neutron-docs#52
Depends on:
neutron-org/neutron-dev-contracts#8
Task: NTRN-332
Test run