-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add URI and URIHash to the asset FT. (#685)
- Loading branch information
1 parent
81fc065
commit c03ed9c
Showing
19 changed files
with
706 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//go:build integrationtests | ||
|
||
package upgrade | ||
|
||
import ( | ||
"testing" | ||
|
||
sdkmath "cosmossdk.io/math" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/stretchr/testify/require" | ||
|
||
integrationtests "github.com/CoreumFoundation/coreum/v3/integration-tests" | ||
"github.com/CoreumFoundation/coreum/v3/pkg/client" | ||
"github.com/CoreumFoundation/coreum/v3/testutil/integration" | ||
assetfttypes "github.com/CoreumFoundation/coreum/v3/x/asset/ft/types" | ||
) | ||
|
||
type ftURIAttributesTest struct { | ||
token assetfttypes.Token | ||
} | ||
|
||
func (ftt *ftURIAttributesTest) Before(t *testing.T) { | ||
ctx, chain := integrationtests.NewCoreumTestingContext(t) | ||
requireT := require.New(t) | ||
assetftClient := assetfttypes.NewQueryClient(chain.ClientContext) | ||
|
||
issuer := chain.GenAccount() | ||
chain.FundAccountWithOptions(ctx, t, issuer, integration.BalancesOptions{ | ||
Messages: []sdk.Msg{ | ||
&assetfttypes.MsgIssue{}, | ||
}, | ||
Amount: chain.QueryAssetFTParams(ctx, t).IssueFee.Amount, | ||
}) | ||
|
||
issueMsg := &assetfttypes.MsgIssue{ | ||
Issuer: issuer.String(), | ||
Symbol: "ABC", | ||
Subunit: "uabc", | ||
Precision: 6, | ||
Description: "ABC Description", | ||
InitialAmount: sdkmath.NewInt(1000), | ||
Features: []assetfttypes.Feature{}, | ||
} | ||
_, err := client.BroadcastTx( | ||
ctx, | ||
chain.ClientContext.WithFromAddress(issuer), | ||
chain.TxFactory().WithGas(chain.GasLimitByMsgs(issueMsg)), | ||
issueMsg, | ||
) | ||
requireT.NoError(err) | ||
tokenRes, err := assetftClient.Token(ctx, &assetfttypes.QueryTokenRequest{ | ||
Denom: assetfttypes.BuildDenom(issueMsg.Subunit, issuer), | ||
}) | ||
requireT.NoError(err) | ||
ftt.token = tokenRes.Token | ||
} | ||
|
||
func (ftt *ftURIAttributesTest) After(t *testing.T) { | ||
ctx, chain := integrationtests.NewCoreumTestingContext(t) | ||
requireT := require.New(t) | ||
assetftClient := assetfttypes.NewQueryClient(chain.ClientContext) | ||
|
||
// check that prev token is available we can query it | ||
tokenRes, err := assetftClient.Token(ctx, &assetfttypes.QueryTokenRequest{ | ||
Denom: ftt.token.Denom, | ||
}) | ||
requireT.NoError(err) | ||
require.Equal(t, ftt.token, tokenRes.Token) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.