Skip to content

Latest commit

 

History

History
92 lines (55 loc) · 4.02 KB

README.md

File metadata and controls

92 lines (55 loc) · 4.02 KB

zend-token

ZEND token implementation

L1 token

The L1 token contract is a simple child contract of the OpenZeppelin reference ERC20 implementation.

Prerequisites

Install Foundry for Solidity compilation. Check your Foundry installation with:

forge --version

Building

To build the contract simply run:

forge build

Built artifacts will be available in the ./out folder.

L2 token

The L2 token contract is not manually deployed. Instead, it's automatically deployed by the L2 token bridge contract when a permissionless token enrollment is triggered on the L1 token bridge manager contract. Therefore, the L2 token contract code to be deployed is completely up to the official StarkGate configuration. Any L2 token contract instance deployed this way is mintable only from the bridge contract.

Note

As of this writing, the L2 token class hash deployed by StarkGate is 0x05ffbcfeb50d200a0677c48a129a11245a3fc519d1d98d76882d1c9a1b19c6ed.

Despite our lack of control over the implementation, the token contract is still reproduced here (along with dependencies) from its upstream source for reference.

Additionally, due to the fact that none of the major Starknet block explorers offer Cairo 1 contract verification as of this writing, this repo provides tools for deterministic compilation as a means of verification.

Building directly

With the starknet-compile command from starkware-libs/cairo installed, run:

mkdir -p ./build
starknet-compile . -c openzeppelin::token::erc20_v070::erc20::ERC20 ./build/ERC20.json

Tip

You must install v2.3.0 or newer for starknet-compile to be able to compile successfully.

The compiled contract is available at ./build/ERC20.json.

Deterministic compilation with Docker

To ensure deterministic compilation output, a script is provided that generates the exact same class as the one used in production:

./scripts/compile_l2_with_docker.sh

The compiled contract is available at ./build/ERC20.json.

Verifying class hash

Either built directly or with Docker, you may verify that the class hash of the compiled contract artifact with the starkli class-hash command from Starkli.

Deployed addresses

This section lists deployed contract addresses.

Mainnet

Audits

Audit reports for contracts in this repository:

License

Licensed under either of

at your option, except the content in ./l2/, which is licensed with its upstream source.