ZEND token implementation
The L1 token contract is a simple child contract of the OpenZeppelin reference ERC20 implementation.
Install Foundry for Solidity compilation. Check your Foundry installation with:
forge --version
To build the contract simply run:
forge build
Built artifacts will be available in the ./out
folder.
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.
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
.
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
.
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.
This section lists deployed contract addresses.
- Ethereum: 0xb2606492712D311be8f41d940AFE8CE742A52D44
- Starknet: 0x00585c32b625999e6e5e78645ff8df7a9001cf5cf3eb6b80ccdd16cb64bd3a34
Audit reports for contracts in this repository:
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option, except the content in ./l2/
, which is licensed with its upstream source.