Skip to content

Commit

Permalink
refactor: standardize env files names (#175)
Browse files Browse the repository at this point in the history
* refactor: standardize env file names

* docs: update docs with new env variables names

* fix(integration-test.yml): use anvil env names for Starknet Messaging Contract

* fix: use correct starknet wallet address name
  • Loading branch information
JuArce authored Feb 26, 2024
1 parent b5207b5 commit 79f99d9
Show file tree
Hide file tree
Showing 30 changed files with 149 additions and 147 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ jobs:
# Deploy PaymentRegistry, Escrow, set escrow, set claimPayment selector and test complete flow
- name: Deploy and test complete flow
run: |
export ETH_RPC_URL=${{vars.ETH_RPC_URL}}
export ETHEREUM_RPC=${{vars.ETHEREUM_RPC}}
export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}}
export ETH_PRIVATE_KEY=${{vars.ETH_PRIVATE_KEY}}
export SN_MESSAGING_ADDRESS=${{vars.SN_MESSAGING_ADDRESS}}
export MM_ETHEREUM_WALLET=${{vars.MM_ETHEREUM_WALLET}}
export ETHEREUM_PRIVATE_KEY=${{vars.ETHEREUM_PRIVATE_KEY}}
export STARKNET_MESSAGING_ADDRESS=${{vars.STARKNET_MESSAGING_ADDRESS}}
export MM_ETHEREUM_WALLET_ADDRESS=${{vars.MM_ETHEREUM_WALLET_ADDRESS}}
export SKIP_VERIFY=true
. ./contracts/solidity/deploy.sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scripts/assert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ assert() {

echo ""

DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETH_RPC_URL $DESTINATION_ADDRESS)
DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC $DESTINATION_ADDRESS)
EXPECTED_DESTINATION_FINAL_BALANCE=10001000000000000000000
assert "[[ $DESTINATION_FINAL_BALANCE -eq $EXPECTED_DESTINATION_FINAL_BALANCE ]]" "Destination balance" "$EXPECTED_DESTINATION_FINAL_BALANCE" "$DESTINATION_FINAL_BALANCE"

ESCROW_FINAL_BALANCE=$(starkli balance --raw $ESCROW_CONTRACT_ADDRESS)
EXPECTED_ESCROW_FINAL_BALANCE=0
assert "[[ $ESCROW_FINAL_BALANCE -eq $EXPECTED_ESCROW_FINAL_BALANCE ]]" "Escrow balance" "$EXPECTED_ESCROW_FINAL_BALANCE" "$ESCROW_FINAL_BALANCE"

MM_FINAL_BALANCE=$(starkli balance --raw $MM_SN_WALLET_ADDR)
MM_FINAL_BALANCE=$(starkli balance --raw $MM_STARKNET_WALLET_ADDRESS)
EXPECTED_MM_FINAL_BALANCE=1001000025000000000000
assert "[[ $MM_FINAL_BALANCE -eq $EXPECTED_MM_FINAL_BALANCE ]]" "MM balance" "$EXPECTED_MM_FINAL_BALANCE" "$MM_FINAL_BALANCE"
6 changes: 3 additions & 3 deletions .github/workflows/scripts/claim_payment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
echo -e "${GREEN}\n=> [SN] Making withdraw${COLOR_RESET}" # 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 -> 642829559307850963015472508762062935916233390536

ESCROW_INITIAL_BALANCE=$(starkli balance $ESCROW_CONTRACT_ADDRESS)
MM_INITIAL_BALANCE=$(starkli balance $MM_SN_WALLET_ADDR)
MM_INITIAL_BALANCE=$(starkli balance $MM_STARKNET_WALLET_ADDRESS)
echo "Initial Escrow balance: $ESCROW_INITIAL_BALANCE"
echo "Initial MM balance: $MM_INITIAL_BALANCE"

