编译器
0.8.27+commit.40a35a09
文件 1 的 18:BrainERC20.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract BrainERC20 is ERC20, Ownable {
uint256 private constant MAX_SUPPLY = 1000000 * 10 ** 18;
event BrainTokenTransferred(address indexed from, address indexed to, uint256 amount, string message);
constructor(string memory name, string memory symbol, uint256 initialSupply, address owner) ERC20(name, symbol) Ownable(owner) {
require(initialSupply <= MAX_SUPPLY, "Initial supply exceeds maximum supply");
_mint(owner, initialSupply);
}
function mint(address account, uint256 amount) public onlyOwner {
require(totalSupply() + amount <= MAX_SUPPLY, "Minting would exceed max supply");
_mint(account, amount);
}
function burn(uint256 amount) public onlyOwner {
_burn(_msgSender(), amount);
}
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
bool success = super.transfer(to, amount);
if (success) {
emit BrainTokenTransferred(owner, to, amount, "Brain Token Transfer");
}
return success;
}
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
bool success = super.transferFrom(from, to, amount);
if (success) {
emit BrainTokenTransferred(from, to, amount, "Brain Token TransferFrom");
}
return success;
}
}
文件 2 的 18:Context.sol
pragma solidity ^0.8.20;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
文件 3 的 18:ERC165.sol
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 4 的 18:ERC20.sol
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function name() public view virtual returns (string memory) {
return _name;
}
function symbol() public view virtual returns (string memory) {
return _symbol;
}
function decimals() public view virtual returns (uint8) {
return 18;
}
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
_totalSupply -= value;
}
} else {
unchecked {
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
文件 5 的 18:ERC721.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./BrainERC20.sol";
interface IBrainCredits {
function decreaseTotalSupply() external;
function increaseTotalSupply() external;
}
contract Brains is ERC721, ReentrancyGuard, Ownable, IERC721Receiver {
using SafeMath for uint256;
struct MetadataProposal {
string name;
string metadataUrl;
string imageUrl;
uint256 votesLocked;
mapping(address => uint256) voterLocks;
bool executed;
}
struct BrainMetadata {
string name;
string metadataUrl;
string imageUrl;
}
address public brainCreditAddress;
address public pepecoinAddress;
address[] public contributors;
mapping(address => uint256) public contributions;
mapping(uint256 => address) public brainToERC20;
mapping(uint256 => mapping(uint256 => MetadataProposal)) public metadataProposals;
mapping(uint256 => uint256) public proposalCounter;
mapping(uint256 => BrainMetadata) public brainMetadata;
mapping(address => uint256) public stakes;
mapping(uint256 => uint256) public tokenStakeTime;
mapping(uint256 => string) private _tokenURIs;
mapping(uint256 => bool) private _blockedTokenIds;
uint256 public tokenCounter;
uint256 private constant TOKENS_PER_NFT = 1000 * 10**18;
uint256 private constant STAKE_AMOUNT = 100000 * 10**18;
uint256 private constant STAKE_DURATION = 90 days;
uint256[] private availableTokenIds;
uint256 public constant MAX_SUPPLY = 1024;
uint256 public constant PROPOSAL_THRESHOLD = 250000 * 10**18;
event BrainMinted(uint256 nftId, address brainFather);
event BrainTokenActivated(uint256 nftId, address brainTokenAddress);
event ContributionReceived(address contributor, uint256 amount);
event BrainMetadataUpdated(uint256 tokenId, string name, string metadataUrl, string imageUrl);
event BrainTransferred(uint256 indexed tokenId, address indexed from, address indexed to, uint256 timestamp);
event MetadataChangeProposed(uint256 indexed tokenId, uint256 proposalId, string name, string metadataUrl, string imageUrl);
event VoteCast(uint256 indexed tokenId, uint256 proposalId, address voter, uint256 amount);
constructor() ERC721("BasedAI Brains", "BRAIN") Ownable(msg.sender) {
tokenCounter = 0;
}
function setBrainCredits(address _brainCreditAddress) public onlyOwner {
brainCreditAddress = _brainCreditAddress;
}
function setPepecoin(address _pepecoinAddress) public onlyOwner {
pepecoinAddress = _pepecoinAddress;
}
function redeemBrain(uint256 amount) public nonReentrant {
require(brainCreditAddress != address(0), "Specific Brain Credit address not set");
require(amount >= TOKENS_PER_NFT, "Minimum amount not met");
require(amount % TOKENS_PER_NFT == 0, "Amount must be in increments of 1000 credits");
uint256 numNFTs = amount / TOKENS_PER_NFT;
require(tokenCounter + numNFTs - 1 <= MAX_SUPPLY, "Exceeds maximum supply of Brains");
IERC20(brainCreditAddress).transferFrom(msg.sender, address(this), amount);
for (uint256 i = 0; i < numNFTs; i++) {
uint256 tokenId;
if (availableTokenIds.length > 0) {
tokenId = availableTokenIds[availableTokenIds.length - 1];
availableTokenIds.pop();
} else {
unchecked {
tokenId = tokenCounter;
tokenCounter++;
}
}
emit BrainMinted(tokenId, msg.sender);
_safeMint(msg.sender, tokenId);
}
}
function stakePepecoin(uint256 amount) public nonReentrant {
require(pepecoinAddress != address(0), "Specific Pepecoin address not set");
require(amount % STAKE_AMOUNT == 0, "Stake amount must be in increments of 100,000 tokens");
uint256 numNFTs = amount.div(STAKE_AMOUNT);
require(tokenCounter + numNFTs - 1 <= MAX_SUPPLY, "Exceeds maximum supply of Brains");
IERC20(pepecoinAddress).transferFrom(msg.sender, address(this), amount);
stakes[msg.sender] = stakes[msg.sender].add(amount);
IBrainCredits(brainCreditAddress).decreaseTotalSupply();
for (uint256 i = 0; i < numNFTs; i++) {
uint256 tokenId;
if (availableTokenIds.length > 0) {
tokenId = availableTokenIds[availableTokenIds.length - 1];
availableTokenIds.pop();
} else {
unchecked {
tokenId = tokenCounter;
tokenCounter++;
if (tokenCounter == 47) tokenCounter++;
}
}
emit BrainMinted(tokenId, msg.sender);
_safeMint(msg.sender, tokenId);
tokenStakeTime[tokenId] = block.timestamp;
}
}
function unstakePepecoin(uint256 tokenId) public nonReentrant {
require(ownerOf(tokenId) == msg.sender, "Only Brain owner can unstake");
require(block.timestamp >= tokenStakeTime[tokenId] + STAKE_DURATION, "Stake period not yet completed");
require(stakes[msg.sender] >= STAKE_AMOUNT, "Not enough tokens staked");
stakes[msg.sender] = stakes[msg.sender].sub(STAKE_AMOUNT);
IERC20(pepecoinAddress).transfer(msg.sender, STAKE_AMOUNT);
_burn(tokenId);
availableTokenIds.push(tokenId);
IBrainCredits(brainCreditAddress).increaseTotalSupply();
}
function activateBrain(uint256 tokenId) public {
require(ownerOf(tokenId) == msg.sender, "Only Brain owner can link a ERC20");
require(brainToERC20[tokenId] == address(0), "Brain token has been activated.");
address erc20Contract = _deployERC20(msg.sender, tokenId);
brainToERC20[tokenId] = erc20Contract;
emit BrainTokenActivated(tokenId, erc20Contract);
}
function _deployERC20(address tokenOwner, uint256 tokenId) internal returns (address) {
string memory name = string(abi.encodePacked("BRAIN TOKEN #", Strings.toString(tokenId)));
string memory symbol = string(abi.encodePacked("B#", Strings.toString(tokenId)));
uint256 initialSupply = 1000000 * 10**18;
BrainERC20 newERC20 = new BrainERC20(name, symbol, initialSupply, tokenOwner);
return address(newERC20);
}
function contributeBrainCredits(uint256 amount) public {
require(brainCreditAddress != address(0), "Brain Credit address not set");
IERC20(brainCreditAddress).transferFrom(msg.sender, address(this), amount);
if (contributions[msg.sender] == 0) {
contributors.push(msg.sender);
}
contributions[msg.sender] = contributions[msg.sender].add(amount);
emit ContributionReceived(msg.sender, amount);
}
function collectiveMint() public nonReentrant {
uint256 totalContributions = 0;
uint256 totalUsedContributions = 0;
for (uint256 i = 0; i < contributors.length; i++) {
totalContributions += contributions[contributors[i]];
}
require(totalContributions >= TOKENS_PER_NFT, "Not enough BrainCredits contributed collectively");
require(tokenCounter < MAX_SUPPLY, "Exceeds maximum supply of Brains");
uint256 tokenId;
if (availableTokenIds.length > 0) {
tokenId = availableTokenIds[availableTokenIds.length - 1];
availableTokenIds.pop();
} else {
unchecked {
tokenId = tokenCounter;
tokenCounter++;
if (tokenCounter == 47) tokenCounter++;
}
}
emit BrainMinted(tokenId, address(this));
_safeMint(address(this), tokenId);
address erc20Contract = _deployERC20(address(this), tokenId);
for (uint256 i = 0; i < contributors.length && totalUsedContributions < TOKENS_PER_NFT; i++) {
address contributor = contributors[i];
uint256 contribution = contributions[contributor];
if (totalUsedContributions + contribution > TOKENS_PER_NFT) {
contribution = TOKENS_PER_NFT - totalUsedContributions;
}
contributions[contributor] -= contribution;
totalUsedContributions += contribution;
uint256 share = contribution.mul(1000000 * 10**18).div(TOKENS_PER_NFT);
BrainERC20(erc20Contract).transfer(contributor, share);
if (totalUsedContributions == TOKENS_PER_NFT) {
break;
}
}
emit BrainTokenActivated(tokenId, erc20Contract);
}
function adjustContributionsAfterMint(uint256 usedContributions) internal {
uint256 totalContributions = 0;
for (uint256 i = 0; i < contributors.length; i++) {
totalContributions = totalContributions.add(contributions[contributors[i]]);
}
uint256 remainingContributions = totalContributions.sub(usedContributions);
for (uint256 i = 0; i < contributors.length; i++) {
address contributor = contributors[i];
uint256 contribution = contributions[contributor];
uint256 newContribution = contribution.mul(remainingContributions).div(totalContributions);
contributions[contributor] = newContribution;
}
}
function getTimeUntilWithdrawal(uint256 tokenId) public view returns (uint256) {
require(ownerOf(tokenId) == msg.sender, "Only the owner can check the time");
if (block.timestamp >= tokenStakeTime[tokenId] + STAKE_DURATION) {
return 0;
} else {
return (tokenStakeTime[tokenId] + STAKE_DURATION) - block.timestamp;
}
}
function getStakedAmount(address staker) public view returns (uint256) {
return stakes[staker];
}
function mintLabsBrain(uint256 tokenId) public onlyOwner {
require(tokenId < MAX_SUPPLY, "Token ID exceeds maximum supply");
require(pepecoinAddress == address(0), "Cannot run after mint start");
emit BrainMinted(tokenId, msg.sender);
IBrainCredits(brainCreditAddress).decreaseTotalSupply();
_safeMint(msg.sender, tokenId);
if (tokenId != 47) tokenCounter++;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
string memory _tokenURI = _tokenURIs[tokenId];
if (bytes(_tokenURI).length > 0) {
return _tokenURI;
}
if (bytes(brainMetadata[tokenId].metadataUrl).length > 0) {
return brainMetadata[tokenId].metadataUrl;
}
return "https://ordinals.com/content/f4be79518ebb0283ed37012b42152dedc2bdfe2e7a89267c7448ab36e02bf99ci0";
}
function proposeMetadataChange(uint256 tokenId, string memory name, string memory metadataUrl, string memory imageUrl) public {
require(brainToERC20[tokenId] != address(0), "Brain token not activated");
require(IERC20(brainToERC20[tokenId]).balanceOf(msg.sender) > 100, "Must own at least 100 brain tokens to propose");
require(!_blockedTokenIds[tokenId], "Metadata updates disabled on Brain");
uint256 proposalId = proposalCounter[tokenId];
MetadataProposal storage proposal = metadataProposals[tokenId][proposalId];
proposal.name = name;
proposal.metadataUrl = metadataUrl;
proposal.imageUrl = imageUrl;
proposal.votesLocked = 0;
proposal.executed = false;
proposalCounter[tokenId]++;
emit MetadataChangeProposed(tokenId, proposalId, name, metadataUrl, imageUrl);
}
function voteOnProposal(uint256 tokenId, uint256 proposalId, uint256 amount) public nonReentrant {
require(brainToERC20[tokenId] != address(0), "Brain token not activated");
require(!_blockedTokenIds[tokenId], "Metadata updates disabled on Brain");
MetadataProposal storage proposal = metadataProposals[tokenId][proposalId];
require(!proposal.executed, "Proposal already executed");
IERC20 brainToken = IERC20(brainToERC20[tokenId]);
require(brainToken.balanceOf(msg.sender) >= amount, "Insufficient balance");
brainToken.transferFrom(msg.sender, address(this), amount);
proposal.votesLocked = proposal.votesLocked.add(amount);
proposal.voterLocks[msg.sender] = proposal.voterLocks[msg.sender].add(amount);
emit VoteCast(tokenId, proposalId, msg.sender, amount);
if (proposal.votesLocked >= PROPOSAL_THRESHOLD) {
executeProposal(tokenId, proposalId);
}
}
function executeProposal(uint256 tokenId, uint256 proposalId) internal {
require(!_blockedTokenIds[tokenId], "Metadata updates disabled on Brain");
MetadataProposal storage proposal = metadataProposals[tokenId][proposalId];
require(!proposal.executed, "Proposal already executed");
require(proposal.votesLocked >= PROPOSAL_THRESHOLD, "Voting threshold not met");
brainMetadata[tokenId] = BrainMetadata(proposal.name, proposal.metadataUrl, proposal.imageUrl);
proposal.executed = true;
emit BrainMetadataUpdated(tokenId, proposal.name, proposal.metadataUrl, proposal.imageUrl);
}
function withdrawVotes(uint256 tokenId, uint256 proposalId) public nonReentrant {
MetadataProposal storage proposal = metadataProposals[tokenId][proposalId];
uint256 amount = proposal.voterLocks[msg.sender];
require(amount > 0, "No votes to withdraw");
proposal.voterLocks[msg.sender] = 0;
proposal.votesLocked = proposal.votesLocked.sub(amount);
IERC20(brainToERC20[tokenId]).transfer(msg.sender, amount);
}
function updateBrainMetadata(uint256 tokenId, string memory name, string memory metadataUrl, string memory imageUrl) public {
require(ownerOf(tokenId) == msg.sender, "Only Brain owner can update metadata");
require(!_blockedTokenIds[tokenId], "Metadata updates disabled on Brain");
brainMetadata[tokenId] = BrainMetadata(name, metadataUrl, imageUrl);
emit BrainMetadataUpdated(tokenId, name, metadataUrl, imageUrl);
}
function toggleBlockBrainUri(uint256 tokenId) public onlyOwner {
_blockedTokenIds[tokenId] = !_blockedTokenIds[tokenId];
}
function totalSupply() public pure returns (uint256) {
return MAX_SUPPLY;
}
function _afterBrainTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {
emit BrainTransferred(tokenId, from, to, block.timestamp);
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
super.transferFrom(from, to, tokenId);
_afterBrainTransfer(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public virtual override {
super.safeTransferFrom(from, to, tokenId, data);
_afterBrainTransfer(from, to, tokenId);
}
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external override returns (bytes4) {
return this.onERC721Received.selector;
}
}
文件 6 的 18:IERC165.sol
pragma solidity ^0.8.20;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 7 的 18:IERC20.sol
pragma solidity ^0.8.20;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
文件 8 的 18:IERC20Metadata.sol
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
文件 9 的 18:IERC721.sol
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
function safeTransferFrom(address from, address to, uint256 tokenId) external;
function transferFrom(address from, address to, uint256 tokenId) external;
function approve(address to, uint256 tokenId) external;
function setApprovalForAll(address operator, bool approved) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
文件 10 的 18:IERC721Metadata.sol
pragma solidity ^0.8.20;
import {IERC721} from "../IERC721.sol";
interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
文件 11 的 18:IERC721Receiver.sol
pragma solidity ^0.8.20;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 12 的 18:Math.sol
pragma solidity ^0.8.20;
library Math {
error MathOverflowedMulDiv();
enum Rounding {
Floor,
Ceil,
Trunc,
Expand
}
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a & b) + (a ^ b) / 2;
}
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
return a / b;
}
return a == 0 ? 0 : (a - 1) / b + 1;
}
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
uint256 prod0 = x * y;
uint256 prod1;
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
if (prod1 == 0) {
return prod0 / denominator;
}
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
uint256 remainder;
assembly {
remainder := mulmod(x, y, denominator)
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
uint256 twos = denominator & (0 - denominator);
assembly {
denominator := div(denominator, twos)
prod0 := div(prod0, twos)
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
uint256 inverse = (3 * denominator) ^ 2;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
result = prod0 * inverse;
return result;
}
}
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 result = 1 << (log2(a) >> 1);
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}
文件 13 的 18:Ownable.sol
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
error OwnableUnauthorizedAccount(address account);
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 14 的 18:ReentrancyGuard.sol
pragma solidity ^0.8.0;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
}
function _nonReentrantAfter() private {
_status = _NOT_ENTERED;
}
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
文件 15 的 18:SafeMath.sol
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
文件 16 的 18:SignedMath.sol
pragma solidity ^0.8.20;
library SignedMath {
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
function average(int256 a, int256 b) internal pure returns (int256) {
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
function abs(int256 n) internal pure returns (uint256) {
unchecked {
return uint256(n >= 0 ? n : -n);
}
}
}
文件 17 的 18:Strings.sol
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
error StringsInsufficientHexLength(uint256 value, uint256 length);
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}
文件 18 的 18:draft-IERC6093.sol
pragma solidity ^0.8.20;
interface IERC20Errors {
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
error ERC20InvalidSender(address sender);
error ERC20InvalidReceiver(address receiver);
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
error ERC20InvalidApprover(address approver);
error ERC20InvalidSpender(address spender);
}
interface IERC721Errors {
error ERC721InvalidOwner(address owner);
error ERC721NonexistentToken(uint256 tokenId);
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
error ERC721InvalidSender(address sender);
error ERC721InvalidReceiver(address receiver);
error ERC721InsufficientApproval(address operator, uint256 tokenId);
error ERC721InvalidApprover(address approver);
error ERC721InvalidOperator(address operator);
}
interface IERC1155Errors {
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
error ERC1155InvalidSender(address sender);
error ERC1155InvalidReceiver(address receiver);
error ERC1155MissingApprovalForAll(address operator, address owner);
error ERC1155InvalidApprover(address approver);
error ERC1155InvalidOperator(address operator);
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
{
"compilationTarget": {
"contracts/ERC721.sol": "Brains"
},
"evmVersion": "cancun",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 2000
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"metadataUrl","type":"string"},{"indexed":false,"internalType":"string","name":"imageUrl","type":"string"}],"name":"BrainMetadataUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"address","name":"brainFather","type":"address"}],"name":"BrainMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"address","name":"brainTokenAddress","type":"address"}],"name":"BrainTokenActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"BrainTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"contributor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ContributionReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"metadataUrl","type":"string"},{"indexed":false,"internalType":"string","name":"imageUrl","type":"string"}],"name":"MetadataChangeProposed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":false,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"VoteCast","type":"event"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROPOSAL_THRESHOLD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"activateBrain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"brainCreditAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"brainMetadata","outputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"metadataUrl","type":"string"},{"internalType":"string","name":"imageUrl","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"brainToERC20","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectiveMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"contributeBrainCredits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"contributions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"contributors","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"getStakedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTimeUntilWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"metadataProposals","outputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"metadataUrl","type":"string"},{"internalType":"string","name":"imageUrl","type":"string"},{"internalType":"uint256","name":"votesLocked","type":"uint256"},{"internalType":"bool","name":"executed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mintLabsBrain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pepecoinAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proposalCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"metadataUrl","type":"string"},{"internalType":"string","name":"imageUrl","type":"string"}],"name":"proposeMetadataChange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redeemBrain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_brainCreditAddress","type":"address"}],"name":"setBrainCredits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pepecoinAddress","type":"address"}],"name":"setPepecoin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakePepecoin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"toggleBlockBrainUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenStakeTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unstakePepecoin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"metadataUrl","type":"string"},{"internalType":"string","name":"imageUrl","type":"string"}],"name":"updateBrainMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"voteOnProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"withdrawVotes","outputs":[],"stateMutability":"nonpayable","type":"function"}]