DeFi micro-savings app that rounds-up daily purchases into AI-optimized yield
š· Oink Protocol: Redefining Savings for the Decentralized Era
Financial growth and wealth generation should be a universal right, not a privilege reserved only for those with specialized training, complex strategies, or substantial capital. While decentralized finance (DeFi) has unlocked yield rates that consistently outpace traditional bank savings accounts, it remains isolated behind a wall of intimidating interfaces, volatile gas calculations, and constant monitoring. The core vision of the Oink Protocol is to break down this barrier, democratizing financial participation by turning everyday spending into an effortless, passive vehicle for wealth generation.
Oink's philosophy centers on the power of compounding habits. By integrating a round-up mechanism directly into a userās daily transactions using OinkSmartAccount the protocol captures the "spare change" that normally goes unnoticed. A routine purchase of 4.50 USDC automatically rounds up to 5.00 USDC, instantly diverting the remaining 0.50 USDC into the OinkVault. This micro-savings approach ensures that savings grow incrementally and organically without requiring changes to daily behavior or manual transfers.
To eliminate the anxiety of market analysis, Oink delegates yield management to an autonomous AI allocator agent. The agent constantly monitors lending protocols like Aave V4 spoke pools, projecting returns, calculating transaction fees, and executing optimal rebalances on behalf of the collective vault. Users no longer need to study APYs or execute complicated contract interactions; they simply spend as they normally would while their capital is optimized by a background curator.
Ultimately, Oink Protocol is a bridge for the financially uninitiated. It transforms DeFi from a complex technical hurdle into a casual, safe, and convenient micro-savings companion - empowering individuals to grow their financial future, one spare coin at a time.
Oink Protocol is built as a three-tier system comprising a smart account wallet, an ERC-4626 compliant yield vault, and an off-chain AI-powered yield allocator agent. Together, they form an automated, gas-optimized micro-savings and asset allocation pipeline.
When executing a transaction, the contract evaluates the destination address and the transaction payload. If the target is the designated USDC contract and the payload matches the transfer function selector, the contract intercepts the transaction. It reads the decimals of the underlying asset and applies the configured rounding policy. For example, under the NearestInteger policy, the contract calculates the modulo of the transfer amount against a single unit scale (one whole USDC). It computes the round-up remainder (the difference required to reach the next integer dollar value).
The contract then sequences three operations: it dispatches the primary payment to the recipient, approves the calculated round-up remainder to the yield vault, and calls the vault's deposit function, mapping the minted vault shares back to the smart wallet's address.
The contract implements role-based access control, defining an allocator role alongside the contract owner. This allocator role is granted to the public key of the off-chain AI agent, permitting it to call the invest and withdrawFromProtocol functions. These functions handle the transfer of USDC from the vault into external yield-bearing destinations.
To ensure broad protocol compatibility, the investment function attempts a standard ERC-4626 deposit on the destination address, which naturally supports ERC-4626 yield spokes like Aave V4. If that call reverts, it falls back to a low-level call matching the Aave V3 supply signature. The vault maintains a dynamic array of active protocols where capital is deployed. It overrides the standard totalAssets function to calculate the vault's aggregate value, summing the local idle USDC balance and the underlying value of receipt tokens retrieved from whitelisted protocols.
The agent operates on a configurable polling loop. At each interval, it queries the supply APY of whitelisted lending pools on-chain. It aggregates this data alongside current network gas fees, the vault's current allocation state, the target optimization timeline, and a configured net profit threshold.
This state information is formulated into a system prompt and evaluated by Gemini. The AI analyzes whether rebalancing is profitable after subtracting gas overheads. It returns a structured JSON output specifying whether to reallocate, the target pool address, and the amount to invest. Upon receiving a positive rebalance recommendation, the agent signs and broadcasts a transaction to the vault's invest or withdrawFromProtocol functions using the private key associated with the allocator role.