echo "Withdrawing $AMOUNT"
cast send --rpc-url $ETH_RPC_URL --private-key $ETH_PRIVATE_KEY \
cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY \
$PAYMENT_REGISTRY_PROXY_ADDRESS "claimPayment(uint256, uint256, uint256)" \
"0" "642829559307850963015472508762062935916233390536" "$AMOUNT" \
--value $AMOUNT >> /dev/null
Expand All @@ -20,6 +20,6 @@ sleep 15
starkli call $ESCROW_CONTRACT_ADDRESS get_order_pending u256:0

ESCROW_FINAL_BALANCE=$(starkli balance $ESCROW_CONTRACT_ADDRESS)
MM_FINAL_BALANCE=$(starkli balance $MM_SN_WALLET_ADDR)
MM_FINAL_BALANCE=$(starkli balance $MM_STARKNET_WALLET_ADDRESS)
echo "Final Escrow balance: $ESCROW_FINAL_BALANCE"
echo "Final MM balance: $MM_FINAL_BALANCE"
10 changes: 5 additions & 5 deletions .github/workflows/scripts/transfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ DESTINATION_ADDRESS_UINT=642829559307850963015472508762062935916233390536

echo -e "${GREEN}\n=> [SN] Making transfer to Destination account${COLOR_RESET}" # 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 -> 642829559307850963015472508762062935916233390536

MM_INITIAL_BALANCE=$(cast balance --rpc-url $ETH_RPC_URL --ether $MM_ETHEREUM_WALLET)
DESTINATION_INITIAL_BALANCE=$(cast balance --rpc-url $ETH_RPC_URL --ether $DESTINATION_ADDRESS)
MM_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS)
DESTINATION_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $DESTINATION_ADDRESS)
echo "Initial MM balance: $MM_INITIAL_BALANCE"
echo "Initial Destination balance: $DESTINATION_INITIAL_BALANCE"

echo "Transferring $AMOUNT to $DESTINATION_ADDRESS"
cast send --rpc-url $ETH_RPC_URL --private-key $ETH_PRIVATE_KEY \
cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY \
$PAYMENT_REGISTRY_PROXY_ADDRESS "transfer(uint256, uint256, uint256)" \
"0" "$DESTINATION_ADDRESS_UINT" "$AMOUNT" \
--value $AMOUNT >> /dev/null

MM_FINAL_BALANCE=$(cast balance --rpc-url $ETH_RPC_URL --ether $MM_ETHEREUM_WALLET)
DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETH_RPC_URL --ether $DESTINATION_ADDRESS)
MM_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS)
DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $DESTINATION_ADDRESS)
echo "Final MM balance: $MM_FINAL_BALANCE"
echo "Final Destination balance: $DESTINATION_FINAL_BALANCE"
8 changes: 4 additions & 4 deletions contracts/cairo/.env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Starkli
STARKNET_ACCOUNT=<starkli_account_path>
STARKNET_KEYSTORE=<starkli_keystore_path>
SN_RPC_URL=<starknet_rpc_url>
STARKNET_RPC=<starknet_rpc_url>

## Required for Escrow Contract
SN_ESCROW_OWNER=<starknet_escrow_owner> #in lowercase hexa with the 0x prefix
MM_SN_WALLET_ADDR=<MarketMaker_starknet_contract_address> #in lowercase hexa with the 0x prefix
STARKNET_ESCROW_OWNER=<starknet_escrow_owner> #in lowercase hexa with the 0x prefix
MM_STARKNET_WALLET_ADDRESS=<MarketMaker_starknet_address> #in lowercase hexa with the 0x prefix
CLAIM_PAYMENT_NAME=<claim_payment_function_name> #must match the exact name of the function to claim the payment from the starknet smart contract
MM_ETHEREUM_WALLET=<MarketMaker_ethereum_contract_address> #in lowercase hexa with the 0x prefix
MM_ETHEREUM_WALLET_ADDRESS=<MarketMaker_ethereum_contract_address> #in lowercase hexa with the 0x prefix
NATIVE_TOKEN_ETH_STARKNET=<eth_erc20_in_starknet> #in lowercase hexa with the 0x prefix
8 changes: 4 additions & 4 deletions contracts/cairo/.env.test
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
STARKNET_ACCOUNT=/home/runner/.config/.starkli/account_katana.json
STARKNET_ACCOUNT_ADDRESS=0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973
STARKNET_PRIVATE_KEY=0x1800000000300000180000000000030000000000003006001800006600
SN_RPC_URL=http://0.0.0.0:5050
SN_ESCROW_OWNER=0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973
MM_SN_WALLET_ADDR=0x5686a647a9cdd63ade617e0baf3b364856b813b508f03903eb58a7e622d5855
STARKNET_RPC=http://0.0.0.0:5050
STARKNET_ESCROW_OWNER=0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973
MM_STARKNET_WALLET_ADDRESS=0x5686a647a9cdd63ade617e0baf3b364856b813b508f03903eb58a7e622d5855
CLAIM_PAYMENT_NAME=claim_payment
MM_ETHEREUM_WALLET=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
MM_ETHEREUM_WALLET_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
NATIVE_TOKEN_ETH_STARKNET=0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7
26 changes: 14 additions & 12 deletions contracts/cairo/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
. contracts/utils/colors.sh #for ANSI colors

