-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement escrow contract in solidity for zksync (#171)
* feat: move ethereum submodules * refactor: contracts/solidity to contracts/ethereum * refactor: contracts/cairo to contracts/starknet * feat(wip): zksync escrow contract * fet(wip): compile+deploy contract * feat: yarn compile + yarn deploy working for Escrow.sol * feat: zksync make targets for clean, build, deploy * feat: Escrow.sol is ownable, upgradeable, pausable. Bugs with ownable * feat(wip): make escrow.sol UUPS Proxy upgradeable * fix: make deps * remove: upgradeable from escrow.sol, will be implemented in a later commit * feat: set_order(Order) on escrow.sol * feat: add: getters, setters, pause, unpause * feat: untested l2 handler claim_payment * fix: removed unused var from l2 handler * feat(wip): claimPaymentZKSync + refactor variables * feat: chainID on TransferInfo Struct * feat: claimPaymentZKSync advances + deploy_and_connect_zksync make target script * feat: claimPaymentZKSync advances, only missing "byes data" for msg to L2 * feat: msg to L2, UNTESTED * feat: add era-contracts in PaymentRegistry lib * fix: .sol to version compatible with era-contracts * feat(wip): call to L2, having trouble building calldata * refactor: separate claimPaymentZKSync from claimPayment(starknet) * fix: adapted previous test to new yab.init() and yab.transfer() formats * fix: ZKSync messaging (mailbox) variable name * feat: make zksync-deploy + make zksync-deploy-and-connect * feat: zksync init after deploy * fix: sending eth funds to escrow * test(wip): yarn test init (trying to refactor to forge test) * chore: forge init * forge install: forge-std v1.7.6 * remove: zksync using forge, zkforge is not ready for usage * test: yarn hardhat test working * test: run them on local dockerized blockchains (L1 and L2) * refactor: escrow.sol set_order no longer recieves amount, + fix event set order * test: initial setOrder test * test(wip): using L1 for more tests * test(wip): deploying PaymentRegistry in local blockchain for zksync tests * fix: add packageManager in package.json + auto-generated file in .gitignore * test: separated integration test from unit tests * test: ZKSync, Pausable and Ownable unit tests * feat: add zksync-test to make test * fix: appropriate name for sol tests (naame.t.sol) * test: fix old tests to new version of PaymentRegistry * test: refactor test and file names for better understanding and simpler adding new tests * test: started unit tests of PaymentRegistry for ZKSync cases * remove: old generated files from upgradeable ZKSync * test: PaymentRegistry unit tests for ZKSync * test: add mock calls to ZKSync mailbox * test: add PaymentRegistry ACL tests for ZKsync * test: add TransferNotFound for wrong chain and wrong tx id * remove: 'amount' parameter on PaymentRegistry.transfer * feat: add target make zksync-connect * feat: L1 -> L2 message arrives. new bug: from_address != L1 contract * feat: correct selector for L1-L2 * feat(wip): apply mask for L1->L2 * fix: update .gitignore to help branch-switching , temporary until PR#170 is resolved * test: added test for contract variables setter functions * test: add pending order test * test: PaymentRegistry setters ACL * test: set and get for PaymentRegistry setter functions * test: add assert in escrow test to make an extra check transfer has transferred funds * refactor: removed unnecesarry comments * refactor: removed unnecesarry vars from escrow (native_token_eth_in_zksync, mm_ethereum_wallet) * feat: new make targets to deploy: ETH+ZKSYNC or ETH+SN * fix: make deploys for eth and zksync * feat: add display info after deploy-eth-and-zks * docs: added some details to zksync/readme.md * feat: integration test deploys eth in local, using same deploy script as non-tests * fix: tests ZKSync were failing to old escrow.init() signature * fix: changed ZKSyncMailbox to appropriate ZKSyncDiamondProxy * test: removed tests of removed functions * fix: removed wrong todo comments * feat: deploy ZKS Escrow on devnet * feat: do setOrder on integration test * feat: do transfer in integration test * feat(wip): do claimPayment on integration test + refactor .env vars usage for tests * test: detail advances on integration test * perf: gas usage optimization on PaymentRegistry * fix: env.example ZKSYNC_DIAMOND_PROXY_ADDRESS * fix(wip): new diamondProxy address for integration tests. cant execute a function but there is a contract * test: add --gas-report to eth-test + cast call to verify address is a contract in set_order.sh * Fix: env vars from merge conflict * fix: add export ZKSYNC_DIAMOND_PROXY_ADDRESS in CI * fix: change file names in CI * fix: various fixes for CI, made previously but stepped over in merge * fix: env var names in CI * fix: another .env var in CI * fix: data type in transfer in CI * fix: data type in claimPayment CI * refactor: \n at EOF + STARKNET_CHAIN_ID variable name * refactor: style + uncommented existing code * refactor: Update contracts/ethereum/.env.example Co-authored-by: Julian Arce <[email protected]> * feat: add new make target with eth-test-gas-report * fix: rolled back eth/.env.test file * remove: unnecesarry comment * remove: wrong comment * refactor: add \n at EOF * fix: print with colors using printf in SN/deploy.sh * fix: print with printf in SN/deploy.sh * fix: make sn-deploy-and-connect target * refactor: make targets to && \ format, removed .ONESHELL format * fix: wrongly named "ETH_RPC_URL" and "ETH_PRIVATE_KEY" env variables * refactor: TransferInfo setting in transfers[index] rolled back to previous version * refactor: PRIVATE_ADDRESS var changed to PRIVATE_KEY * refactor: rolled back SKIP_VERIFY variable in eth/deploy.sh * fix: ${{vars.ETHEREUM_RPC}} in CI to access env var * refactor: style \n at EOF * remove: worngfully pushed comment * docs: update zksync .env.example * fix: add new line --------- Co-authored-by: Julian Arce <[email protected]>
- Loading branch information
Showing
41 changed files
with
5,393 additions
and
173 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
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,2 +1,3 @@ | ||
.idea | ||
.env | ||
.DS_Store |
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
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
Submodule era-contracts
added at
2dd389
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
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,29 @@ | ||
#!/bin/bash | ||
. contracts/utils/colors.sh #for ANSI colors | ||
|
||
if [ -z "$PAYMENT_REGISTRY_PROXY_ADDRESS" ]; then | ||
printf "\n${RED}ERROR:${COLOR_RESET}\n" | ||
echo "PAYMENT_REGISTRY_PROXY_ADDRESS Variable is empty. Aborting execution.\n" | ||
exit 1 | ||
fi | ||
if [ -z "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" ]; then | ||
printf "\n${RED}ERROR:${COLOR_RESET}\n" | ||
echo "ZKSYNC_ESCROW_CONTRACT_ADDRESS Variable is empty. Aborting execution.\n" | ||
fi | ||
if [ -z "$ETHEREUM_RPC" ]; then | ||
printf "\n${RED}ERROR:${COLOR_RESET}\n" | ||
echo "ETHEREUM_RPC Variable is empty. Aborting execution.\n" | ||
fi | ||
if [ -z "$ETHEREUM_PRIVATE_KEY" ]; then | ||
printf "\n${RED}ERROR:${COLOR_RESET}\n" | ||
echo "ETHEREUM_PRIVATE_KEY Variable is empty. Aborting execution.\n" | ||
fi | ||
|
||
|
||
printf "${GREEN}\n=> [ETH] Setting ZKSync Escrow Address on ETH Smart Contract${COLOR_RESET}\n" | ||
|
||
echo "Smart contract being modified:" $PAYMENT_REGISTRY_PROXY_ADDRESS | ||
echo "New ZKSync Escrow address:" $ZKSYNC_ESCROW_CONTRACT_ADDRESS | ||
|
||
cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY $PAYMENT_REGISTRY_PROXY_ADDRESS "setZKSyncEscrowAddress(address)" $ZKSYNC_ESCROW_CONTRACT_ADDRESS | grep "transactionHash " | ||
echo "Done setting escrow address" |
Oops, something went wrong.