BLTBYBank

circle-info

📋 Contract Overview

Property
Value

📁 File

src/BLTBYBank.sol

🔧 Type

Upgradeable UUPS Proxy

⚙️ Solidity

0.8.33

📜 License

MIT

circle-info

🎯 Purpose: Primary on-chain marketplace for BLTBY tokens—managing token sales, purchases, and liquidity at fair market prices.


🏪 Core Functions

Function
Description

💰 Token Purchases

Buy BLTBY with stablecoins

💸 Token Sales

Sell BLTBY for stablecoins

📊 Price Discovery

Fair market pricing

🏦 Liquidity Management

Maintain buy/sell liquidity


🔧 Functions

💰 Token Purchases

Buy with Stablecoin Amount

function buyBLTBY(
    address stablecoin,
    uint256 stablecoinAmount
) external nonReentrant returns (uint256 bltbyAmount)

Access: Any address

Flow:

  1. Verify stablecoin is accepted

  2. Check daily limits

  3. Calculate BLTBY amount based on buy price

  4. Transfer stablecoin from buyer

  5. Transfer BLTBY to buyer

  6. Update reserves and tracking

Buy Exact BLTBY Amount

function buyBLTBYExact(
    address stablecoin,
    uint256 bltbyAmount
) external nonReentrant returns (uint256 stablecoinCost)

Buy exact amount of BLTBY (calculates stablecoin needed).


📊 Pricing Model

circle-info

The buy/sell spread provides revenue and protects against arbitrage.

Spread Calculation

Example Pricing

Mid Price
Spread
Buy Price
Sell Price

$0.10

2%

$0.101

$0.099

$0.10

5%

$0.1025

$0.0975


📅 Daily Limits

circle-exclamation
Limit Type
Purpose

📊 Per transaction

Max single trade size

📅 Daily buy limit

Max user can buy per day

📅 Daily sell limit

Max user can sell per day

Limits reset at midnight UTC.


📜 Events & Errors


💰 Treasury Integration

circle-info

A portion of each transaction goes to treasury.

Transaction
Fee

💰 Buy

0.5% of stablecoin spent

💸 Sell

0.5% of stablecoin received


🏦 Liquidity Health

Returns:

  • Ratio of current reserves to target

  • Overall health status

circle-exclamation

🔗 Contract Interactions

Contract
Interaction

Transfers for buys/sells

Receives fees

📊 Price Oracle

Price discovery (optional)

💵 Stablecoins

Payment tokens


🔒 Security Features

Protection
How It Works

📅 Daily limits

Prevent large dumps/pumps

📊 Spread

Buffer against arbitrage

📈 Price bounds

Prevent extreme moves

🔐 Role-based access

Only authorized price changes


chevron-right💻 Integration Exampleshashtag

Buying BLTBY

Selling BLTBY

Checking Limits


BLTBYTokenchevron-rightTreasurychevron-rightBLTBY Tokenchevron-right

Last updated