export STARKNET_RPC=$STARKNET_RPC

if [ -z "$STARKNET_ACCOUNT" ]; then
echo "\n${RED}ERROR:${COLOR_RESET}"
echo "STARKNET_ACCOUNT Variable is empty. Aborting execution.\n"
Expand All @@ -11,9 +13,9 @@ if [ -z "$STARKNET_KEYSTORE" ] && [ -z "$STARKNET_PRIVATE_KEY" ]; then
echo "STARKNET_KEYSTORE and STARKNET_PRIVATE_KEY Variables are empty. Aborting execution.\n"
exit 1
fi
if [ -z "$MM_SN_WALLET_ADDR" ]; then
if [ -z "$MM_STARKNET_WALLET_ADDRESS" ]; then
echo "\n${RED}ERROR:${COLOR_RESET}"
echo "MM_SN_WALLET_ADDR Variable is empty. Aborting execution.\n"
echo "MM_STARKNET_WALLET_ADDRESS Variable is empty. Aborting execution.\n"
exit 1
fi
if [ -z "$NATIVE_TOKEN_ETH_STARKNET" ]; then
Expand All @@ -26,9 +28,9 @@ if [ -z "$PAYMENT_REGISTRY_PROXY_ADDRESS" ]; then
echo "PAYMENT_REGISTRY_PROXY_ADDRESS Variable is empty. Aborting execution.\n"
exit 1
fi
if [ -z "$MM_ETHEREUM_WALLET" ]; then
if [ -z "$MM_ETHEREUM_WALLET_ADDRESS" ]; then
echo "\n${RED}ERROR:${COLOR_RESET}"
echo "MM_SN_MM_ETHEREUM_WALLETWALLET_ADDR Variable is empty. Aborting execution.\n"
echo "MM_ETHEREUM_WALLET_ADDRESS Variable is empty. Aborting execution.\n"
exit 1
fi

Expand All @@ -47,31 +49,31 @@ if [ -z "$ESCROW_CLASS_HASH" ]; then
exit 1
fi

if [ -z "$SN_ESCROW_OWNER" ]; then
if [ -z "$STARKNET_ESCROW_OWNER" ]; then
echo "" #\n
printf "${ORANGE}WARNING:${COLOR_RESET} no SN_ESCROW_OWNER defined in .env, declaring deployer as the owner of the contract\n"
SN_ESCROW_OWNER=$(cat "$STARKNET_ACCOUNT" | grep '"address"' | sed -E 's/.*"address": "([^"]+)".*/\1/')
printf "${ORANGE}WARNING:${COLOR_RESET} no STARKNET_ESCROW_OWNER defined in .env, declaring deployer as the owner of the contract\n"
STARKNET_ESCROW_OWNER=$(cat "$STARKNET_ACCOUNT" | grep '"address"' | sed -E 's/.*"address": "([^"]+)".*/\1/')
fi


printf "${GREEN}\n=> [SN] Escrow Declared${COLOR_RESET}\n"

