-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup path to maintain contract class hashes and program hashes
- Loading branch information
Showing
14 changed files
with
545 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
if ! command -v cairo-compile > /dev/null | ||
then | ||
echo "please start cairo dev environment" | ||
exit 1 | ||
fi | ||
|
||
if ! command -v starknet-compile-deprecated > /dev/null | ||
then | ||
echo "please start cairo dev environment" | ||
exit 1 | ||
fi | ||
|
||
git submodule update --init | ||
|
||
# setup test_contract path | ||
cp tests/dependencies/test_contract_interface.cairo cairo-lang/src/starkware/starknet/core/test_contract/ | ||
cp tests/dependencies/deprecated_syscalls.cairo cairo-lang/src/starkware/starknet/core/test_contract/ | ||
|
||
starknet-compile-deprecated --no_debug_info tests/contracts/test_contract.cairo --output build/test_contract.json --cairo_path cairo-lang/src | ||
|
||
# setup token_for_testing path | ||
mkdir -p cairo-lang/src/starkware/starknet/std_contracts/ERC20 | ||
cp tests/dependencies/ERC20.cairo cairo-lang/src/starkware/starknet/std_contracts/ERC20/ | ||
cp tests/dependencies/ERC20_base.cairo cairo-lang/src/starkware/starknet/std_contracts/ERC20/ | ||
cp tests/dependencies/permitted.cairo cairo-lang/src/starkware/starknet/std_contracts/ERC20/ | ||
mkdir -p cairo-lang/src/starkware/starknet/std_contracts/upgradability_proxy | ||
cp tests/dependencies/initializable.cairo cairo-lang/src/starkware/starknet/std_contracts/upgradability_proxy | ||
|
||
# compile starknet contract | ||
starknet-compile-deprecated --no_debug_info tests/contracts/token_for_testing.cairo --output build/token_for_testing.json --cairo_path cairo-lang/src --account_contract | ||
starknet-compile-deprecated --no_debug_info tests/contracts/dummy_account.cairo --output build/dummy_account.json --cairo_path cairo-lang/src --account_contract | ||
starknet-compile-deprecated --no_debug_info tests/contracts/dummy_token.cairo --output build/dummy_token.json --cairo_path cairo-lang/src --account_contract | ||
|
||
# compile os with debug info | ||
cairo-compile cairo-lang/src/starkware/starknet/core/os/os.cairo --output build/os_debug.json --cairo_path cairo-lang/src | ||
|
||
# compile cairo programs | ||
cairo-compile tests/programs/different_output.cairo --output build/different_output.json | ||
cairo-compile tests/programs/fact.cairo --output build/fact.json | ||
cairo-compile tests/programs/hint.cairo --output build/hint.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
shopt -s extglob | ||
|
||
git submodule deinit -f . | ||
git submodule update --init | ||
|
||
# remove compiled contracts | ||
rm -f build/!(os_latest.json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// The fee token contract used in tests; allow easy initialization using a single `DeployAccount` | ||
// transaction; also serves as a faucet account. | ||
|
||
%lang starknet | ||
|
||
from starkware.cairo.common.alloc import alloc | ||
from starkware.cairo.common.cairo_builtins import HashBuiltin | ||
from starkware.cairo.common.uint256 import Uint256 | ||
from starkware.starknet.common.syscalls import get_contract_address | ||
from starkware.starknet.core.test_contract.dummy_account import ( | ||
__execute__, | ||
__validate__, | ||
__validate_declare__, | ||
__validate_deploy__, | ||
deploy_contract, | ||
) | ||
from starkware.starknet.std_contracts.ERC20.ERC20 import initialize, permissionedMint, transfer | ||
from starkware.starknet.std_contracts.ERC20.ERC20_base import ERC20_mint, balanceOf, name | ||
|
||
const AMOUNT_TO_MINT = 2 ** 127; | ||
|
||
@constructor | ||
func constructor{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() { | ||
let (self_address: felt) = get_contract_address(); | ||
let (init_vector: felt*) = alloc(); | ||
|
||
// Name. | ||
assert init_vector[0] = 'Wrapped Ether'; | ||
// Symbol. | ||
assert init_vector[1] = 'WETH'; | ||
// Decimals. | ||
assert init_vector[2] = 18; | ||
// Minter address. | ||
assert init_vector[3] = self_address; | ||
|
||
initialize(init_vector_len=4, init_vector=init_vector); | ||
ERC20_mint(recipient=self_address, amount=Uint256(low=AMOUNT_TO_MINT, high=0)); | ||
return (); | ||
} |
Oops, something went wrong.