Skip to content

Prototype Smart Contract reworking#159

Open
gregLibert wants to merge 1 commit intomainfrom
erc20
Open

Prototype Smart Contract reworking#159
gregLibert wants to merge 1 commit intomainfrom
erc20

Conversation

@gregLibert
Copy link
Contributor

No description provided.

@gregLibert
Copy link
Contributor Author

The idea is to be able to create a basic smart contract doing something like:

import { u256 } from "as-bignum/assembly";
import { ERC20Impl } from "@massalabs/sc-standards/smart-contract/erc20/assembly";
export * from "@massalabs/sc-standards/smart-contract/erc20/assembly/exportable/erc20Core";

// @ts-ignore
@global const FungibleToken = new ERC20("USD", "$", 9, u256.fromU32(1000));

Or, for a mintable version:

import { u256 } from "as-bignum/assembly";
import { ERC20Impl, Exportable } from "@massalabs/sc-standards/smart-contract/erc20/assembly";
export * from "@massalabs/sc-standards/smart-contract/erc20/assembly/exportable/erc20Mintable";

// @ts-ignore
@global const FungibleToken = new ERC20("USD", "$", 9, u256.Zero);

const minter = new Address("AU1...");

export function mint(args: StaticArray<u8>): void{
  assert( Context.caller() == minter, "Forbidden");
  Exportable.mint(args);
}

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