printf "${CYAN}[SN] Escrow ClassHash: $ESCROW_CLASS_HASH${COLOR_RESET}\n"
printf "${CYAN}[SN] Market Maker SN Wallet: $MM_SN_WALLET_ADDR${COLOR_RESET}\n"
printf "${CYAN}[SN] Market Maker SN Wallet: $MM_STARKNET_WALLET_ADDRESS${COLOR_RESET}\n"
printf "${CYAN}[SN] Ethereum ERC20 ContractAddress $NATIVE_TOKEN_ETH_STARKNET${COLOR_RESET}\n"
printf "${PINK}[ETH] PaymentRegistry Proxy Address: $PAYMENT_REGISTRY_PROXY_ADDRESS${COLOR_RESET}\n"
printf "${PINK}[ETH] Market Maker ETH Wallet: $MM_ETHEREUM_WALLET${COLOR_RESET}\n"
printf "${PINK}[ETH] Market Maker ETH Wallet: $MM_ETHEREUM_WALLET_ADDRESS${COLOR_RESET}\n"

printf "${GREEN}\n=> [SN] Deploying Escrow${COLOR_RESET}\n"
ESCROW_CONTRACT_ADDRESS=$(starkli deploy \
--account $STARKNET_ACCOUNT \
$(if [ -n "$STARKNET_KEYSTORE" ]; then echo "--keystore $STARKNET_KEYSTORE"; fi) \
$(if [ -n "$STARKNET_PRIVATE_KEY" ]; then echo "--private-key $STARKNET_PRIVATE_KEY"; fi) \
--watch $ESCROW_CLASS_HASH \
$SN_ESCROW_OWNER \
$STARKNET_ESCROW_OWNER \
$PAYMENT_REGISTRY_PROXY_ADDRESS \
$MM_ETHEREUM_WALLET \
$MM_SN_WALLET_ADDR \
$MM_ETHEREUM_WALLET_ADDRESS \
$MM_STARKNET_WALLET_ADDRESS \
$NATIVE_TOKEN_ETH_STARKNET)
echo $ESCROW_CONTRACT_ADDRESS

Expand Down
8 changes: 4 additions & 4 deletions contracts/solidity/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#To interact with ETH
ETH_RPC_URL=<ethereum_rpc_url> #as given by your rpc
ETHEREUM_RPC=<ethereum_rpc_url> #as given by your rpc
ETHERSCAN_API_KEY=<etherscan_api_key> #as given by etherscan

ETH_PRIVATE_KEY=<eth_private_key> #in hexa with the 0x prefix
SN_MESSAGING_ADDRESS=<0xde29d060D45901Fb19ED6C6e959EB22d8626708e|0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057|0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4> # Goerli | Sepolia | Mainnet
MM_ETHEREUM_WALLET=<MarketMaker_ethereum_contract_address> #in hexa with the 0x prefix
ETHEREUM_PRIVATE_KEY=<ethereum_private_key> #in hexa with the 0x prefix
STARKNET_MESSAGING_ADDRESS=<0xde29d060D45901Fb19ED6C6e959EB22d8626708e|0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057|0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4> # Goerli | Sepolia | Mainnet
MM_ETHEREUM_WALLET_ADDRESS=<MarketMaker_ethereum_contract_address> #in hexa with the 0x prefix
6 changes: 3 additions & 3 deletions contracts/solidity/.env.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ETH_RPC_URL=http://127.0.0.1:8545
ETHEREUM_RPC=http://127.0.0.1:8545
ETHERSCAN_API_KEY=0x1
ETH_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
SN_MESSAGING_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
ETHEREUM_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
STARKNET_MESSAGING_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
MM_ETHEREUM_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
SKIP_VERIFY=true
2 changes: 1 addition & 1 deletion contracts/solidity/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cd contracts/solidity

printf "${GREEN}\n=> [ETH] Deploying ERC1967Proxy & PaymentRegistry ${COLOR_RESET}\n"

RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETH_RPC_URL --broadcast ${SKIP_VERIFY:---verify})
RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify})
# echo "$RESULT_LOG" #uncomment this line for debugging in detail

