Skip to content

Outlier1217/riquid-defi-yield-strategy

Repository files navigation

Riquid — Autonomous Onchain Yield Agent

Good Vibes Only: OpenClaw Edition | BNB Chain Hackathon

Riquid is a fully autonomous, non-custodial onchain yield agent built on BNB Chain.

It continuously deploys capital, compounds yield, hedges risk, and rebalances positions without governance, admins, bots, or offchain automation.

Once deployed, the system executes purely through deterministic smart contract logic. Humans may trigger it — but cannot control it.

🧠 Why Riquid (Problem)

DeFi users consistently lose value due to:

Impermanent loss during volatility

Manual strategy execution

Emotion-driven decisions

Humans hesitate. Smart contracts execute.

Riquid treats capital allocation as a mathematical system, not a human choice.

🤖 OpenClaw Alignment (Why This Is an Agent)

Riquid behaves as an autonomous financial agent:

Observes onchain state (vault balances)

Executes deterministic actions (deploy, compound, hedge)

Acts permissionlessly via executeCycle()

Evolves capital state over time

No prompts. No governance. No tuning.

Just logic + execution.

🏗️ System Architecture User ↓ Vault (Non-custodial) ↓ StrategyEngine (Autonomous Agent Logic) ↓ AsterDEX Earn (Primary Yield Source) ↓ Reward Distribution ├─ 40% → Stable Hedge Vault └─ 60% → Growth Staking

Design Guarantees

No admin keys

No multisig

No emergency pause

No offchain automation

Anyone can trigger execution

No one can redirect funds

🔑 Core Principles

  1. Integrate (Mandatory)

AsterDEX Earn is the primary yield primitive

All capital must flow through it

  1. Stack (Growth)

Trading fees auto-compound into LP

Rewards are split into hedge + growth

  1. Automate (Speed)

executeCycle() is permissionless

Deterministic execution

No privileged roles

  1. Protect (Trust)

Non-custodial vault

Strategy cannot withdraw arbitrarily

Smart contracts are the sole authority

🧩 Smart Contracts Contract Role Vault.sol Holds user deposits StrategyEngine.sol Autonomous agent logic MockAsterDEX.sol Yield simulation (10%) MockStableVault.sol Hedge buffer MockStaking.sol Growth compounding MockUSDC.sol ERC20 simulation token

⚠️ Mock contracts are for demo only. Interfaces are production-ready and swappable.

⚙️ Autonomous Execution Logic function executeCycle() external { uint256 amount = vault.totalDeposits(); if (amount == 0) return;

vault.transferToStrategy(amount);

usdc.approve(address(aster), amount);
aster.deposit(amount);

aster.simulateYield(address(this));

uint256 reward = usdc.balanceOf(address(this));

uint256 stablePart = (reward * 40) / 100;
uint256 stakePart  = reward - stablePart;

stableVault.deposit(stablePart);
staking.stake(stakePart);

}

Once deployed:

No configuration

No governance

No manual decisions

📊 Live Onchain Demo

The React dashboard reads directly from onchain state and displays:

User deposits

Capital in AsterDEX

Stable hedge allocation

Staking allocation

LP growth

Reward distribution

This proves the agent is executing, not simulated offchain.

📐 Strategy & Math (Deterministic)

Assumptions

Capital: $200

Trading fee: 0.25%

Reward yield: 10% APY

Hedge ratio: 40%

Monthly earnings ≈ $31.67

Fees → auto-compounded

Rewards → hedge + growth

📉 Impermanent Loss Protection

IL formula:

IL% = (2√r / (1 + r)) − 1

BNB −10%

IL ≈ −$0.28

Hedge rewards ≈ $1.67

Net gain > IL

BNB +10%

Full upside preserved

Rewards still compound

Asymmetric protection achieved.

🧪 Local Setup (Reproducible) npm install npx hardhat node npx hardhat run scripts/deploy.js --network localhost npx hardhat run scripts/simulate.js --network localhost npm run dev

🔗 Onchain Proof

Network: opBNB Testnet (BNB Chain)

Strategy Contract:
0xabC3D3EABF0d4608C1E27954D4fE028d063FA526

Vault Contract:
0xEcFA1f481B3903203f825d5E9300d5824E61C23E

Sample Transaction (Autonomous executeCycle):
0xb829a53c5f1e07dc9b984e556f35729945e616c8eaa6428e945bf14b9cc5adfa

https://testnet.opbnbscan.com/address/0xabC3D3EABF0d4608C1E27954D4fE028d063FA526 https://testnet.opbnbscan.com/address/0xEcFA1f481B3903203f825d5E9300d5824E61C23E https://testnet.opbnbscan.com/tx/0xb829a53c5f1e07dc9b984e556f35729945e616c8eaa6428e945bf14b9cc5adfa

Notes:

  • Contracts are deployed on opBNB Testnet
  • MockUSDC is used for deterministic testing
  • executeCycle() is permissionless and can be triggered by anyone
  • No admin keys, no governance, no off-chain automation

🧠 AI Usage Log

AI used for:

Strategy validation

Edge-case simulation

Solidity safety review

Dashboard iteration

Final logic manually verified and constrained onchain

⚠️ Limitations

Mock yield sources

No oracle pricing

No emergency controls (by design)

These trade-offs preserve trust minimization.

🏁 Conclusion

Riquid proves that:

Yield strategies can be autonomous

Impermanent loss can be structurally hedged

Onchain agents can outperform emotional decision-making

This is not a vault. This is a self-driving financial system.

👤 Author

Mustak Aalam Good Vibes Only: OpenClaw Edition BNB Chain Hackathon 2026 License: Apache-2.0

About

Riquid is an autonomous onchain yield agent built on BNB Chain that compounds rewards and hedges impermanent loss to deliver more stable DeFi outcomes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors