Skip to content

Commit

Permalink
perf: implement only calculate keccak value in transfer-claim (#183)
Browse files Browse the repository at this point in the history
* 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

* perf: apply keccak performance refactor to transfer and claimPaymentZKSync

* test: apply changes to tests for this performance upgrade

* fix: add diamond_proxy_address to CI for eth/deploy

* fix: CI correct export of diamondProxy var

* fix: CI set_starknet_escrow call

* fix: CI set SN claim_payment_selector

* test: removing onlyOwner to setStarknetEscrowAddress to see if CI fixes

* fix: adding onlyOwner back to setSNEscroAddress. removing it fixed that part of CI but dont know why

* fix: CI transfer.sh

* feat: apply optimization to SN claimPayment

* fix: claimPayment for SN

* fix: (wip) CI transfer

* fix(wip): removed onlyOwnerOrMM restriction to transfer to see if it runs OK on CI

* fix: transfer signature needed uint8 for chainid, not u256

* fix: claimPayment on CI

* fix: SN CI does transfer in CI chain

* test: finished aligning unit tests affected by this perf

* perf(wip): applying change of lowering L1->L2 message size in SN

* test(wip): fixing cairo unit tests to recent perf upgrade

* test(wip): fix test_fail_random_eth_user_calls_l1_handler SN unit test

* test(wip): fixing SN unit tests, now test_fail_call_l1_handler_while_paused

* test: finished SN unit tests fixing

* removed: temporal disabling in gitignore of cairo/x and solidity/x folders

* refactor: set chain_sn variable in transfer call from github workflow

* feat: now using uint8 as 8 booleans in transfers mapping in PaymentRegistry

* test: unit tests of previous feat

* fix: make eth-and-sn-deploy

* refactor: changed "SN_RPC_URL" to appropriate variable name "STARKNET_RPC"

* remove: id->uint8 feature, now back to id->bool

* test(wip): adding L1->L2 max amount unit test

* 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

* remove: optimization about lowering the size of payload in SN L1->L2 claimPayment. it was not correct

* fix(wip): reverting changes made to adapt SN tests to payload size optimization

* fix(wip): reverting changes made to SN tests, done test_Escrow_allowance

* fix(wip): reverting changes made to SN tests, now done test_escrow_pause.cairo

* Squashed commit of the following:

commit 52e1d91
Author: Urix <[email protected]>
Date:   Tue Mar 19 14:43:43 2024 -0300

    fix: data type in claimPayment CI

commit e4c8d02
Author: Urix <[email protected]>
Date:   Tue Mar 19 14:41:02 2024 -0300

    fix: data type in transfer in CI

commit c9a0d78
Author: Urix <[email protected]>
Date:   Tue Mar 19 14:36:30 2024 -0300

    fix: another .env var in CI

commit 2686e5e
Author: Urix <[email protected]>
Date:   Tue Mar 19 14:31:45 2024 -0300

    fix: env var names in CI

commit 218b7be
Author: Urix <[email protected]>
Date:   Tue Mar 19 14:24:27 2024 -0300

    fix: various fixes for CI, made previously but stepped over in merge

commit 09e35e2
Author: Urix <[email protected]>
Date:   Tue Mar 19 14:13:31 2024 -0300

    fix: change file names in CI

commit 4f4e72e
Author: Urix <[email protected]>
Date:   Tue Mar 19 14:09:02 2024 -0300

    fix: add export ZKSYNC_DIAMOND_PROXY_ADDRESS in CI

commit bf922b8
Author: Urix <[email protected]>
Date:   Tue Mar 19 14:04:11 2024 -0300

    Fix: env vars from merge conflict

commit 432ec12
Merge: 9d5f0ea 40dc365
Author: Urix <[email protected]>
Date:   Tue Mar 19 13:57:06 2024 -0300

    Merge branch 'main' into 108-feat-implement-escrow-contract-in-solidity-for-zksync

commit 40dc365
Author: urimihura <[email protected]>
Date:   Mon Mar 18 10:01:48 2024 -0300

    Refactor: rename contracts/x , cairo to starknet and solidity to ethereum (#170)

    * feat: move ethereum submodules

    * refactor: contracts/solidity to contracts/ethereum

    * refactor: contracts/cairo to contracts/starknet

    * docs: remove unused README.md

    ---------

    Co-authored-by: JuArce <[email protected]>

commit a456035
Author: Julian Arce <[email protected]>
Date:   Tue Feb 27 17:35:13 2024 -0300

    chore: divide message fee value by 100 (#177)

commit 79f99d9
Author: Julian Arce <[email protected]>
Date:   Mon Feb 26 14:22:45 2024 -0300

    refactor: standardize env files names (#175)

    * 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

commit b5207b5
Author: Julian Arce <[email protected]>
Date:   Mon Feb 26 13:55:54 2024 -0300

    docs: move all documentation to docs directory (#174)

    * docs(SUMMARY.md): add main sections

    * docs: add starknet wallet setup

    * docs: add mm bot architecture

    * fix(docs): missing item number

    * docs(mm-bot): add introduction
    docs(mm-bots): add architecture
    docs(mm-bots): add deploy guide

    * docs(mm-bot): do not mention cloud provider

    * docs(mm-bot): remove starknet wallet setup

    * docs(mm-bot): add physical view image

    * docs: add SUMMARY sections

    * docs: remove mm bot docs from mm-bot directory

    * docs: rename introduction to README

    * docs: add README and how_it_works to about_yab section

    * fix(SUMMARY.md): missing .md extension

    * docs: add contracts sections

    * docs(how_it_works.md): add risks

    * docs(about_yab/README.md): add index

    * fix(contracts/README.md): use letters instead of numbers

    * chore: check if symlink works in github

    * Revert "chore: check if symlink works in github"

    This reverts commit f4c8fa1.

    * chore: remove contracts README.md

    * chore: add symlink to contracts README.md

    * Revert "chore: add symlink to contracts README.md"

    This reverts commit 1008a02.

    * chore: move README outside about_yab directory

    * chore: remove main README.md

    * docs: set correct links to sections

    * docs: set README as main section

    * docs(README.md): set correct link to image

    * docs: add features section

    * docs: remove unused assets

    * docs(about): format and language check
    docs(about-index): remove deprecated align property and use grid instead

    * docs(about): formatting issues with how it works section and switch grid to flex for image

    * docs(about): switch image to margins from flex

    * docs: rename "how it works" to "how does it work"

    * docs: rename "how it works" to "how does it work"

    * docs: add missing .md extension

    ---------

    Co-authored-by: Gian <[email protected]>

commit 452f634
Author: urimihura <[email protected]>
Date:   Mon Feb 26 11:05:29 2024 -0300

    fix: change order or variable setting, following CEI pattern (#173)

commit f51428f
Author: Julian Arce <[email protected]>
Date:   Fri Feb 23 17:23:08 2024 -0300

    build(production-workflow.yml): do not mention cloud provider (#164)

commit 2e2ba0f
Author: Julian Arce <[email protected]>
Date:   Fri Feb 23 17:22:55 2024 -0300

    chore: and env files to gitignore (#165)

commit 1e15771
Author: Julian Arce <[email protected]>
Date:   Fri Feb 23 17:22:41 2024 -0300

    docs(starknet_wallet_setup.md): add starknet accounts (#166)

* fix: from merge, variable name in CI

* fix: from merge, variable name in CI

* refactor: remove repeated code line

* 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 in EOF

* refactor: style add \n at EOF

* refactor: remove some comments about to-dos, as they were set as Issues in github

* refactor(mm-bot): implement new storage model for transfers and claims. use address instead of uint256 for addresses
chore: update PaymentRegistry.json

* fix: set address type instead of uint256 for destAddress

---------

Co-authored-by: Julian Arce <[email protected]>
  • Loading branch information
uri-99 and JuArce authored Apr 2, 2024
1 parent 068fd33 commit 3a87386
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/katana/katana.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
ACCOUNT_ADDRESS=0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973
ACCOUNT_PRIVATE_KEY=0x1800000000300000180000000000030000000000003006001800006600
ACCOUNT_SRC=/home/runner/.config/.starkli/account_katana.json
RPC_URL=http://0.0.0.0:5050
RPC_URL=http://0.0.0.0:5050
2 changes: 1 addition & 1 deletion .github/workflows/scripts/claim_payment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ echo "Initial MM balance: $MM_INITIAL_BALANCE"

echo "Withdrawing $AMOUNT"
cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY \
$PAYMENT_REGISTRY_PROXY_ADDRESS "claimPayment(uint256, uint256, uint256)" \
$PAYMENT_REGISTRY_PROXY_ADDRESS "claimPayment(uint256, address, uint256)" \
"0" $DESTINATION_ADDRESS "$AMOUNT" \
--value $AMOUNT >> /dev/null

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/transfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ echo "Initial Destination balance: $DESTINATION_INITIAL_BALANCE"

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

Expand Down
70 changes: 29 additions & 41 deletions contracts/ethereum/src/PaymentRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,23 @@ contract PaymentRegistry is Initializable, OwnableUpgradeable, UUPSUpgradeable {

enum Chain { Starknet, ZKSync } //todo add canonic chainID

struct TransferInfo {
uint256 destAddress; //TODO THIS SHOULD BE TYPE ADDRESS, destAddress is always an L1 address
uint256 amount;
bool isUsed;
Chain chainId;
}
event Transfer(uint256 indexed orderId, address srcAddress, address destAddress, uint256 amount, Chain chainId);
event ClaimPayment(uint256 indexed orderId, address destAddress, uint256 amount, Chain chainId);

event Transfer(uint256 indexed orderId, address srcAddress, TransferInfo transferInfo);
event ModifiedZKSyncEscrowAddress(address newEscrowAddress);
event ModifiedStarknetEscrowAddress(uint256 newEscrowAddress);
event ModifiedStarknetClaimPaymentSelector(uint256 newEscrowClaimPaymentSelector);
event ModifiedStarknetClaimPaymentBatchSelector(uint256 newEscrowClaimPaymentSelector);
event ClaimPayment(uint256 orderId, uint256 destAddress, uint256 amount, Chain chainId);
event ClaimPaymentBatch(uint256[] orderIds, uint256[] destAddresses, uint256[] amounts, Chain chainId);
event ClaimPaymentBatch(uint256[] orderIds, address[] destAddresses, uint256[] amounts, Chain chainId);

mapping(bytes32 => TransferInfo) public transfers;
mapping(bytes32 => bool) public transfers;
address public marketMaker;
uint256 public StarknetEscrowAddress;
address public ZKSyncEscrowAddress;
uint256 public StarknetEscrowClaimPaymentSelector;
uint256 public StarknetEscrowClaimPaymentBatchSelector;

IZkSync private _ZKSyncDiamondProxy;
IZkSync private _ZKSyncDiamondProxy;
IStarknetMessaging private _snMessaging;

constructor() {
Expand Down Expand Up @@ -61,36 +55,32 @@ contract PaymentRegistry is Initializable, OwnableUpgradeable, UUPSUpgradeable {
marketMaker = marketMaker_;
}

//TODO: change orderID to uint32
//TODO remove amount parameter, it is unnecesarry, only reading msg,value is enough
function transfer(uint256 orderId, uint256 destAddress, Chain chainId) external payable onlyOwnerOrMM {
require(destAddress != 0, "Invalid destination address.");
//TODO: change orderID to uint32
function transfer(uint256 orderId, address destAddress, Chain chainId) external payable onlyOwnerOrMM {
require(msg.value > 0, "Invalid amount, should be higher than 0.");

bytes32 index = keccak256(abi.encodePacked(orderId, destAddress, msg.value, chainId)); //200 gas
require(transfers[index].isUsed == false, "Transfer already processed."); //3000 gas

transfers[index] = TransferInfo({destAddress: destAddress, amount: msg.value, isUsed: true, chainId: chainId});
bytes32 index = keccak256(abi.encodePacked(orderId, destAddress, msg.value, chainId));

require(transfers[index] == false, "Transfer already processed.");
transfers[index] = true; //now this transfer is in progress

(bool success,) = payable(address(uint160(destAddress))).call{value: msg.value}(""); //34000 gas
// (bool success,) = payable(marketMaker).call{value: msg.value}(""); //32000 gas //to implement this, address must be changed to from uint256 to addr
(bool success,) = payable(destAddress).call{value: msg.value}(""); //34000 gas

require(success, "Transfer failed.");
emit Transfer(orderId, msg.sender, transfers[index]); //3000 gas
emit Transfer(orderId, msg.sender, destAddress, msg.value, chainId); //2400 gas
}

//TODO change name to claimPaymentStarknet
function claimPayment(uint256 orderId, uint256 destAddress, uint256 amount) external payable onlyOwnerOrMM {
function claimPayment(uint256 orderId, address destAddress, uint256 amount) external payable onlyOwnerOrMM {
_verifyTransferExistsStarknet(orderId, destAddress, amount);

uint256[] memory payload = new uint256[](5); //TODO why array of 256 if then filled with 128?
uint256[] memory payload = new uint256[](5); //this is not an array of u128 because sendMessageToL2 takes an array of uint256
payload[0] = uint128(orderId); // low
payload[1] = uint128(orderId >> 128); // high
payload[2] = destAddress;
payload[2] = uint256(uint160(destAddress));
payload[3] = uint128(amount); // low
payload[4] = uint128(amount >> 128); // high


//10k gas:
_snMessaging.sendMessageToL2{value: msg.value}(
StarknetEscrowAddress,
StarknetEscrowClaimPaymentSelector,
Expand All @@ -101,7 +91,7 @@ contract PaymentRegistry is Initializable, OwnableUpgradeable, UUPSUpgradeable {

function claimPaymentBatch(
uint256[] calldata orderIds,
uint256[] calldata destAddresses,
address[] calldata destAddresses,
uint256[] calldata amounts
) external payable onlyOwnerOrMM() {
require(orderIds.length == destAddresses.length, "Invalid lengths.");
Expand All @@ -110,22 +100,22 @@ contract PaymentRegistry is Initializable, OwnableUpgradeable, UUPSUpgradeable {
uint256[] memory payload = new uint256[](5 * orderIds.length + 1);

payload[0] = orderIds.length;

for (uint32 idx = 0; idx < orderIds.length; idx++) {
uint256 orderId = orderIds[idx];
uint256 destAddress = destAddresses[idx];
address destAddress = destAddresses[idx];
uint256 amount = amounts[idx];

_verifyTransferExistsStarknet(orderId, destAddress, amount);

uint32 base_idx = 1 + 5 * idx;
payload[base_idx] = uint128(orderId); // low
payload[base_idx + 1] = uint128(orderId >> 128); // high
payload[base_idx + 2] = destAddress;
payload[base_idx + 2] = uint256(uint160(destAddress));
payload[base_idx + 3] = uint128(amount); // low
payload[base_idx + 4] = uint128(amount >> 128); // high
}

_snMessaging.sendMessageToL2{value: msg.value}(
StarknetEscrowAddress,
StarknetEscrowClaimPaymentBatchSelector,
Expand All @@ -134,28 +124,26 @@ contract PaymentRegistry is Initializable, OwnableUpgradeable, UUPSUpgradeable {
emit ClaimPaymentBatch(orderIds, destAddresses, amounts, Chain.Starknet);
}

function _verifyTransferExistsStarknet(uint256 orderId, uint256 destAddress, uint256 amount) internal view {
function _verifyTransferExistsStarknet(uint256 orderId, address destAddress, uint256 amount) internal view {
bytes32 index = keccak256(abi.encodePacked(orderId, destAddress, amount, Chain.Starknet));
TransferInfo storage transferInfo = transfers[index];
require(transferInfo.isUsed == true, "Transfer not found.");
require(transfers[index] == true, "Transfer not found.");
}

function claimPaymentZKSync(
uint256 orderId, uint256 destAddress, uint256 amount,
uint256 orderId, address destAddress, uint256 amount,
uint256 gasLimit,
uint256 gasPerPubdataByteLimit
) external payable onlyOwnerOrMM {
bytes32 index = keccak256(abi.encodePacked(orderId, destAddress, amount, Chain.ZKSync));
TransferInfo storage transferInfo = transfers[index];
require(transferInfo.isUsed == true, "Transfer not found.");
require(transfers[index] == true, "Transfer not found."); //if this is claimed twice, Escrow will know

//todo change place of this var
bytes4 selector = 0xa5168739; //claim_payment selector in ZKSync //todo add in init, same as in SN
bytes memory messageToL2 = abi.encodeWithSelector(
selector,
orderId,
transferInfo.destAddress,
transferInfo.amount
destAddress,
amount
);

_ZKSyncDiamondProxy.requestL2Transaction{value: msg.value}(
Expand All @@ -168,7 +156,7 @@ contract PaymentRegistry is Initializable, OwnableUpgradeable, UUPSUpgradeable {
msg.sender //refund recipient
);

emit ClaimPayment(orderId, destAddress, amount, Chain.ZKSync);
emit ClaimPayment(orderId, destAddress, amount, Chain.ZKSync); //2100 gas
}

function setStarknetEscrowAddress(uint256 newStarknetEscrowAddress) external onlyOwner {
Expand Down
8 changes: 4 additions & 4 deletions contracts/ethereum/test/ACL.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@ contract TransferTest is Test {
function test_transfer_sn_fail_notOwnerOrMM() public {
hoax(makeAddr("bob"), 100 wei);
vm.expectRevert("Only Owner or MM can call this function");
yab_caller.transfer{value: 100}(1, 0x1, PaymentRegistry.Chain.Starknet);
yab_caller.transfer{value: 100}(1, address(0x1), PaymentRegistry.Chain.Starknet);
}

function test_claimPayment_sn_fail_notOwnerOrMM() public {
hoax(makeAddr("bob"), 100 wei);
vm.expectRevert("Only Owner or MM can call this function");
yab_caller.claimPayment{value: 100}(1, 0x1, 100);
yab_caller.claimPayment{value: 100}(1, address(0x1), 100);
}

function test_transfer_zk_fail_notOwnerOrMM() public {
hoax(makeAddr("bob"), 100 wei);
vm.expectRevert("Only Owner or MM can call this function");
yab_caller.transfer{value: 100}(1, 0x1, PaymentRegistry.Chain.ZKSync);
yab_caller.transfer{value: 100}(1, address(0x1), PaymentRegistry.Chain.ZKSync);
}

function test_claimPayment_zk_fail_notOwnerOrMM() public {
hoax(makeAddr("bob"), 100 wei);
vm.expectRevert("Only Owner or MM can call this function");
yab_caller.claimPaymentZKSync{value: 100}(1, 0x1, 100, 1, 1);
yab_caller.claimPaymentZKSync{value: 100}(1, address(0x1), 100, 1, 1);
}

function test_setStarknetClaimPaymentSelector() public {
Expand Down
Loading

0 comments on commit 3a87386

Please sign in to comment.