Zksync
Last updated
Last updated
is a Smart Contract written in Solidity that resides in Ethereum's L2 , and is our implementation of our bridge's entity for this L2.
/contracts
: Contains source files, solidity smart contracts.
/deploy
: Scripts for contract deployment and interaction.
/test
: Test files.
/artifacts-zk
: Autogenerated with required libraries.
hardhat.config.ts
: Configuration settings.
make deps
: Installs dependencies
make zksync-build
: Compiles contracts.
make zksync-deploy
: Deploys using script /deploy/deploy.ts
.
make zksync-connect
: Connects itself to saved PaymentRegistry address.
make zksync-deploy-and-connect
: Deploys and connects itself to saved PaymentRegistry address.
make ethereum-and-zksync-deploy
: Deploys both smart contracts and connects them to each other.
To run local tests you should first start a local dockerized node. For this you can:
Then, to run the contract's tests:
hardhat.config.ts
comes with a list of networks to deploy and test contracts. Add more by adjusting the networks
section in the hardhat.config.ts
. To make a network the default, set the defaultNetwork
to its name.
You can also override the default using the --network
option. For example: hardhat test --network dockerizedNode
.
This contract recieves User's new orders with the function:
Which returns the new order's ID.
When a new order is set, the following SetOrder Event is emitted, detectable by MM's:
The claim_payment
function is called, only by our , in order for the MM to retrieve its payment from the Escrow:
Alternatevly, the claim_payment_batch
function is called, only by our , in order for the MM to retrieve many payments from the Escrow at once: