Avenum
0xfaf8db442f55570814e61657aec7799f91bfd7f1
Verification
Verified
v0.8.24+commit.e11b9ed9
Type
Contract
4,968 bytes
ABI entries
45
23 read · 9 write
License
none
Contract information
- Address
- 0xfaf8db442f55570814e61657aec7799f91bfd7f1
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.24+commit.e11b9ed9
- Optimization
- Enabled
- Creator
- 0x9Cd0619803…Becb526e81
- Creation tx
- 0x072ace16ab…18cb064c49
Token
- Name
- Avenum
- Symbol
- AVNM
- Decimals
- 18
- Holders
- 8
- Market
- View token page →
Read contract (23)
BUYBACK_THRESHOLD() → uint256
HARD_CAP() → uint256
LIQUIDITY_ALLOC() → uint256
MINE_COOLDOWN() → uint256
MINING_RESERVE() → uint256
MIN_NFTS() → uint256
PER_NFT_REWARD() → uint256
TREASURY_ALLOC() → uint256
allowance(address, address) → uint256
balanceOf(address) → uint256
decimals() → uint8
lastMined(address) → uint256
mineReadyAt(address) → uint256
minedSoFar() → uint256
name() → string
nft() → address
owner() → address
pendingMine(address) → uint256
router() → address
symbol() → string
totalBurned() → uint256
totalEthBoughtBack() → uint256
totalSupply() → uint256
Events (6)
ApprovalBuybackBurnMinedRouterSetRoyaltiesReceivedTransfer
ABI
[
{
"inputs": [
{
"internalType": "address",
"name": "nftCollection",
"type": "address"
},
{
"internalType": "address",
"name": "treasury",
"type": "address"
},
{
"internalType": "address",
"name": "liquidityHolder",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "BelowThreshold",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "readyAt",
"type": "uint256"
}
],
"name": "CooldownActive",
"type": "error"
},
{
"inputs": [],
"name": "MiningOver",
"type": "error"
},
{
"inputs": [],
"name": "NotEnoughNFTs",
"type": "error"
},
{
"inputs": [],
"name": "RouterNotSet",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "ethIn",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokensBurned",
"type": "uint256"
}
],
"name": "BuybackBurn",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "miner",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "nftCount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Mined",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "router",
"type": "address"
}
],
"name": "RouterSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "RoyaltiesReceived",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [],
"name": "BUYBACK_THRESHOLD",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "HARD_CAP",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "LIQUIDITY_ALLOC",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MINE_COOLDOWN",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MINING_RESERVE",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MIN_NFTS",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "PER_NFT_REWARD",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "TREASURY_ALLOC",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "burn",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "minTokensOut",
"type": "uint256"
}
],
"name": "buybackAndBurn",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "fundBuyback",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "lastMined",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "mine",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "who",
"type": "address"
}
],
"name": "mineReadyAt",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "minedSoFar",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "nft",
"outputs": [
{
"internalType": "contract IERC721Balance",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "who",
"type": "address"
}
],
"name": "pendingMine",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "router",
"outputs": [
{
"internalType": "contract IUniswapV2Router",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "r",
"type": "address"
}
],
"name": "setRouter",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalBurned",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalEthBoughtBack",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]Source code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IERC721Balance {
function balanceOf(address owner) external view returns (uint256);
}
interface IUniswapV2Router {
function WETH() external pure returns (address);
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
}
contract Avenum {
string public constant name = "Avenum";
string public constant symbol = "AVNM";
uint8 public constant decimals = 18;
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
uint256 public constant HARD_CAP = 1_000_000_000 ether;
uint256 public constant MINING_RESERVE = 600_000_000 ether;
uint256 public constant LIQUIDITY_ALLOC = 300_000_000 ether;
uint256 public constant TREASURY_ALLOC = 100_000_000 ether;
uint256 public minedSoFar;
IERC721Balance public immutable nft;
uint256 public constant MIN_NFTS = 1;
uint256 public constant PER_NFT_REWARD = 10 ether;
uint256 public constant MINE_COOLDOWN = 8 hours;
mapping(address => uint256) public lastMined;
event Mined(address indexed miner, uint256 nftCount, uint256 amount);
IUniswapV2Router public router;
uint256 public constant BUYBACK_THRESHOLD = 0.05 ether;
uint256 public totalEthBoughtBack;
uint256 public totalBurned;
event BuybackBurn(uint256 ethIn, uint256 tokensBurned);
event RoyaltiesReceived(uint256 amount);
event RouterSet(address router);
address public owner;
modifier onlyOwner() { require(msg.sender == owner, "not owner"); _; }
error MiningOver();
error NotEnoughNFTs();
error CooldownActive(uint256 readyAt);
error BelowThreshold();
error RouterNotSet();
constructor(address nftCollection, address treasury, address liquidityHolder) {
owner = msg.sender;
nft = IERC721Balance(nftCollection);
_mint(liquidityHolder, LIQUIDITY_ALLOC);
_mint(treasury, TREASURY_ALLOC);
}
function mine() external {
if (minedSoFar >= MINING_RESERVE) revert MiningOver();
uint256 count = nft.balanceOf(msg.sender);
if (count < MIN_NFTS) revert NotEnoughNFTs();
uint256 ready = lastMined[msg.sender] + MINE_COOLDOWN;
if (block.timestamp < ready) revert CooldownActive(ready);
uint256 amount = count * PER_NFT_REWARD;
uint256 remaining = MINING_RESERVE - minedSoFar;
if (amount > remaining) amount = remaining;
lastMined[msg.sender] = block.timestamp;
minedSoFar += amount;
_mint(msg.sender, amount);
emit Mined(msg.sender, count, amount);
}
function pendingMine(address who) external view returns (uint256) {
if (minedSoFar >= MINING_RESERVE) return 0;
uint256 count = nft.balanceOf(who);
if (count < MIN_NFTS) return 0;
if (block.timestamp < lastMined[who] + MINE_COOLDOWN) return 0;
uint256 amount = count * PER_NFT_REWARD;
uint256 remaining = MINING_RESERVE - minedSoFar;
return amount > remaining ? remaining : amount;
}
function mineReadyAt(address who) external view returns (uint256) {
return lastMined[who] + MINE_COOLDOWN;
}
receive() external payable { emit RoyaltiesReceived(msg.value); }
function fundBuyback() external payable { emit RoyaltiesReceived(msg.value); }
function buybackAndBurn(uint256 minTokensOut) external {
if (address(router) == address(0)) revert RouterNotSet();
uint256 ethBal = address(this).balance;
if (ethBal < BUYBACK_THRESHOLD) revert BelowThreshold();
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = address(this);
uint256 beforeBal = balanceOf[address(this)];
router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: ethBal}(
minTokensOut, path, address(this), block.timestamp + 300
);
uint256 bought = balanceOf[address(this)] - beforeBal;
totalEthBoughtBack += ethBal;
if (bought > 0) { _burn(address(this), bought); totalBurned += bought; }
emit BuybackBurn(ethBal, bought);
}
function setRouter(address r) external onlyOwner {
router = IUniswapV2Router(r);
emit RouterSet(r);
}
function renounceOwnership() external onlyOwner { owner = address(0); }
function transfer(address to, uint256 value) external returns (bool) {
_transfer(msg.sender, to, value); return true;
}
function approve(address spender, uint256 value) external returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value); return true;
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
uint256 a = allowance[from][msg.sender];
require(a >= value, "allowance");
if (a != type(uint256).max) allowance[from][msg.sender] = a - value;
_transfer(from, to, value); return true;
}
function burn(uint256 value) external { _burn(msg.sender, value); }
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0), "zero to");
uint256 bal = balanceOf[from];
require(bal >= value, "balance");
unchecked { balanceOf[from] = bal - value; balanceOf[to] += value; }
emit Transfer(from, to, value);
}
function _mint(address to, uint256 value) internal {
require(totalSupply + value <= HARD_CAP, "cap");
totalSupply += value;
unchecked { balanceOf[to] += value; }
emit Transfer(address(0), to, value);
}
function _burn(address from, uint256 value) internal {
uint256 bal = balanceOf[from];
require(bal >= value, "balance");
unchecked { balanceOf[from] = bal - value; totalSupply -= value; }
emit Transfer(from, address(0), value);
}
}
Chain explorer4416msChain node75ms