Skip to content

JackHamer09/prividium-institutional-demo

Repository files navigation

Intraday Repo

Short-term collateralized lending market built on Prividium - a privacy-preserving blockchain infrastructure.

Lenders create offers specifying loan terms (amount, collateral, duration, fee). Borrowers accept offers by depositing collateral and receiving funds. Loans must be repaid before deadline (plus 2-minute grace period) or lenders can claim collateral.

Quick Start (Local)

Prerequisites:

  • Docker
  • Prividium Docker Images access (provided by the MatterLabs team):
DOCKER_USERNAME=matterlabs_enterprise+your_username
DOCKER_PASSWORD=super_secret_provided_by_matterlabs

docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD quay.io

Setup

# Clone repo with submodules
git clone --recurse-submodules https://github.com/JackHamer09/prividium-institutional-demo

Start

docker compose -f ./prividium-utils/docker-compose-prividium.yaml up -d
  1. Wait for all services to start — init containers (deposit, deploy, mint, bridge) will run automatically in order
  2. Continue by checking section Demo below
  • Note: Chain data is not persisted between restarts. To run again you will firstly need to reset the environment:
docker compose -f ./prividium-utils/docker-compose-prividium.yaml down -v

Demo:

Prerequisites:

  • You will need 2 separate browsers or Chrome browser profiles, to simulate 2 users.
  • MetaMask wallet browser extension installed in both browsers/profiles.

Steps:

  1. Setup MetaMask with demo accounts:
    • Browser/Profile 1 (user1):
      • Open MetaMask -> Account dropdown -> Add Wallet -> Import an account
      • Use private key: 0x6a657d9f98808f0d551411319b851b35e9ef6fca68f38ccc9b92871ec61e1efb
    • Browser/Profile 2 (user2):
      • Open MetaMask -> Account dropdown -> Add Wallet -> Import an account
      • Use private key: 0x93dd39ca8b2666c9bf1cee643f18df4fef6ca96668302978675af1d717459706
  2. Login to Prividium User Panel:
  3. Add Prividium chains to MetaMask:
  4. Login to Intraday Repo App:
    • Open Intraday Repo App in both browsers
    • Login with Prividium (user1 in Browser 1, user2 in Browser 2)
    • Connect the corresponding MetaMask account
  5. Start using the app!
    • Create lending offers, accept them, repay loans, and claim collateral if needed.

Links:


Permissions

  1. Login to Admin Panel with credentials: admin@local.dev / password
  2. Go to Contracts page to view and manage permissions that are setup for each chain.

Useful Scripts

Mint Tokens

Mint test tokens to any address (only works with TestnetERC20Token contracts deployed on local chain):

./scripts/mint.sh <TO_ADDRESS> <TOKEN_ADDRESS> <AMOUNT> <PRIVATE_KEY> <RPC_URL>

Decimal reference:

  • USDC: 6 decimals (1 USDC = 1000000)
  • TUST: 18 decimals (1 TUST = 1000000000000000000)
  • SGD: 18 decimals (1 SGD = 1000000000000000000)

Example (mint 1000 USDC on chain 1):

./scripts/mint.sh 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 1000000000 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 http://localhost:3050

Deposit ETH (L1 to L2)

Deposit ETH from L1 to L2 via the bridge contract. The script automatically fetches the Bridgehub contract address from L2:

./scripts/deposit.sh <CHAIN_ID> <TO_ADDRESS> <AMOUNT_IN_WEI> <PRIVATE_KEY> <L1_RPC> <L2_RPC>

Example (deposit 1000 ETH to chain 1):

./scripts/deposit.sh 6565 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000000000000000000000 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 http://127.0.0.1:8545 http://127.0.0.1:3050

Bridge Token (Cross-chain ERC-20 transfer)

Bridge a token from one chain to another. This approves the Native Token Vault and sends a bridge bundle. The caller must have sufficient token balance on the source chain. Requires the SDK to be built first (cd sdk && npm install && npm run build).

cd scripts && npm install
npm run bridge-token -- <TOKEN_ADDRESS> <AMOUNT> <RECIPIENT> <PRIVATE_KEY> <SOURCE_RPC> <DEST_RPC>

Arguments:

  • TOKEN_ADDRESS: Address of the token to bridge on the source chain
  • AMOUNT: Amount to bridge (in smallest unit, e.g., wei)
  • RECIPIENT: Address to receive tokens on destination chain
  • PRIVATE_KEY: Private key for signing transactions
  • SOURCE_RPC: RPC URL of the source chain (where token is deployed)
  • DEST_RPC: RPC URL of the destination chain

Example (bridge 1000 USDC from chain 1 to chain 2):

npm run bridge-token -- 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 1000000000 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 http://localhost:3050 http://localhost:3051

Note: The interop-relay must be running to execute the bridge bundle on the destination chain.

Troubleshooting

If you experience any of the following issues:

  • Unable to add the MetaMask network
  • Unable to send transactions in the app
  • Seeing "Connection issue" warning in the chain selector

Watch the troubleshooting video for solutions to the most common problems.


Tests

Contract tests only. See contracts/README.md.

License

MIT

About

ZKsync Prividium Institutional Demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors