Skip to content

Smart contracts powering trustless swaps between bitcoin and ethereum

Notifications You must be signed in to change notification settings

riftresearch/contracts

Repository files navigation

Rift Exchange Contracts

DEPRECATED, all protocol code now located here

Current Exchange Deployment

Dependencies

Deployments

Arbitrum Mainnet

Deploy Rift Exchange

source .env && forge clean && forge build --via-ir && \
forge script --chain arbitrum scripts/DeployRiftExchange.s.sol:DeployRiftExchange \
--rpc-url $ARBITRUM_RPC_URL --broadcast --sender $SENDER --private-key $SENDER_PRIVATE_KEY \
--verify --etherscan-api-key $ARBITRUM_ETHERSCAN_API_KEY --ffi -vvvv --via-ir

Upgrade Rift Exchange

source .env && forge clean && forge build --via-ir && \
forge script --chain arbitrum scripts/UpgradeRiftExchange.s.sol:UpgradeRiftExchange \
--rpc-url $ARBITRUM_RPC_URL --broadcast --sender $SENDER --private-key $SENDER_PRIVATE_KEY \
--verify --etherscan-api-key $ARBITRUM_ETHERSCAN_API_KEY --ffi -vvvv --via-ir

Arbitrum Sepolia

Deploy Rift Exchange

npm i @openzeppelin/[email protected] -g
source .env && forge clean && forge build --via-ir && \
forge script --chain arbitrum-sepolia scripts/DeployRiftExchange.s.sol:DeployRiftExchange \
--rpc-url $ARBITRUM_SEPOLIA_RPC_URL --broadcast --sender $SENDER --private-key $SENDER_PRIVATE_KEY \
--verify --etherscan-api-key $ARBITRUM_ETHERSCAN_API_KEY --ffi -vvvv --via-ir

Testing

Unit Tests

forge test

Static Analysis

Slither

  1. Install slither
  2. Run:
    python -m slither .

Mythril

  1. Install mythril
  2. Run:
    myth analyze src/RiftExchange.sol --solc-json mythril.config.json

Invariants

  • Invariant 1: Unreserved balance should never exceed initial balance
map(reservation.initialBalance >= reservation.unreservedBalance)

Invariant 2: The sum of differences between initial balance and unreserved balance across all deposit vaults should equal the sum of all non-completed reserved amounts (Time expired + Created reservation states)

sum(depositVault.initialBalance - depositVault.unreservedBalance for all depositVaults) ==
    sum(nonCompletedReservations.amountsToReserve for all nonCompletedReservations)

About

Smart contracts powering trustless swaps between bitcoin and ethereum

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages