FeedTheGigaRaven
0x10957d1148dbd36f3ec28e6b3fb15bd64157f27d
Verification
Verified
v0.8.27+commit.40a35a09
Type
Contract
3,132 bytes
ABI entries
14
5 read · 4 write
License
none
Contract information
- Address
- 0x10957d1148dbd36f3ec28e6b3fb15bd64157f27d
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.27+commit.40a35a09
- Optimization
- Enabled
- Creator
- 0x097ba31b7A…424d2dAcdc
- Creation tx
- 0x05dba613c1…bd9fe66bb1
Token
Not a token
This contract does not expose ERC-20 metadata.
Read contract (5)
WETH() → address
owner() → address
pool() → address
token0() → address
token1() → address
Events (3)
OwnershipTransferredPoolSetStabilityForged
ABI
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "pool",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "token0",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "token1",
"type": "address"
}
],
"name": "PoolSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "rounds",
"type": "uint256"
}
],
"name": "StabilityForged",
"type": "event"
},
{
"inputs": [],
"name": "WETH",
"outputs": [
{
"internalType": "contract IWETH",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "feedTheRaven",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pool",
"outputs": [
{
"internalType": "contract IClassicPool",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_pool",
"type": "address"
}
],
"name": "setPool",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "token0",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "token1",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "address",
"name": "to",
"type": "address"
}
],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]Source code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
import {Owned} from "solmate/src/auth/Owned.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IWETH} from "./interfaces/IWETH.sol";
import {IClassicPool} from "./interfaces/IClassicPool.sol";
/// @title FeedTheGigaRaven
/// @notice Owner-only randomized buy/sell churn against an external Giga (Classic AMM) pool on
/// Robinhood Chain. Every feedTheRaven() cycle finishes fully converted into the non-WETH token.
/// @dev Holds no token of its own and locks no liquidity — it just trades whatever WETH / pool-token
/// balance it currently has against a pool the owner points it at via setPool().
contract FeedTheGigaRaven is Owned {
IWETH public constant WETH = IWETH(0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73);
IClassicPool public pool;
address public token0;
address public token1;
/// @dev random trade fraction per leg is MIN_FRACTION_BPS..MIN_FRACTION_BPS+FRACTION_RANGE_BPS of balance
uint256 private constant MIN_FRACTION_BPS = 3_000; // 30%
uint256 private constant FRACTION_RANGE_BPS = 6_000; // up to 90%
event PoolSet(address indexed pool, address token0, address token1);
event StabilityForged(uint256 rounds);
constructor() Owned(msg.sender) {}
receive() external payable {
WETH.deposit{value: msg.value}();
}
/// @notice Point the contract at a Giga Classic pool. Reads token ordering directly from it.
function setPool(address _pool) external onlyOwner {
address t0 = IClassicPool(_pool).token0();
address t1 = IClassicPool(_pool).token1();
require(t0 == address(WETH) || t1 == address(WETH), "pool must pair WETH");
pool = IClassicPool(_pool);
token0 = t0;
token1 = t1;
emit PoolSet(_pool, t0, t1);
}
/// @notice Recover any token balance held by the contract.
function withdraw(address token, uint256 amount, address to) external onlyOwner {
IERC20(token).transfer(to, amount);
}
/// @notice 5 rounds of randomized-size buy-then-sell against the pool, then a final sweep
/// that converts any remaining WETH into the other token, so every cycle finishes fully in RVH.
function feedTheRaven() external onlyOwner {
require(address(pool) != address(0), "pool not set");
address other = token0 == address(WETH) ? token1 : token0;
for (uint256 i; i < 5; i++) {
uint256 wethBal = WETH.balanceOf(address(this));
if (wethBal > 0) _swap(address(WETH), _randomAmount(wethBal, i * 2));
uint256 otherBal = IERC20(other).balanceOf(address(this));
if (otherBal > 0) _swap(other, _randomAmount(otherBal, i * 2 + 1));
}
uint256 wethLeft = WETH.balanceOf(address(this));
if (wethLeft > 0) _swap(address(WETH), wethLeft);
emit StabilityForged(5);
}
/// @dev Not a security-sensitive random source — feedTheRaven() is onlyOwner, so nobody
/// benefits from predicting or biasing it. Only used to vary cosmetic trade sizes.
function _randomAmount(uint256 balance, uint256 salt) private view returns (uint256) {
uint256 seed = uint256(
keccak256(abi.encodePacked(blockhash(block.number - 1), block.timestamp, block.prevrandao, salt, gasleft()))
);
uint256 fractionBps = MIN_FRACTION_BPS + (seed % (FRACTION_RANGE_BPS + 1));
return (balance * fractionBps) / 10_000;
}
function _swap(address tokenIn, uint256 amountIn) private {
uint256 amountOut = pool.getAmountOut(amountIn, tokenIn);
if (amountOut == 0) return;
IERC20(tokenIn).transfer(address(pool), amountIn);
(uint256 amount0Out, uint256 amount1Out) =
tokenIn == token0 ? (uint256(0), amountOut) : (amountOut, uint256(0));
pool.swap(amount0Out, amount1Out, address(this), "");
}
}
Chain explorer2012msChain node87ms