Predeployed contracts
snforge provides a set of predeployed contracts for use in testing. To support this functionality, we maintain CASM of these contracts directly within our codebase. Because these contracts are subject to periodic updates, these files need to be updated. The list below details all predeployed contracts and the information required to keep them current.
Adding new predeployed contract
To add a new predeployed contract, you need to add a new subdirectory with the name of the contract to the crates/cheatnet/src/data/predeployed_contracts directory. Then, you need to add artifact files to this subdirectory. CASM files should be renamed to casm.json.
📝 Note
When adding a new predeployed contract, make sure the class matches the one deployed on mainnet.
Structure of predeployed_contracts directory should be as follows:
$ tree
.
├── ERC20Lockable
│ └── casm.json
├── ERC20Mintable
│ └── casm.json
└── <Other contract>
└── casm.json
Updating existing predeployed contracts
STRK and ETH
These contracts are sourced from the starkgate-contracts repository.
Current Build Configuration:
- Version:
v3.0.0 - Commit Hash:
07e11c3
| Token | Contract Name | Source Code (Cairo) | Class on Mainnet |
|---|---|---|---|
| STRK | ERC20Lockable | View Source | 0x02e7...98fc |
| ETH | ERC20Mintable | View Source | 0x00b4...4ec |
Steps to update STRK and ETH predeployed contracts:
-
Clone
starkgate-contractsrepository and checkoutv3.0.0tag.git clone https://github.com/starknet-io/starkgate-contracts cd starkgate-contracts git checkout v3.0.0 -
Enable CASM generation by adding the following lines to
Scarb.toml. This should be done insg_tokenandstrkpackages.... [[target.starknet-contract]] casm = true ... -
Adjust compiler configuration in workspace
Scarb.toml:... [profile.release.cairo] add-statements-code-locations-debug-info = true add-statements-functions-debug-info = true panic-backtrace = true ... -
Compile contracts with
scarbscarb --release build -
Visit
target/releasedirectory and copy relevant artifacts into relevantpredeployed_contractssubdirectories incheatnetcodebase.