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

Add auto token register #3336

Merged
merged 14 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ all: build-lint

wasm:
bash contracts/wasm/scripts/schema_all.sh
bash contracts/wasm/scripts/core_build.sh

compile-solidity:
cd packages/vm/core/evm/iscmagic && go generate
Expand Down
14 changes: 7 additions & 7 deletions contracts/wasm/corecontracts/test/core_accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func TestFoundryCreateNew(t *testing.T) {
require.Equal(t, uint32(2), f.Results.FoundrySN().Value())
}

func TestFoundryDestroy(t *testing.T) {
func TestNativeTokenDestroy(t *testing.T) {
ctx := setupAccounts(t)
user := ctx.NewSoloAgent("user")

Expand All @@ -172,7 +172,7 @@ func TestFoundryDestroy(t *testing.T) {
// Foundry Serial Number start from 1 and has increment 1 each func call
require.Equal(t, uint32(1), fnew.Results.FoundrySN().Value())

fdes := coreaccounts.ScFuncs.FoundryDestroy(ctx)
fdes := coreaccounts.ScFuncs.NativeTokenDestroy(ctx)
fdes.Params.FoundrySN().SetValue(1)
fdes.Func.Post()
require.NoError(t, ctx.Err)
Expand All @@ -195,21 +195,21 @@ func TestFoundryNew(t *testing.T) {
require.Equal(t, uint32(1), fnew.Results.FoundrySN().Value())
}

func TestFoundryModifySupply(t *testing.T) {
func TestNativeTokenFoundryModifySupply(t *testing.T) {
ctx := setupAccounts(t)
user0 := ctx.NewSoloAgent("user0")

mintAmount := wasmtypes.NewScBigInt(1000)
foundry, err := ctx.NewSoloFoundry(mintAmount, user0)
require.NoError(t, err)

fmod1 := coreaccounts.ScFuncs.FoundryModifySupply(ctx.Sign(user0))
fmod1 := coreaccounts.ScFuncs.NativeTokenModifySupply(ctx.Sign(user0))
fmod1.Params.FoundrySN().SetValue(1)
fmod1.Params.SupplyDeltaAbs().SetValue(wasmtypes.BigIntFromString("10"))
fmod1.Func.TransferBaseTokens(sdAllowance).Post()
require.NoError(t, ctx.Err)

fmod2 := coreaccounts.ScFuncs.FoundryModifySupply(ctx.Sign(user0))
fmod2 := coreaccounts.ScFuncs.NativeTokenModifySupply(ctx.Sign(user0))
fmod2.Params.FoundrySN().SetValue(foundry.SN())
fmod2.Params.SupplyDeltaAbs().SetValue(wasmtypes.BigIntFromString("10"))
fmod2.Params.DestroyTokens().SetValue(true)
Expand Down Expand Up @@ -668,7 +668,7 @@ func TestGetNativeTokenIDRegistry(t *testing.T) {
require.False(t, f.Results.Mapping().GetBool(notExistTokenID).Value())
}

func TestFoundryOutput(t *testing.T) {
func TestNativeTokenOutput(t *testing.T) {
ctx := setupAccounts(t)
user := ctx.NewSoloAgent("user")

Expand All @@ -685,7 +685,7 @@ func TestFoundryOutput(t *testing.T) {
serialNum := uint32(1)
require.Equal(t, serialNum, fnew.Results.FoundrySN().Value())

f := coreaccounts.ScFuncs.FoundryOutput(ctx)
f := coreaccounts.ScFuncs.NativeToken(ctx)
f.Params.FoundrySN().SetValue(1)
f.Func.Call()
require.NoError(t, ctx.Err)
Expand Down
Loading
Loading