# Getting result addresses
Expand Down
6 changes: 3 additions & 3 deletions contracts/solidity/script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.s

contract Deploy is Script {
function run() external returns (address, address) {
uint256 deployerPrivateKey = vm.envUint("ETH_PRIVATE_KEY");
uint256 deployerPrivateKey = vm.envUint("ETHEREUM_PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

address snMessagingAddress = vm.envAddress("SN_MESSAGING_ADDRESS");
address snMessagingAddress = vm.envAddress("STARKNET_MESSAGING_ADDRESS");
uint256 snEscrowAddress = 0x0; // this value is set in a call to the smart contract, once deployed
uint256 snClaimPaymentSelector = 0x0; // this value is set in a call to the smart contract, once deployed
address marketMaker = vm.envAddress("MM_ETHEREUM_WALLET");
address marketMaker = vm.envAddress("MM_ETHEREUM_WALLET_ADDRESS");

PaymentRegistry yab = new PaymentRegistry();
ERC1967Proxy proxy = new ERC1967Proxy(address(yab), "");
Expand Down
4 changes: 2 additions & 2 deletions contracts/solidity/script/Upgrade.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeab
contract Upgrade is Script {
function run() external returns (address, address) {
address PaymentRegistryProxyAddress = vm.envAddress("PAYMENT_REGISTRY_PROXY_ADDRESS");
uint256 deployerPrivateKey = vm.envUint("ETH_PRIVATE_KEY");
uint256 deployerPrivateKey = vm.envUint("ETHEREUM_PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

// Deploy new PaymentRegistry contract to upgrade proxy
Expand All @@ -23,7 +23,7 @@ contract Upgrade is Script {
address proxyAddress,
address newImplementationAddress
) public returns (address, address) {
uint256 deployerPrivateKey = vm.envUint("ETH_PRIVATE_KEY");
uint256 deployerPrivateKey = vm.envUint("ETHEREUM_PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

PaymentRegistry proxy = PaymentRegistry(payable(proxyAddress));
Expand Down
2 changes: 1 addition & 1 deletion contracts/solidity/set_claim_payment_selector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ echo "Smart contract being modified:" $PAYMENT_REGISTRY_PROXY_ADDRESS
CLAIM_PAYMENT_SELECTOR=$(starkli selector $CLAIM_PAYMENT_NAME)
echo "New ClaimPayment Selector: ${CLAIM_PAYMENT_SELECTOR}"

cast send --rpc-url $ETH_RPC_URL --private-key $ETH_PRIVATE_KEY $PAYMENT_REGISTRY_PROXY_ADDRESS "setEscrowClaimPaymentSelector(uint256)" "${CLAIM_PAYMENT_SELECTOR}" | grep "transactionHash"
cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY $PAYMENT_REGISTRY_PROXY_ADDRESS "setEscrowClaimPaymentSelector(uint256)" "${CLAIM_PAYMENT_SELECTOR}" | grep "transactionHash"
echo "Done setting ClaimPayment selector"
2 changes: 1 addition & 1 deletion contracts/solidity/set_escrow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ printf "${GREEN}\n=> [ETH] Setting Starknet Escrow Address on ETH Smart Contract
echo "Smart contract being modified:" $PAYMENT_REGISTRY_PROXY_ADDRESS
echo "New Escrow address:" $ESCROW_CONTRACT_ADDRESS

cast send --rpc-url $ETH_RPC_URL --private-key $ETH_PRIVATE_KEY $PAYMENT_REGISTRY_PROXY_ADDRESS "setEscrowAddress(uint256)" $ESCROW_CONTRACT_ADDRESS | grep "transactionHash"
cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY $PAYMENT_REGISTRY_PROXY_ADDRESS "setEscrowAddress(uint256)" $ESCROW_CONTRACT_ADDRESS | grep "transactionHash"
echo "Done setting escrow address"
4 changes: 2 additions & 2 deletions contracts/solidity/test/MM_ACL.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract TransferTest is Test {
ERC1967Proxy public proxy;
PaymentRegistry public yab_caller;

address SN_MESSAGING_ADDRESS = 0xde29d060D45901Fb19ED6C6e959EB22d8626708e;
address STARKNET_MESSAGING_ADDRESS = 0xde29d060D45901Fb19ED6C6e959EB22d8626708e;
uint256 SN_ESCROW_CLAIM_PAYMENT_SELECTOR = 0x15511cc3694f64379908437d6d64458dc76d02482052bfb8a5b33a72c054c77;

function setUp() public {
Expand All @@ -23,7 +23,7 @@ contract TransferTest is Test {
yab = new PaymentRegistry();
proxy = new ERC1967Proxy(address(yab), "");
yab_caller = PaymentRegistry(address(proxy));
yab_caller.initialize(SN_MESSAGING_ADDRESS, snEscrowAddress, SN_ESCROW_CLAIM_PAYMENT_SELECTOR, marketMaker);
yab_caller.initialize(STARKNET_MESSAGING_ADDRESS, snEscrowAddress, SN_ESCROW_CLAIM_PAYMENT_SELECTOR, marketMaker);

vm.stopPrank();
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/solidity/test/Transfer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract TransferTest is Test {
ERC1967Proxy public proxy;
PaymentRegistry public yab_caller;

address SN_MESSAGING_ADDRESS = 0xde29d060D45901Fb19ED6C6e959EB22d8626708e;
address STARKNET_MESSAGING_ADDRESS = 0xde29d060D45901Fb19ED6C6e959EB22d8626708e;
uint256 SN_ESCROW_CLAIM_PAYMENT_SELECTOR = 0x15511cc3694f64379908437d6d64458dc76d02482052bfb8a5b33a72c054c77;

function setUp() public {
Expand All @@ -23,12 +23,12 @@ contract TransferTest is Test {
yab = new PaymentRegistry();
proxy = new ERC1967Proxy(address(yab), "");
yab_caller = PaymentRegistry(address(proxy));
yab_caller.initialize(SN_MESSAGING_ADDRESS, snEscrowAddress, SN_ESCROW_CLAIM_PAYMENT_SELECTOR, marketMaker);
yab_caller.initialize(STARKNET_MESSAGING_ADDRESS, snEscrowAddress, SN_ESCROW_CLAIM_PAYMENT_SELECTOR, marketMaker);

// Mock calls to Starknet Messaging contract
vm.mockCall(
SN_MESSAGING_ADDRESS,
abi.encodeWithSelector(IStarknetMessaging(SN_MESSAGING_ADDRESS).sendMessageToL2.selector),
STARKNET_MESSAGING_ADDRESS,
abi.encodeWithSelector(IStarknetMessaging(STARKNET_MESSAGING_ADDRESS).sendMessageToL2.selector),
abi.encode(0x0, 0x1)
);
vm.stopPrank();
Expand Down
6 changes: 3 additions & 3 deletions contracts/solidity/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ if [ -z "$PAYMENT_REGISTRY_PROXY_ADDRESS" ]; then
echo "PAYMENT_REGISTRY_PROXY_ADDRESS Variable is empty. Aborting execution.\n"
exit 1
fi
if [ -z "$ETH_PRIVATE_KEY" ]; then
if [ -z "$ETHEREUM_PRIVATE_KEY" ]; then
printf "\n${RED}ERROR:${COLOR_RESET}\n"
echo "ETH_PRIVATE_KEY Variable is empty. Aborting execution.\n"
echo "ETHEREUM_PRIVATE_KEY Variable is empty. Aborting execution.\n"
exit 1
fi

printf "${GREEN}\n=> [ETH] Upgrading PaymentRegistry ${COLOR_RESET}\n"

RESULT_LOG=$(forge script ./script/Upgrade.s.sol --rpc-url $ETH_RPC_URL --broadcast --verify)
RESULT_LOG=$(forge script ./script/Upgrade.s.sol --rpc-url $ETHEREUM_RPC --broadcast --verify)
# echo "$RESULT_LOG" #uncomment this line for debugging in detail

# Getting result addresses
Expand Down
Loading

0 comments on commit 79f99d9

Please sign in to comment.