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

Prototype Smart Contract reworking #159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Prototype Smart Contract reworking #159

wants to merge 1 commit into from

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