-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from hakymulla/constructor
Constructor
- Loading branch information
Showing
14 changed files
with
215 additions
and
202 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 |
---|---|---|
@@ -1,25 +1,72 @@ | ||
#!/bin/bash | ||
|
||
# Deploy the contracts | ||
deploy_contract() { | ||
local contract_name=$1 | ||
local class_hash=$2 | ||
# Load the addresses from the deployed-contracts.txt file | ||
declare -A class_hashes | ||
declare -A addresses | ||
|
||
echo "Deploying contract for $contract_name with class hash $class_hash..." | ||
|
||
# Run the deployment command and capture the output | ||
output=$(starkli deploy "$class_hash" --salt 0x1 -w) | ||
|
||
echo "$contract_name: $output" >> katana/deployed-contracts.txt | ||
echo "Deployment address for $contract_name saved to deployed-contracts.txt" | ||
} | ||
|
||
# Remove existing deployed-contracts.txt file if it exists | ||
rm -f katana/deployed-contracts.txt | ||
|
||
# Read each line from declared-classes.txt and deploy the contract | ||
while IFS= read -r line; do | ||
contract_name=$(echo "$line" | cut -d ':' -f 1 | xargs) | ||
class_hash=$(echo "$line" | cut -d ' ' -f 2 | xargs) | ||
deploy_contract "$contract_name" "$class_hash" | ||
|
||
class_hashes["$contract_name"]=$class_hash | ||
done < katana/declared-classes.txt | ||
|
||
messages_proxy_class_hash=${class_hashes["messages-proxy"]} | ||
headers_store_class_hash=${class_hashes["headers-store"]} | ||
fact_registry_class_hash=${class_hashes["fact-registry"]} | ||
|
||
# Debug: Print the class_hashes | ||
echo "Fact Registry Class hash: $fact_registry_class_hash" | ||
echo "Headers Store Class hash: $headers_store_class_hash" | ||
echo "Messages Proxy Class hash: $messages_proxy_class_hash" | ||
|
||
# Retrieve the L1_MESSAGE_SENDER_ADDRESS from the environment variables | ||
l1_message_sender_address=${L1_MESSAGE_SENDER_ADDRESS} | ||
owner_address=${OWNER_ADDRESS} # 0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03 //katana-0 | ||
admin_address=${ADMIN_ADDRESS} | ||
|
||
# Check if the L1_MESSAGE_SENDER_ADDRESS environment variable is set | ||
if [ -z "$l1_message_sender_address" ]; then | ||
echo "Error: L1_MESSAGE_SENDER_ADDRESS environment variable is not set." | ||
exit 1 | ||
fi | ||
|
||
# Remove existing declared-classes.txt file if it exists | ||
rm -f katana/deployed-contracts.txt | ||
|
||
# Perform Deployment | ||
# Message Proxy Deployment | ||
echo "Deploying messages-proxy with L1_MESSAGE_SENDER_ADDRESS and owner address..." | ||
output=$(starkli deploy "$messages_proxy_class_hash" "$l1_message_sender_address" "$owner_address" --salt 0x1 -w) | ||
# output=$(starkli deploy "$messages_proxy_class_hash" "$l1_message_sender_address" katana-1 --salt 0x1 -w) | ||
echo "messages-proxy: $output" >> katana/deployed-contracts.txt | ||
messages_proxy=$output | ||
echo "Messages Proxy address: $messages_proxy" | ||
echo "Deployment address for messages-proxy saved to deployed-contracts.txt" | ||
echo " " | ||
|
||
# Header Store Deployment | ||
echo "Deploying headers-store with messages-proxy address..." | ||
output=$(starkli deploy "$headers_store_class_hash" "$messages_proxy" "$admin_address" --salt 0x1 -w) | ||
echo "headers-store: $output" >> katana/deployed-contracts.txt | ||
headers_store=$output | ||
echo "Header Store address: $headers_store" | ||
echo "Deployment address for headers-store saved to deployed-contracts.txt" | ||
echo " " | ||
|
||
# Fact Registry Deployment | ||
echo "Deploying fact-registry with headers-store address and owner address..." | ||
output=$(starkli deploy "$fact_registry_class_hash" "$headers_store" "$owner_address" --salt 0x1 -w) | ||
echo "fact-registry: $output" >> katana/deployed-contracts.txt | ||
echo "Fact Registry address: $headers_store" | ||
echo "Deployment address for fact-registry saved to deployed-contracts.txt" | ||
|
||
echo "Deployment complete." | ||
|
||
echo " " | ||
|
||
#Set l1_headers_store_address for messages-proxy | ||
echo "Setting headers-store for messages-proxy contract..." | ||
output=$(starkli invoke "$messages_proxy" set_l1_headers_store "$headers_store" --account katana-0 -w) | ||
|
||
echo "l1_headers_store_address set complete." |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export STARKNET_ACCOUNT=katana-0 | ||
export STARKNET_RPC=http://0.0.0.0:5050 | ||
export OWNER_ADDRESS=0xb3ff441a68610b30fd5e2abbf3a1548eb6ba6f3559f2862bf2dc757e5828ca | ||
export OWNER_ADDRESS=0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03 | ||
export ADMIN_ADDRESS=0xe29882a1fcba1e7e10cad46212257fea5c752a4f9b1b1ec683c503a2cf5c8a | ||
export L1_MESSAGE_SENDER_ADDRESS=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 |
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
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 |
---|---|---|
@@ -1,17 +1,11 @@ | ||
#[starknet::interface] | ||
pub trait IL1MessagesProxy<TState> { | ||
fn initialize( | ||
ref self: TState, | ||
l1_messages_sender: starknet::EthAddress, | ||
l1_headers_store_address: starknet::ContractAddress, | ||
owner: starknet::ContractAddress | ||
); | ||
fn set_l1_headers_store(ref self: TState, l1_headers_store_address: starknet::ContractAddress); | ||
fn change_contract_addresses( | ||
ref self: TState, | ||
l1_messages_sender: starknet::EthAddress, | ||
l1_headers_store_address: starknet::ContractAddress | ||
); | ||
fn get_initialized(self: @TState) -> bool; | ||
fn get_l1_messages_sender(self: @TState) -> starknet::EthAddress; | ||
fn get_l1_headers_store_address(self: @TState) -> starknet::ContractAddress; | ||
} |
Oops, something went wrong.