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

Add auto token register #3336

merged 14 commits into from
Apr 17, 2024

Conversation

lmoe
Copy link
Contributor

@lmoe lmoe commented Mar 14, 2024

Description of change

Adds an automatic ERC20 and IRC30 registration for native tokens. IRC27 will follow.

removed:

  • foundryModify
  • foundryDestroy

is outdated but remains:

  • foundryCreate

added:

  • nativeTokenCreate
  • nativeTokenModify
  • nativeTokenDestroy

nativeTokenCreate now combines the foundryCreation and the ERC20 token registration, therefore requires token name, token symbol and token decimals as additional arguments.

Furthermore, it stores IRC30 compatible metadata into the foundry output.

  • Wasp-clis create-foundry was replaced with create-native-token and requires additional arguments like above
    • erc20-register functions are still there for older foundries
  • ISCMagic has one additional function createNativeTokenFoundry (nothing was removed)
    • foundryCreateNew and registerERC20NativeToken remains for compatibility
  • Account core contract was regenerated
  • Tests were adjusted and new test cases were added
  • Some test structures were renamed from xyzFoundry to xyzNativeToken
  • Fixed a bug in foundryOutputRec, which results in a wrong input commitment if metadata is defined (was not serialized correctly)

It is mostly a breaking change in terms of the account core contract as foundry funcs were removed and the wasp-cli as create-foundry was replaced.

The ISCMagic has only one additional function more.

Type of change

Choose a type of change, and delete any options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Copy link
Collaborator

@jorgemmsilva jorgemmsilva left a comment

Choose a reason for hiding this comment

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

nice! 🚀

@@ -42,27 +42,20 @@ var (
)

type ImpersonatedOffLedgerRequestData struct {
req *OffLedgerRequestData
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is a good change, but it should be it's own PR tbh :/

@@ -195,21 +195,21 @@ func TestFoundryNew(t *testing.T) {
require.Equal(t, uint32(1), fnew.Results.FoundrySN().Value())
}

func TestFoundryModifySupply(t *testing.T) {
func NativeTokenndryModifySupply(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo

and I'm guessing this should start with TestNative....

@@ -42,27 +42,20 @@ var (
)

type ImpersonatedOffLedgerRequestData struct {
req *OffLedgerRequestData
OffLedgerRequestData
Copy link
Collaborator

Choose a reason for hiding this comment

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

good change, but this should be its own PR 🔧

FuncDeposit = coreutil.Func("deposit")

// Kept for compatibility reasons
FuncFoundryCreateNew = coreutil.Func("foundryCreateNew")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't get it.
if this is "kept for compatibility", shouldn't foundryDestroy and foundryModifySupply also be? 🤔

Copy link
Contributor Author

@lmoe lmoe Apr 9, 2024

Choose a reason for hiding this comment

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

Main reason for that was, that wasp-cli still has a foundry-create command and I wasn't sure where it is still in use. For example in some scripts or something. I didn't want to break things.

It is also still available in the magic contract, where I was very sure I could break things for 3rd party developers if I just remove it. :D

packages/vm/core/evm/evmimpl/restricted.go Outdated Show resolved Hide resolved
@lmoe lmoe marked this pull request as ready for review April 15, 2024 13:20
@jorgemmsilva jorgemmsilva merged commit df56a75 into develop Apr 17, 2024
5 checks passed
@jorgemmsilva jorgemmsilva deleted the add_auto_token_register branch April 17, 2024 12:45
This pull request was closed.
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