Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orlance - Smart Contracts

Solidity Foundry Network License

Yield-splitting protocol with fixed-income pools, an auto-roll vault, and a no-loss yield lottery.

Key Features

  • Multi-maturity pool deployment in one run (1M / 2M / 3M by default)
  • Principal/Yield token split (TPS / TYS) via OrlanceVault
  • Router zap flow (ETH -> stETH -> Vault) for better UX
  • Dedicated AMM per maturity (TPS/stETH)
  • Optional seeded TVL + AMM liquidity for non-empty demo state
  • Auto-roll strategy vault (OrlanceAutoRoller, OAS share token)
  • No-loss yield lottery (OrlanceNoLossLottery) with round-based winner draw

Quick Start

Prerequisites

  • Foundry installed
  • Arbitrum Sepolia RPC URL
  • Deployer private key funded with testnet ETH

Installation

# From workspace root
cd orlance-sc

# Install dependencies (if needed)
forge install

# Build
forge build

Testing

# Run all tests
forge test

# Run with gas report
forge test --gas-report

# Verbose mode
forge test -vvv

Project Structure

orlance-sc/
|- src/
|  |- core/
|  |  |- OrlanceVault.sol
|  |  |- OrlanceRouter.sol
|  |  |- OrlanceAutoRoller.sol
|  |  |- OrlanceNoLossLottery.sol
|  |  |- PrincipalToken.sol
|  |  `- YieldToken.sol
|  |- mocks/
|  |  |- MockLido.sol
|  |  `- SimpleAMM.sol
|  |- interfaces/
|  `- libraries/
|- script/
|  `- FullDeploy.s.sol
|- test/
|  |- Orlance.t.sol
|  `- OrlanceLottery.t.sol
|- .env.example
`- foundry.toml

Smart Contracts Overview

Core Protocol

Contract Description Main Responsibility
OrlanceVault Custody hub Mint/burn TPS/TYS, handle deposits, redemption, and yield claims
PrincipalToken Principal token Represents principal claim at maturity
YieldToken Yield token Represents claim on accrued yield

UX and Liquidity

Contract Description Main Responsibility
OrlanceRouter Zap helper One-tx ETH to stETH to Vault deposit
SimpleAMM Pool AMM TPS/stETH swaps + LP liquidity
MockLido Mock stETH Faucet + simulated yield for testing/demo

Strategy and Extensions

Contract Description Main Responsibility
OrlanceAutoRoller Auto-roll vault Manages roll-over across maturities, mints OAS shares
OrlanceNoLossLottery Yield lottery Round-based deposits and winner payout from accrued yield

Deployment

Environment Setup

Create your local .env:

cp .env.example .env

PowerShell:

Copy-Item .env.example .env

Minimum required:

  • ARB_SEPOLIA_RPC_URL
  • PRIVATE_KEY

Full Deploy (All Components)

One-liner (PowerShell):

cd "orlance-sc"; forge script script/FullDeploy.s.sol:FullDeployScript --rpc-url $env:ARB_SEPOLIA_RPC_URL --broadcast

FullDeploy will:

  1. Deploy MockLido, OrlanceVault, OrlanceRouter
  2. Create 3 maturity pools
  3. Deploy AMMs per pool (if enabled)
  4. Seed pool TVL + AMM liquidity (if enabled)
  5. Deploy auto-roller (if enabled)
  6. Deploy lottery (if enabled)
  7. Print addresses, maturities, and seeded amounts to logs

Seed Strategy

If SEED_POOLS=true and seed values are not set, defaults are:

  • Pool TVL seed: 12 / 8 / 5 stETH (pool 1/2/3)
  • AMM seed: 3 / 2 / 1 stETH (pool 1/2/3)

Override with:

  • SEED_POOL_1_TVL_STETH, SEED_POOL_2_TVL_STETH, SEED_POOL_3_TVL_STETH
  • SEED_POOL_1_AMM_STETH, SEED_POOL_2_AMM_STETH, SEED_POOL_3_AMM_STETH

Important Environment Variables

Pool generation:

  • POOL_NAME_PREFIX
  • BASE_MATURITY_OFFSET_DAYS
  • MATURITY_STEP_DAYS
  • POOL_NAME_1..3
  • MATURITY_TIMESTAMP_1..3

Feature flags:

  • DEPLOY_AMM
  • SEED_POOLS
  • DEPLOY_AUTO_ROLLER
  • DEPLOY_LOTTERY

Lottery:

  • LOTTERY_INITIAL_MATURITY
  • LOTTERY_ROUND_DURATION_SECONDS

Optional verification:

  • ETHERSCAN_API_KEY

Operational Commands (On-chain)

Draw lottery winner (owner only):

cd "orlance-sc"; $seed = cast keccak "draw-$(Get-Date -Format o)"; cast send <LOTTERY_ADDRESS> "drawWinner(bytes32)" $seed --rpc-url $env:ARB_SEPOLIA_RPC_URL --private-key $env:PRIVATE_KEY

Trigger auto-roller roll-over:

cd "orlance-sc"; cast send <AUTO_ROLLER_ADDRESS> "rollOver(uint256)" <NEW_MATURITY_TIMESTAMP> --rpc-url $env:ARB_SEPOLIA_RPC_URL --private-key $env:PRIVATE_KEY

Next Steps After Deploy

  1. Copy deployment logs (addresses + maturities).
  2. Update FE env files:
  • orlance-fe/.env
  • orlance-fe/.env.example
  1. Restart FE server.
  2. Validate:
  • pools and TVL per maturity
  • auto-roller next roll-over
  • lottery current round and winner history

Useful Links

License

MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages