Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgradeables Contracts (both SN and ETH) #120

Merged
merged 50 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
98d4977
Upgradeable - YABTransfer (#79)
dubzn Jan 15, 2024
71b964f
Upgradeable - Escrow (#35)
dubzn Jan 15, 2024
7f32c39
Merge branch 'main' into upgradeable-ETH
Jan 15, 2024
1759699
Add openzeppelin-contracts-upgradeable submodule
uri-99 Jan 15, 2024
1e3fb39
Fix automatic proxy address setting
uri-99 Jan 15, 2024
b4ca718
clean upgrade.sh
uri-99 Jan 15, 2024
d18a16a
WIP cleaning readme
Jan 16, 2024
73e8251
Better install libs + deploy explanation
Jan 16, 2024
598c995
improve deploy script + docu
Jan 16, 2024
3aa4564
improve upgrade test
Jan 16, 2024
8418443
Merge remote-tracking branch 'origin/main' into upgradeable-SN
uri-99 Jan 16, 2024
653639c
Merge remote-tracking branch 'origin/main' into upgradeable-ETH
Jan 16, 2024
c876c27
use forge install to get submodules
Jan 16, 2024
47febb6
wip fix of submodules
uri-99 Jan 16, 2024
8a01005
WIP fix submodules
Jan 16, 2024
bf567f6
fix submodules build
Jan 16, 2024
e1fb36b
fix: transfer test includes proxy pattern
rcatalan98 Jan 16, 2024
28d46df
refactor: create contracts without herodotus (#90)
taturosati Jan 16, 2024
bfa7d1e
update deploy's grep
uri-99 Jan 17, 2024
a9b07de
fix sed?
Jan 17, 2024
0098907
clean sed -i
Jan 17, 2024
2c3f77b
fix sed -i bug in mac
Jan 17, 2024
5818c62
remove rpc export
Jan 17, 2024
44d7033
set eth proxy addr in cairo/env
Jan 17, 2024
3540dd8
refactor env var with sus name
Jan 17, 2024
5fd22fd
text clarity
Jan 17, 2024
95d196d
text clarity
Jan 17, 2024
f52c603
Merge branch 'upgradeable-ETH' into upgradeables
Jan 18, 2024
192f163
Merge branch 'upgradeable-SN' into upgradeables
Jan 18, 2024
4f92187
feat: make deploy-all
Jan 18, 2024
8e04ca6
test: upgrade contract while changing vars
Jan 19, 2024
ef1e539
Revert "test: upgrade contract while changing vars"
Jan 22, 2024
bdb3d21
refactor: cairo mock file name
Jan 22, 2024
f42aab7
feat: restrict access to yabtransfer (#98)
uri-99 Jan 24, 2024
a2c1e7e
feat: implement pausable in escrow (#100)
uri-99 Jan 24, 2024
d2bb11e
Merge branch 'upgradeable-ETH' into upgradeables
Jan 24, 2024
cfa1c20
Merge branch 'upgradeable-SN' into upgradeables
Jan 24, 2024
e0a0882
empty commit to fix PR (#94)
uri-99 Jan 24, 2024
196fe47
empty commit to fix PR (#91)
uri-99 Jan 24, 2024
8580533
fix: mock cairo contract names causing compile errors
Jan 29, 2024
4c29cc0
Merge branch 'main' into upgradeables
uri-99 Jan 29, 2024
4bc91c5
fix: eth tests broken from merge
Jan 29, 2024
2e19391
style: eth test variables positions
Jan 29, 2024
ef16899
fix: sn tests broken from merge
Jan 29, 2024
9f69696
refactor: dividied SN tests in different files
Jan 29, 2024
3bf7deb
refactor: deployment scripts to avoid errors (#101)
rcatalan98 Jan 30, 2024
2126b52
test: improve test_upgrade_escrow
Jan 30, 2024
9403a15
remove: escrow_herodotus
Jan 30, 2024
aab7dfe
test: new ownable tests
Jan 30, 2024
b00dc06
docs: mark missing feat as todo for easier find
Jan 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "contracts/solidity/lib/forge-std"]
path = contracts/solidity/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "contracts/solidity/lib/openzeppelin-contracts-upgradeable"]
path = contracts/solidity/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
35 changes: 27 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ ethereum-build: ethereum-clean
ethereum-test: ethereum-clean
@cd ./contracts/solidity/ && forge test

ethereum-deploy: ethereum-clean
@./contracts/solidity/deploy.sh
ethereum-deploy: ethereum-build
@. ./contracts/solidity/.env && . ./contracts/solidity/deploy.sh

ethereum-upgrade: ethereum-build
@. ./contracts/solidity/.env && . ./contracts/solidity/upgrade.sh

ethereum-set-escrow:
@./contracts/solidity/set_escrow.sh
@. ./contracts/solidity/.env && . ./contracts/solidity/set_escrow.sh

ethereum-set-withdraw-selector:
@./contracts/solidity/set_withdraw_selector.sh
@. ./contracts/solidity/.env && . ./contracts/cairo/.env && . ./contracts/solidity/set_withdraw_selector.sh

starknet-clean:
@cd ./contracts/cairo/ && scarb clean
Expand All @@ -40,9 +43,25 @@ starknet-test: starknet-clean
@cd ./contracts/cairo/ && snforge test

starknet-deploy: starknet-build
@./contracts/cairo/deploy.sh
@. ./contracts/cairo/.env && . ./contracts/cairo/deploy.sh

starknet-upgrade: starknet-build
@. ./contracts/cairo/.env && . ./contracts/cairo/upgrade.sh

.ONESHELL:
starknet-deploy-and-connect: starknet-build
@$(MAKE) starknet-deploy
@$(MAKE) ethereum-set-escrow
@$(MAKE) ethereum-set-withdraw-selector
@. ./contracts/solidity/.env && . ./contracts/cairo/.env
@. ./contracts/cairo/deploy.sh
@. ./contracts/solidity/set_escrow.sh
@. ./contracts/solidity/set_withdraw_selector.sh

.ONESHELL:
deploy-all:
@. ./contracts/solidity/.env && . ./contracts/cairo/.env
@make ethereum-build
@. ./contracts/solidity/deploy.sh
@make starknet-build
@. ./contracts/cairo/deploy.sh
@. ./contracts/solidity/set_escrow.sh
@. ./contracts/solidity/set_withdraw_selector.sh
@. ./contracts/display_info.sh
110 changes: 93 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ This will end up installing:
- [Starknet Foundry](https://foundry-rs.github.io/starknet-foundry/) - Is a toolchain for developing Starknet smart contracts.
- [Ethereum Foundry](https://book.getfoundry.sh/) - Is a toolchain for developing Ethereum smart contracts.

### Starknet dependencies

- [OpenZeppelin cairo contracts](https://github.com/OpenZeppelin/cairo-contracts/)

## Setting up a Starknet Testnet Wallet

**This guide will help you declare and deploy contracts on a testnet. Please
Expand Down Expand Up @@ -107,7 +111,7 @@ Follow the steps below to set up a testnet smart wallet using `starkli`:

### Ethereum smart contract

First, the Ethereum smart contracts must be deployed. For Ethereum the deployment process you will need to:
Once we have the dependencies installed, we can proceed. For the Ethereum the deployment process you will need to:

1. Create your `.env` file: you need to configure the following variables in your own .env file on the contracts/solidity/ folder. You can use the env.example file as a template for creating your .env file, paying special attention to the formats provided

Expand All @@ -116,6 +120,7 @@ First, the Ethereum smart contracts must be deployed. For Ethereum the deploymen
ETH_PRIVATE_KEY = private key of your ETH wallet
ETHERSCAN_API_KEY = API Key to use etherscan to read the Ethereum blockchain
SN_MESSAGING_ADDRESS = Starknet Messaging address
YAB_TRANSFER_PROXY_ADDRESS = Address of the Ethereum Proxy smart contract, this value is automatically created and/or updated after deploy.sh is executed
```

**NOTE**:
Expand All @@ -134,6 +139,8 @@ First, the Ethereum smart contracts must be deployed. For Ethereum the deploymen
make ethereum-deploy
```

This will deploy a Proxy smart contract, a YABTransfer smart contract, and it will link them both. The purpose of having a proxy in front of our smart contract is so that it is upgradeable, by simply deploying another smart contract and changing the Proxy's stored address.

### Starknet smart contracts

After the Ethereum smart contract is deployed, the Starknet smart contracts must be declared and deployed.
Expand All @@ -148,31 +155,28 @@ For this, you will need to:

1. Create your `.env` file: you need to configure the following variables in your own .env file on the contracts/solidity folder. You can use the env.example file as a template for creating your .env file, paying special attention to the formats provided

```
STARKNET_ACCOUNT = Absolute path of your starknet testnet account, created at the start of this README
STARKNET_KEYSTORE = Absolute path of your starknet testnet keystore, created at the start of this README
```env
STARKNET_ACCOUNT = Path of your starknet testnet account, created at the start of this README
STARKNET_KEYSTORE = Path of your starknet testnet keystore, created at the start of this README
SN_RPC_URL = Infura or Alchemy RPC URL
ETH_CONTRACT_ADDR = newly created ETH contract address
SN_ESCROW_OWNER = Public address of the owner of the Escrow contract
MM_SN_WALLET_ADDR = Starknet wallet of the MarketMaker
WITHDRAW_NAME = The exact name of the withdraw function that is called from L1, case sensitive. Example: withdraw_fallback
HERODOTUS_FACTS_REGISTRY = Herodotus' Facts Registry Smart Contract in Starknet
WITHDRAW_NAME = Exact name of the withdraw function that is called from L1, case sensitive. Example: withdraw_fallback
MM_ETHEREUM_WALLET = Ethereum wallet of the MarketMaker
NATIVE_TOKEN_ETH_STARKNET = Ethereum's erc20 token handler contract in Starknet
ESCROW_CONTRACT_ADDRESS = Address of the Starknet smart contract, this value should be empty, and is automatically updated after deploy.sh is run
NATIVE_TOKEN_ETH_STARKNET = Ethereum's erc20 token handler contract in Starknet, this value is automatically updated after solidity/deploy.sh is run
YAB_TRANSFER_PROXY_ADDRESS = Address of ETH smart contract Proxy
ESCROW_CONTRACT_ADDRESS = Address of the Starknet smart contract, this value is automatically updated after cairo/deploy.sh is run
```

**Note**
- Herodotus Facts Registry:
- Starknet Goerli: `0x01b2111317EB693c3EE46633edd45A4876db14A3a53ACDBf4E5166976d8e869d`
- Starknet Sepolia: `0x07d3550237ecf2d6ddef9b78e59b38647ee511467fe000ce276f245a006b40bc`
- Starknet Mainnet: `0x014bf62fadb41d8f899bb5afeeb2da486fcfd8431852def56c5f10e45ae72765`
- SN_ESCROW_OWNER is the only one who can perform upgrades of the smart contract. If not defined, this value will be set (in deploy.sh) to the deployer of the smart contract.

2. Declare and Deploy: We sequentially declare and deploy the contracts, and connect it to our Ethereum smart contract.

### First alternative: automatic deploy and connect of Escrow and YABTransfer.
### First alternative: automatic deploy and connect of Escrow and YABTransfer

```bash
make starknet-deploy-and-connect
make starknet-deploy-and-connect
```

This make target consists of 4 steps:
Expand Down Expand Up @@ -200,7 +204,7 @@ This may be better suited for you if you plan to change some of the automaticall

To do this, you can use

```
```bash
make ethereum-set-escrow
```

Expand All @@ -211,12 +215,84 @@ This may be better suited for you if you plan to change some of the automaticall
Ethereum's smart contract has another variable that must be configured, _EscrowWithdrawSelector_, which is for specifying the _withdraw_ function's name in the Starknet Escrow smart contract.
You can set and change Ethereum's _EscrowWithdrawSelector_ variable, doing the following:

```
```bash
make ethereum-set-withdraw-selector
```

This script uses the WITHDRAW_NAME .env variable to automatically generate the selector in the necesary format


### Note on Starknet Smart Contract

_Note: this is a temporary solution, there is WIP on a better solution_

If you want to use the Herodotus version of the smart contract, rename the `escrow_herodotus.cairo` into `escrow.cairo`. Then you must also set the following .env variable before using any deployment script:
```env
HERODOTUS_FACTS_REGISTRY = Herodotus' Facts Registry Smart Contract in Starknet
```

**Note**
- Herodotus Facts Registry:
- Starknet Goerli: `0x01b2111317EB693c3EE46633edd45A4876db14A3a53ACDBf4E5166976d8e869d`
- Starknet Sepolia: `0x07d3550237ecf2d6ddef9b78e59b38647ee511467fe000ce276f245a006b40bc`
- Starknet Mainnet: `0x014bf62fadb41d8f899bb5afeeb2da486fcfd8431852def56c5f10e45ae72765`

## Recap

After following this complete README, we should have an ETH smart contract as well as a Starknet smart contract, both connected to act as a bridge between these two chains.

## Upgrade Contracts in Testnet

### Ethereum

After deploying the `YABTransfer` contract, you can perform upgrades to it. To do this you must:

1. Configure the `contracts/solidity/.env` file.

```
ETH_RPC_URL = Infura or Alchemy RPC URL
ETH_PRIVATE_KEY = private key of your ETH wallet
ETHERSCAN_API_KEY = API Key to use etherscan to read the Ethereum blockchain
SN_MESSAGING_ADDRESS = Starknet Messaging address
YAB_TRANSFER_PROXY_ADDRESS = Address of the Ethereum Proxy smart contract, this value is automatically created and/or updated after deploy.sh is executed
```

2. Use the Makefile command to upgrade `YABTransfer` contract

```bash
make ethereum-upgrade
```

**Note**
- You must be the **owner** of the contract to upgrade it.
- This command will:
- Rebuild `YABTransfer.sol`
- Deploy the new contract to the network
- Utilize Foundry to upgrade the contract by changing the proxy's pointing address to the newly deployed contract


### Starknet

If you want to upgrade a previously deployed `Escrow` contract, it is possible through a command. We will perform the upgrade using the `starkli` tool, so the same configuration used for deployment is necessary.

1. Configure `contracts/cairo/.env` file.

```env
STARKNET_ACCOUNT = Path of your starknet testnet account, created at the start of this README
STARKNET_KEYSTORE = Path of your starknet testnet keystore, created at the start of this README
ESCROW_CONTRACT_ADDRESS = You can either set an escrow address manually, or use the value automatically set by deploying the Escrow, as mentioned previously
```

2. Use the Makefile command to upgrade `Escrow` contract

```bash
make starknet-upgrade
```

**Note**

- You must be the **owner** of the contract to upgrade it.
- This command will:
- **rebuild** `Escrow.cairo`
- **declare** it on Starknet
- Call the external **upgrade()** function with the new class hash
7 changes: 4 additions & 3 deletions contracts/cairo/.env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
## Starkli
STARKNET_ACCOUNT=<starkli_account_path>
STARKNET_KEYSTORE=<starkli_keystore_path>
SN_RPC_URL=<starknet_rpc_url>
ETH_CONTRACT_ADDR=<ethereum_contract_address> #in hexa with the 0x prefix, with upper and lower cases like shown by etherscan

## 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
WITHDRAW_NAME=<withdraw_function_name> #must match the exact name of the function that withdraws from the starknet smart contract
HERODOTUS_FACTS_REGISTRY=<0x01b2111317EB693c3EE46633edd45A4876db14A3a53ACDBf4E5166976d8e869d|0x07d3550237ecf2d6ddef9b78e59b38647ee511467fe000ce276f245a006b40bc|0x014bf62fadb41d8f899bb5afeeb2da486fcfd8431852def56c5f10e45ae72765> # Goerli | Sepolia | Mainnet
MM_ETHEREUM_WALLET=<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
ESCROW_CONTRACT_ADDRESS=<ESCROW_CONTRACT_ADDRESS> #this value is automatically updated after deploy.sh is run
3 changes: 2 additions & 1 deletion contracts/cairo/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target
.snfoundry_cache
.snfoundry_cache
.env
6 changes: 6 additions & 0 deletions contracts/cairo/Scarb.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Code generated by scarb DO NOT EDIT.
version = 1

[[package]]
name = "openzeppelin"
version = "0.8.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.8.0#c23e8e96de60e6e3159b1ff8591a1187269c0eb7"

[[package]]
name = "snforge_std"
version = "0.1.0"
Expand All @@ -10,5 +15,6 @@ source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.12.0#0c3
name = "yab"
version = "0.1.0"
dependencies = [
"openzeppelin",
"snforge_std",
]
1 change: 1 addition & 0 deletions contracts/cairo/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "0.1.0"
[dependencies]
starknet = "2.3.1"
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.12.0" }
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.8.0"}

[[target.starknet-contract]]
sierra = true
Expand Down
89 changes: 68 additions & 21 deletions contracts/cairo/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,88 @@

# ANSI format
GREEN='\e[32m'
PURPLE='\033[1;34m'
CYAN='\033[36m'
PINK='\033[1;35m'
ORANGE='\033[1;33m'
RED='\033[0;31m'
COLOR_RESET='\033[0m'

cd "$(dirname "$0")"

if [ -f .env ]; then
echo "Sourcing cairo/.env file..."
source .env
else
echo "Error: cairo/.env file not found!"
if [ -z "$STARKNET_ACCOUNT" ]; then
echo "\n${RED}ERROR:${COLOR_RESET}"
echo "STARKNET_ACCOUNT Variable is empty. Aborting execution.\n"
exit 1
fi
if [ -z "$STARKNET_KEYSTORE" ]; then
echo "\n${RED}ERROR:${COLOR_RESET}"
echo "STARKNET_KEYSTORE Variable is empty. Aborting execution.\n"
exit 1
fi
if [ -z "$MM_SN_WALLET_ADDR" ]; then
echo "\n${RED}ERROR:${COLOR_RESET}"
echo "MM_SN_WALLET_ADDR Variable is empty. Aborting execution.\n"
exit 1
fi
if [ -z "$NATIVE_TOKEN_ETH_STARKNET" ]; then
echo "\n${RED}ERROR:${COLOR_RESET}"
echo "NATIVE_TOKEN_ETH_STARKNET Variable is empty. Aborting execution.\n"
exit 1
fi
if [ -z "$YAB_TRANSFER_PROXY_ADDRESS" ]; then
echo "\n${RED}ERROR:${COLOR_RESET}"
echo "YAB_TRANSFER_PROXY_ADDRESS Variable is empty. Aborting execution.\n"
exit 1
fi
if [ -z "$MM_ETHEREUM_WALLET" ]; then
echo "\n${RED}ERROR:${COLOR_RESET}"
echo "MM_SN_MM_ETHEREUM_WALLETWALLET_ADDR Variable is empty. Aborting execution.\n"
exit 1
fi

echo -e "${GREEN}\n=> [SN] Declare Escrow${COLOR_RESET}"

echo "${GREEN}\n=> [SN] Declaring Escrow${COLOR_RESET}"
ESCROW_CLASS_HASH=$(starkli declare \
--account $STARKNET_ACCOUNT --keystore $STARKNET_KEYSTORE \
--watch target/dev/yab_Escrow.contract_class.json)
--watch contracts/cairo/target/dev/yab_Escrow.contract_class.json)


if [ -z "$ESCROW_CLASS_HASH" ]; then
printf "\n${RED}ERROR:${COLOR_RESET}\n"
echo "ESCROW_CLASS_HASH Variable is empty. Aborting execution.\n"
exit 1
fi

echo -e "- ${PURPLE}[SN] Escrow ClassHash: $ESCROW_CLASS_HASH${COLOR_RESET}"
echo -e "- ${PURPLE}[SN] Herodotus Facts Registry: $HERODOTUS_FACTS_REGISTRY${COLOR_RESET}"
echo -e "- ${PURPLE}[SN] Market Maker: $MM_SN_WALLET_ADDR${COLOR_RESET}"
echo -e "- ${PURPLE}[SN] Ethereum ContractAddress $NATIVE_TOKEN_ETH_STARKNET${COLOR_RESET}"
echo -e "- ${PINK}[ETH] Ethereum ContractAddress: $ETH_CONTRACT_ADDR${COLOR_RESET}"
echo -e "- ${PINK}[ETH] Market Maker: $MM_ETHEREUM_WALLET${COLOR_RESET}"
if [ -z "$SN_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/')
fi

echo -e "${GREEN}\n=> [SN] Deploy Escrow${COLOR_RESET}"

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] Ethereum ERC20 ContractAddress $NATIVE_TOKEN_ETH_STARKNET${COLOR_RESET}\n"
printf "${PINK}[ETH] YABTransfer Proxy Address: $YAB_TRANSFER_PROXY_ADDRESS${COLOR_RESET}\n"
printf "${PINK}[ETH] Market Maker ETH Wallet: $MM_ETHEREUM_WALLET${COLOR_RESET}\n"

printf "${GREEN}\n=> [SN] Deploying Escrow${COLOR_RESET}\n"
ESCROW_CONTRACT_ADDRESS=$(starkli deploy \
--account $STARKNET_ACCOUNT --keystore $STARKNET_KEYSTORE \
--watch $ESCROW_CLASS_HASH \
$HERODOTUS_FACTS_REGISTRY \
$ETH_CONTRACT_ADDR \
$SN_ESCROW_OWNER \
$YAB_TRANSFER_PROXY_ADDRESS \
$MM_ETHEREUM_WALLET \
$MM_SN_WALLET_ADDR \
$NATIVE_TOKEN_ETH_STARKNET)
echo -e "- ${PURPLE}[SN] Escrow ContractAddress: $ESCROW_CONTRACT_ADDRESS${COLOR_RESET}"
echo $ESCROW_CONTRACT_ADDRESS

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

printf "${CYAN}[SN] Escrow Address: $ESCROW_CONTRACT_ADDRESS${COLOR_RESET}\n"

sed -i "s/^ESCROW_CONTRACT_ADDRESS=.*/ESCROW_CONTRACT_ADDRESS=$ESCROW_CONTRACT_ADDRESS/" ".env" || echo "ESCROW_CONTRACT_ADDRESS=$ESCROW_CONTRACT_ADDRESS" >> ".env"
echo "\nIf you now wish to finish the configuration of this deploy, you will need to run the following commands:"
echo "export YAB_TRANSFER_PROXY_ADDRESS=$YAB_TRANSFER_PROXY_ADDRESS"
echo "export ESCROW_CONTRACT_ADDRESS=$ESCROW_CONTRACT_ADDRESS"
echo "make ethereum-set-escrow"
echo "make ethereum-set-withdraw-selector"
Loading