Skip to content

Diffuse-fi/collateral-abstraction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

collateral abstraction

overview

This repo works in pair with collateral-watchtower and zktls-eth-proving

contracts/PositionManagement.sol is deployed on the source chain, user deposits ERC20 tokens in it. contracts/SyntheticManagement.sol and contracts/SyntheticStablecoin.sol are deployed on the destination chain.

Users use PositionManagement to deposit and withdraw funds. This emits event, collateral-watchtower proves EVM storage and submits to SyntheticManagement.

Tests

forge test

CLI

Command line interface helps you interact with PositionManagement.

  1. Export environment variables (example in .env.example)
source .env

and from lib/sgx_verifier_deployer

source lib/sgx_verifier_deployer/.env
  1. Run two local nodes in different terminal windows:
anvil --port 1111
anvil --port 2222
  1. Send funds to your $PUBLIC_KEY wallet on both local networks:
python3 cli/refresh_anvil.py
  1. Deploy contracts run
python3 cli/deploy.py --src local --dst local_2

this command will deploy PositionManagement and testETH, testBTC, testUSDC, testUSDT contracts on the src chain, SyntheticManagement and SyntheticStablecoin on the destination chain.

  1. Interact with test tokens Check balance
python3 cli/src_coin.py --src local -c testETH -b

Airdrop test tokens

python3 cli/src_coin.py --src local -c testETH -a
  1. Interact with PositionManagement Deposit:
python3 cli/position_management.py --src local -c testETH -d 1

Check deposit:

python3 cli/position_management.py --src local -c testETH -b

Check amount of minted stablecoins:

python3 cli/position_management.py --src local -c testETH -u

Withdraw:

python3 cli/position_management.py --src local -c testETH -w 1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published