This contract's source code is verified! Compiler
0.8.18+commit.87f61d96
File 1 of 16: Background.sol
pragma solidity >=0.8.0;
import {SVG } from "./SVG.sol" ;
import {Util } from "./Util.sol" ;
library Background {
function render (bool isBeef ) internal pure returns (string memory ) {
return
SVG.element(
"rect" ,
SVG.rectAttributes({
_width: "100%" ,
_height: "100%" ,
_fill: isBeef ? "#BA2219" : "#000" ,
_attributes: ""
})
);
}
}
File 2 of 16: Base64.sol
pragma solidity >=0.8.0;
library Base64 {
string internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ;
function encode (string memory _data ) internal pure returns (string memory ) {
return encode(bytes (_data));
}
function encode (bytes memory _data ) internal pure returns (string memory ) {
if (_data.length = = 0 ) return "" ;
string memory table = TABLE;
uint256 encodedLen = 4 * ((_data.length + 2 ) / 3 );
string memory result = new string (encodedLen + 32 );
assembly {
mstore (result, encodedLen)
let tablePtr := add (table, 1 )
let dataPtr := _data
let endPtr := add (dataPtr, mload (_data))
let resultPtr := add (result, 32 )
for {
} lt (dataPtr, endPtr) {
} {
dataPtr := add (dataPtr, 3 )
let input := mload (dataPtr)
mstore (resultPtr, shl (248 , mload (add (tablePtr, and (shr (18 , input), 0x3F )))))
resultPtr := add (resultPtr, 1 )
mstore (resultPtr, shl (248 , mload (add (tablePtr, and (shr (12 , input), 0x3F )))))
resultPtr := add (resultPtr, 1 )
mstore (resultPtr, shl (248 , mload (add (tablePtr, and (shr (6 , input), 0x3F )))))
resultPtr := add (resultPtr, 1 )
mstore (resultPtr, shl (248 , mload (add (tablePtr, and (input, 0x3F )))))
resultPtr := add (resultPtr, 1 )
}
switch mod (mload (_data), 3 )
case 1 {
mstore (sub (resultPtr, 2 ), shl (240 , 0x3d3d ))
}
case 2 {
mstore (sub (resultPtr, 1 ), shl (248 , 0x3d ))
}
}
return result;
}
}
File 3 of 16: Beef.sol
pragma solidity ^0.8.15;
import "./BeefERC721.sol" ;
import {ConceptStruct } from "../libraries/ConceptStruct.sol" ;
import {Render } from "../libraries/Render.sol" ;
import {Util } from "../libraries/Util.sol" ;
uint256 constant PERMISSIONLESS = 1 ;
uint256 constant NO_EXTERNALITIES = 2 ;
uint256 constant OPENING_HOURS = 3 ;
uint256 constant DEAD_BEEF = 4 ;
uint256 constant MUTUAL_A = 5 ;
uint256 constant MUTUAL_B = 6 ;
uint256 constant FAIR_PRICE = 7 ;
uint256 constant BEEF_BABE = 8 ;
uint256 constant SATED = 9 ;
uint256 constant DARK = 10 ;
uint256 constant RETRACTED = 11 ;
uint256 constant BAD_BEEF = 12 ;
uint256 constant EOA = 13 ;
uint256 constant SAMEBLOCK_I = 14 ;
uint256 constant SAMEBLOCK_II = 15 ;
uint256 constant SAMEBLOCK_III = 16 ;
uint256 constant LIMITED_USE = 17 ;
uint256 constant DEAF_BABE = 18 ;
uint256 constant DECREASE = 19 ;
uint256 constant SECRET_POEM = 20 ;
uint256 constant LOCUS = 21 ;
uint256 constant PERMANENCE_I = 22 ;
uint256 constant BEEF_BEEF = 23 ;
uint256 constant DEPENDENT_A = 24 ;
uint256 constant DEPENDENT_B = 25 ;
uint256 constant LIGHT = 26 ;
uint256 constant INCREASE = 27 ;
uint256 constant DEAD_BABE = 28 ;
uint256 constant CONTINUOUS = 29 ;
uint256 constant SECRET_JOKE = 30 ;
uint256 constant PERMANENCE_II = 31 ;
uint256 constant DEAF_BEEF = 32 ;
uint256 constant MAXIMALISM = 33 ;
uint256 constant COINBASE = 34 ;
uint256 constant BABE_BEEF = 35 ;
uint256 constant BEEF_FACE = 36 ;
uint256 constant FEED_BEEF = 37 ;
uint256 constant SECRET_TRUTH = 38 ;
uint256 constant CHROMATIC = 39 ;
uint256 constant UNWIELDY = 40 ;
uint256 constant BAD_BABE = 41 ;
uint256 constant TRANSITORY_OWNERSHIP = 42 ;
error NoBeef ( ) ;
error CurrentlyClosed ( ) ;
error HalfOfTheTime ( ) ;
error Codependent ( ) ;
error MutuallyExclusive ( ) ;
error NotFairPrice ( ) ;
error NotLight ( ) ;
error NotDark ( ) ;
error NotChromatic ( ) ;
error NotContract ( ) ;
error NotCoinbase ( ) ;
error NotContinuous ( ) ;
contract Beef is BeefERC721 {
constructor ( ) BeefERC721 ("BEEF" , "BEEF" ) {
_mint(block .coinbase , TRANSITORY_OWNERSHIP);
totalSupply+ + ;
}
uint256 public totalSupply = 0 ;
uint256 public editionSize = 42 ;
uint256 constant public price = 0 .1 ether ;
function mint (uint256 _tokenId ) external payable {
require (_tokenId > 0 & & _tokenId < = editionSize);
uint256 mintPrice = (_tokenId = = UNWIELDY ? (1 ether + price) : price);
require (msg .value = = mintPrice);
_mint(msg .sender , _tokenId);
totalSupply+ + ;
}
function withdraw (address payable _to ) public onlyArtist {
(bool success,) = _to.call {value : address (this ).balance }("" );
require (success);
}
mapping (uint256 = > ConceptStruct.Concept) concepts;
mapping (uint256 = > uint256 ) tokenIdToConcept;
function setConceptData (ConceptStruct.Concept[] memory _concepts ) public onlyArtist {
for (uint i = 0 ; i < _concepts.length ; i+ + ) {
ConceptStruct.Concept memory concept = _concepts[i];
uint256 conceptId = concept._editionTokenRangeStart;
concepts[conceptId] = concept;
for (uint j = concept._editionTokenRangeStart; j < concept._editionTokenRangeStart + concept._editionSize; j+ + ) {
tokenIdToConcept[j] = conceptId;
}
}
}
mapping (uint256 = > uint256 ) sameBlockAt;
mapping (uint256 = > address ) sameBlockTo;
uint256 public fairPrice = 0 .1 ether ;
uint96 public increasable = 1 ;
uint96 public decreasable = 1111111111111111111111111111 ;
uint256 public transfersLeft = 7 ;
function buyAtFairPrice ( ) external payable {
if (_ownerOf[FAIR_PRICE] = = address (0 )) {
if (msg .value < fairPrice) revert NotFairPrice();
_mint(msg .sender , FAIR_PRICE);
} else if (msg .value > fairPrice) {
fairPrice = msg .value ;
_transferFromInternal(_ownerOf[FAIR_PRICE], msg .sender , FAIR_PRICE);
} else {
revert NotFairPrice();
}
}
function increase ( ) external payable {
increasable+ + ;
}
function decrease ( ) external payable {
decreasable- - ;
}
function retract ( ) external onlyArtist {
_transferFromInternalNoHooksAndChecks(_ownerOf[RETRACTED], artist(), RETRACTED);
}
function isOpenHours ( ) public view returns (bool ) {
uint256 daytime = block .timestamp % (24 * 3600 );
return (daytime > = 9 * 3600 ) & & (daytime < = 17 * 3600 );
}
function whereIs (address _address ) public pure returns (uint256 x, uint256 y , uint256 z ) {
uint256 addressNumber = uint256 (keccak256 (abi .encodePacked (_address)));
x = addressNumber % 10e4 ;
y = (addressNumber > > 8 ) % 10e4 ;
z = (addressNumber > > 16 ) % 10e3 ;
}
function updateTransitory ( ) external {
_transferFromInternal(_ownerOf[TRANSITORY_OWNERSHIP], block .coinbase , TRANSITORY_OWNERSHIP);
}
function ownerOf (uint256 id ) public view override returns (address ) {
if (id = = TRANSITORY_OWNERSHIP) {
return block .coinbase ;
} else if (
(id = = PERMANENCE_I & & block .number % 2 = = 0 ) | |
(id = = PERMANENCE_II & & block .number % 2 = = 1 )
) {
revert HalfOfTheTime();
} else if (id = = OPENING_HOURS) {
if (! isOpenHours()) revert CurrentlyClosed();
}
return super .ownerOf(id);
}
function balanceOf (address owner ) public view override returns (uint256 ) {
if (owner = = block .coinbase ) {
return 1 + _balanceOf[owner];
}
return super .balanceOf(owner);
}
function transferFrom (
address from ,
address to,
uint256 id
) public override payable {
if (id = = PERMISSIONLESS) {
_transferFromInternal(from , to, id);
} else if (id = = TRANSITORY_OWNERSHIP) {
_transferFromInternal(from , to, id);
} else {
super .transferFrom(from , to, id);
}
}
function safeTransferFrom (
address from ,
address to,
uint256 id
) public override payable {
if (id = = PERMISSIONLESS) {
_transferFromInternal(from , to, id);
} else if (id = = TRANSITORY_OWNERSHIP) {
_transferFromInternal(from , to, id);
} else {
super .transferFrom(from , to, id);
}
require (
to.code .length = = 0 | |
ERC721TokenReceiver(to).onERC721Received(msg .sender , from , id, "" ) = =
ERC721TokenReceiver.onERC721Received.selector ,
"UNSAFE_RECIPIENT"
);
}
function safeTransferFrom (
address from ,
address to,
uint256 id,
bytes calldata data
) public override payable {
if (id = = PERMISSIONLESS) {
_transferFromInternal(from , to, id);
} else if (id = = TRANSITORY_OWNERSHIP) {
_transferFromInternal(from , to, id);
} else {
super .transferFrom(from , to, id);
}
require (
to.code .length = = 0 | |
ERC721TokenReceiver(to).onERC721Received(msg .sender , from , id, data) = =
ERC721TokenReceiver.onERC721Received.selector ,
"UNSAFE_RECIPIENT"
);
}
function _afterTokenTransfer (
address from ,
address to,
uint256 tokenId
) internal override {}
function _beforeTokenTransfer (
address ,
address to,
uint256 tokenId
) internal override returns (bool ) {
if (tokenId = = SATED) {
uint256 waste; for (uint256 i = 0 ; i < 159160 ; i+ + ) waste+ + ;
} else if (
(tokenId = = PERMANENCE_I & & block .number % 2 = = 0 ) | |
(tokenId = = PERMANENCE_II & & block .number % 2 = = 1 )
) {
revert HalfOfTheTime();
} else if (tokenId = = TRANSITORY_OWNERSHIP) {
require (to = = block .coinbase );
} else if (tokenId = = OPENING_HOURS) {
if (! isOpenHours()) revert CurrentlyClosed();
} else if (tokenId = = DEAD_BEEF | | tokenId = = BEEF_BEEF | | tokenId = = FEED_BEEF | | tokenId = = DEAF_BEEF
| | tokenId = = BAD_BEEF | | tokenId = = BEEF_FACE | | tokenId = = BABE_BEEF | | tokenId = = BEEF_BABE
| | tokenId = = BAD_BABE | | tokenId = = DEAF_BABE | | tokenId = = DEAD_BABE
) {
bytes20 addr = bytes20 (to);
if (
(
(tokenId = = DEAD_BEEF & & (addr & hex"ffff00000000000000000000000000000000ffff" = = hex"dead00000000000000000000000000000000beef" ))
| |
(tokenId = = BEEF_BEEF & & (addr & hex"ffff00000000000000000000000000000000ffff" = = hex"beef00000000000000000000000000000000beef" ))
| |
(tokenId = = FEED_BEEF & & (addr & hex"ffff00000000000000000000000000000000ffff" = = hex"feed00000000000000000000000000000000beef" ))
| |
(tokenId = = DEAF_BEEF & & (addr & hex"ffff00000000000000000000000000000000ffff" = = hex"deaf00000000000000000000000000000000beef" ))
| |
(tokenId = = BAD_BEEF & & (addr & hex"fff000000000000000000000000000000000ffff" = = hex"bad000000000000000000000000000000000beef" ))
| |
(tokenId = = BEEF_FACE & & (addr & hex"ffff00000000000000000000000000000000ffff" = = hex"beef00000000000000000000000000000000face" ))
| |
(tokenId = = BABE_BEEF & & (addr & hex"ffff00000000000000000000000000000000ffff" = = hex"babe00000000000000000000000000000000beef" ))
| |
(tokenId = = BEEF_BABE & & (addr & hex"ffff00000000000000000000000000000000ffff" = = hex"beef00000000000000000000000000000000babe" ))
| |
(tokenId = = BAD_BABE & & (addr & hex"fff000000000000000000000000000000000ffff" = = hex"bad000000000000000000000000000000000babe" ))
| |
(tokenId = = DEAF_BABE & & (addr & hex"ffff00000000000000000000000000000000ffff" = = hex"deaf00000000000000000000000000000000babe" ))
| |
(tokenId = = DEAD_BABE & & (addr & hex"ffff00000000000000000000000000000000ffff" = = hex"dead00000000000000000000000000000000babe" ))
) = = false
) {
revert NoBeef();
}
} else if (tokenId > = SAMEBLOCK_I & & tokenId < = SAMEBLOCK_III) {
uint256 dependentIdA = tokenId = = SAMEBLOCK_I ? SAMEBLOCK_II : SAMEBLOCK_I;
uint256 dependentIdB = tokenId = = SAMEBLOCK_I ? SAMEBLOCK_III : tokenId = = SAMEBLOCK_II ? SAMEBLOCK_III : SAMEBLOCK_II;
if (sameBlockAt[dependentIdA] = = block .number & & sameBlockAt[dependentIdB] = = block .number ) {
_ownerOf[dependentIdA] = = address (0 )
? _mintNoHooks(sameBlockTo[dependentIdA], dependentIdA)
: _transferFromInternalNoHooksAndChecks(_ownerOf[dependentIdA], sameBlockTo[dependentIdA], dependentIdA);
_ownerOf[dependentIdB] = = address (0 )
? _mintNoHooks(sameBlockTo[dependentIdB], dependentIdB)
: _transferFromInternalNoHooksAndChecks(_ownerOf[dependentIdB], sameBlockTo[dependentIdB], dependentIdB);
return true ;
} else {
sameBlockAt[tokenId] = block .number ;
sameBlockTo[tokenId] = to;
return false ;
}
} else if (tokenId = = DEPENDENT_A | | tokenId = = DEPENDENT_B) {
uint256 dependentId = tokenId = = DEPENDENT_A ? DEPENDENT_B : DEPENDENT_A;
if (
(
uint160 (_ownerOf[dependentId]) % 4096 + uint160 (to) % 4096 < 4096
& &
uint160 (bytes20 (_ownerOf[dependentId]) > > 148 ) % 4096 + uint160 (bytes20 (to) > > 148 ) % 4096 < 4096
) = = false
) {
revert Codependent();
}
} else if (tokenId = = MUTUAL_A | | tokenId = = MUTUAL_B) {
uint256 dependentId = tokenId = = MUTUAL_A ? MUTUAL_B : MUTUAL_A;
bytes20 bytesDependent = bytes20 (_ownerOf[dependentId]);
bytes20 bytesTo = bytes20 (to);
for (uint i = 0 ; i < 40 ; i+ + ) {
if (uint160 (bytesDependent > > i * 4 ) % 16 = = uint160 (bytesTo > > i * 4 ) % 16 ) {
revert MutuallyExclusive();
}
}
} else if (tokenId = = LIGHT) {
bytes20 bytesTo = bytes20 (to);
uint16 count;
for (uint i ; i < 40 ; i+ + ) {
if (uint160 (bytesTo > > i * 4 ) % 16 = = 0 ) break ;
if (uint160 (bytesTo > > i * 4 ) % 16 = = 15 ) count+ + ;
if (count > 13 ) return true ;
}
revert NotLight();
} else if (tokenId = = DARK) {
bytes20 bytesTo = bytes20 (to);
uint16 count;
for (uint i ; i < 40 ; i+ + ) {
if (uint160 (bytesTo > > i * 4 ) % 16 = = 15 ) break ;
if (uint160 (bytesTo > > i * 4 ) % 16 = = 0 ) count+ + ;
if (count > 13 ) return true ;
}
revert NotDark();
} else if (tokenId = = CHROMATIC) {
bytes20 bytesTo = bytes20 (to);
uint256 bitmap;
for (uint256 i; i < 40 ; i+ + ) {
bitmap | = (1 < < (uint160 (bytesTo > > i * 4 ) % 16 ));
if (bitmap = = 65535 ) return true ;
}
revert NotChromatic();
} else if (tokenId = = NO_EXTERNALITIES) {
uint size;
assembly { size := extcodesize (to) }
if (size = = 0 ) revert NotContract();
} else if (tokenId = = EOA) {
uint size;
assembly { size := extcodesize (to) }
require (size = = 0 );
require (tx .origin = = msg .sender );
} else if (tokenId = = LIMITED_USE) {
if (transfersLeft > 0 ) {
transfersLeft- - ;
} else {
_transferFromInternalNoHooksAndChecks(_ownerOf[LIMITED_USE], address (0xdEaD ), LIMITED_USE);
return false ;
}
} else if (tokenId = = UNWIELDY) {
require (msg .value > = 1 ether & & msg .value < = 1 ether + price);
(bool success,) = address (0 ).call {value : 1 ether }("" );
require (success);
} else if (tokenId = = COINBASE) {
if (to ! = block .coinbase ) revert NotCoinbase();
} else if (tokenId = = CONTINUOUS) {
bytes20 bytesFrom = bytes20 (_ownerOf[CONTINUOUS]);
bytes20 bytesTo = bytes20 (to);
for (uint i = 0 ; i < 3 ; i+ + ) {
if (uint160 (bytesFrom > > (i) * 4 ) % 16 ! = uint160 (bytesTo > > (40 - (3 - i)) * 4 ) % 16 ) {
revert NotContinuous();
}
}
}
return true ;
}
function renderSVG (uint256 _tokenId ) external view returns (string memory ) {
ConceptStruct.Concept memory concept = _getConceptFromTokenId(_tokenId);
return Render.renderSVG(_tokenId, concept, font);
}
function renderSVGBase64 (uint256 _tokenId ) external view returns (string memory ) {
ConceptStruct.Concept memory concept = _getConceptFromTokenId(_tokenId);
return Render.renderSVGBase64(_tokenId, concept, font);
}
function tokenURI (uint256 _tokenId ) public view override returns (string memory ) {
if (
(_tokenId = = PERMANENCE_I & & block .number % 2 = = 0 ) | |
(_tokenId = = PERMANENCE_II & & block .number % 2 = = 1 )
) {
revert HalfOfTheTime();
} else if (_tokenId = = OPENING_HOURS) {
if (! isOpenHours()) revert CurrentlyClosed();
}
require (_ownerOf[_tokenId] ! = address (0 ), "NOT_MINTED" );
ConceptStruct.Concept memory concept = _getConceptFromTokenId(_tokenId);
return Render.tokenURI(_tokenId, concept, font);
}
function _getConceptFromTokenId (uint256 _tokenId ) private view returns (ConceptStruct.Concept memory ) {
uint256 conceptId = tokenIdToConcept[_tokenId];
ConceptStruct.Concept memory concept = concepts[conceptId];
if (_tokenId = = FAIR_PRICE) {
bytes32 [] memory statusText = new bytes32 [](1 );
statusText[0 ] = bytes32 (abi .encodePacked ("Price: " , Util.uint256ToString(uint256 (fairPrice / 10e17 )), "." , Util.uint256ToString(uint256 ((fairPrice / 10e16 ) % 10 )), (fairPrice / 10e15 ) % 10 = = 0 ? "" : Util.uint256ToString(uint256 ((fairPrice / 10e15 ) % 10 )), " ETH" ));
concept._statusText = statusText;
} else if (_tokenId = = LIMITED_USE) {
bytes32 [] memory statusText = new bytes32 [](1 );
statusText[0 ] = bytes32 (abi .encodePacked ("Transfers Left: " , Util.uint256ToString(uint256 (transfersLeft))));
concept._statusText = statusText;
} else if (_tokenId = = INCREASE) {
concept._title = bytes32 (abi .encodePacked (Util.uint256ToString(uint256 (increasable))));
} else if (_tokenId = = DECREASE) {
concept._title = bytes32 (abi .encodePacked (Util.uint256ToString(uint256 (decreasable))));
} else if (_tokenId = = OPENING_HOURS) {
bytes32 [] memory statusText = new bytes32 [](1 );
statusText[0 ] = bytes32 (abi .encodePacked ("Currently " , isOpenHours() ? "Open" : "Closed" ));
concept._statusText = statusText;
} else if (_tokenId = = LOCUS) {
bytes32 [] memory statusText = new bytes32 [](3 );
uint256 x; uint256 y; uint256 z;
(x,y,z) = whereIs(_ownerOf[_tokenId]);
statusText[0 ] = bytes32 (abi .encodePacked (
Util.uint256ToString(x), ", " ,
Util.uint256ToString(y), ", " ,
Util.uint256ToString(z)
));
concept._statusText = statusText;
}
return concept;
}
string private font = "data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAABRUABIAAAAALMgAABPwAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGh4bhzwcMAZgAIMyCDQJhGURCAq1KK5OC4EKAAE2AiQDghAEIAWGQAeCUwyCZRuoJwXcGKdh4wAD/+7DEdWhZcv+rxO4MQT7h1rCI0LVSZUog7oNa2Kt3pmxsVZfG8XXcc5iHMBWfJWLYRTw4RNn7VevmEXEXqttFIsosDXqeKqcDq9Kff+TeoQkszxUy2+ve2b39lIATXbBYVO2KFRUYBTZIvlCUngs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FG0KLKtv6/uU7Cqorqa6TStNXGR9MozsrIIi4PkE8uXcwgtfrAoRmAJa8hJCf9ojLU2SSd0FJtgJS1DQIkSPBRZSACU+aCjVJmIaSNgXGFroq0aKDgip8od3tqnfDbcP7zvNELq3zGI0j81FbkwFrtRbG7KChU/dVb/3f6PqqdeoeRalXvMqgLhk=" ;
}
File 4 of 16: BeefERC721.sol
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol" ;
abstract contract BeefERC721 is Ownable {
string public name;
string public symbol;
mapping (uint256 = > address ) public getApproved;
mapping (address = > mapping (address = > bool )) public isApprovedForAll;
mapping (uint256 = > address ) internal _ownerOf;
mapping (address = > uint256 ) internal _balanceOf;
event Transfer (address indexed from , address indexed to, uint256 indexed id ) ;
event Approval (address indexed owner, address indexed spender, uint256 indexed id ) ;
event ApprovalForAll (address indexed owner, address indexed operator, bool approved ) ;
function tokenURI (uint256 id ) public view virtual returns (string memory ) ;
function ownerOf (uint256 id ) public view virtual returns (address ) {
address owner = _ownerOf[id];
require (owner ! = address (0 ), "NOT_MINTED" );
return owner;
}
function balanceOf (address owner ) public view virtual returns (uint256 ) {
require (owner ! = address (0 ), "ZERO_ADDRESS" );
return _balanceOf[owner];
}
function artist ( ) public view returns (address ) {
return owner();
}
modifier onlyArtist {
require (msg .sender = = artist());
_ ;
}
constructor (string memory _name, string memory _symbol ) {
name = _name;
symbol = _symbol;
}
function approve (address spender, uint256 id ) public virtual {
address owner = _ownerOf[id];
require (msg .sender = = owner | | isApprovedForAll[owner][msg .sender ], "NOT_AUTHORIZED" );
getApproved[id] = spender;
emit Approval(owner, spender, id);
}
function setApprovalForAll (address operator, bool approved ) public virtual {
isApprovedForAll[msg .sender ][operator] = approved;
emit ApprovalForAll(msg .sender , operator, approved);
}
function transferFrom (
address from ,
address to,
uint256 id
) public virtual payable {
require (
msg .sender = = from | | isApprovedForAll[from ][msg .sender ] | | msg .sender = = getApproved[id],
"NOT_AUTHORIZED"
);
_transferFromInternal(from , to, id);
}
function _transferFromInternal (
address from ,
address to,
uint256 id
) internal virtual {
require (to ! = address (0 ), "INVALID_RECIPIENT" );
require (from = = _ownerOf[id], "WRONG_FROM" );
bool doTransfer = _beforeTokenTransfer(from , to, id);
if (! doTransfer) return ;
unchecked {
_balanceOf[from ]- - ;
_balanceOf[to]+ + ;
}
_ownerOf[id] = to;
delete getApproved[id];
emit Transfer(from , to, id);
_afterTokenTransfer(from , to, id);
}
function _transferFromInternalNoHooksAndChecks (
address from ,
address to,
uint256 id
) internal virtual {
require (to ! = address (0 ), "INVALID_RECIPIENT" );
unchecked {
_balanceOf[from ]- - ;
_balanceOf[to]+ + ;
}
_ownerOf[id] = to;
delete getApproved[id];
emit Transfer(from , to, id);
}
function safeTransferFrom (
address from ,
address to,
uint256 id
) public virtual payable ;
function safeTransferFrom (
address from ,
address to,
uint256 id,
bytes calldata data
) public virtual payable ;
function supportsInterface (bytes4 interfaceId ) public view virtual returns (bool ) {
return
interfaceId = = 0x01ffc9a7 | |
interfaceId = = 0x80ac58cd | |
interfaceId = = 0x5b5e139f ;
}
function _mint (address to, uint256 id ) internal virtual {
require (to ! = address (0 ), "INVALID_RECIPIENT" );
require (_ownerOf[id] = = address (0 ), "ALREADY_MINTED" );
bool doTransfer = _beforeTokenTransfer(address (0 ), to, id);
if (! doTransfer) return ;
unchecked {
_balanceOf[to]+ + ;
}
_ownerOf[id] = to;
emit Transfer(address (0 ), to, id);
_afterTokenTransfer(address (0 ), to, id);
}
function _mintNoHooks (address to, uint256 id ) internal virtual {
require (to ! = address (0 ), "INVALID_RECIPIENT" );
require (_ownerOf[id] = = address (0 ), "ALREADY_MINTED" );
unchecked {
_balanceOf[to]+ + ;
}
_ownerOf[id] = to;
emit Transfer(address (0 ), to, id);
}
function _beforeTokenTransfer (
address from ,
address to,
uint256 tokenId
) internal virtual returns (bool ) {}
function _afterTokenTransfer (
address from ,
address to,
uint256 tokenId
) internal virtual {}
}
abstract contract ERC721TokenReceiver {
function onERC721Received (
address ,
address ,
uint256 ,
bytes calldata
) external virtual returns (bytes4 ) {
return ERC721TokenReceiver.onERC721Received.selector ;
}
}
File 5 of 16: ConceptStruct.sol
pragma solidity >=0.8.0;
library ConceptStruct {
struct Concept {
uint256 _editionTokenRangeStart;
uint256 _editionSize;
bytes32 _title;
bytes32 [] _bodyText;
bytes32 [] _smallPrintText;
bytes32 [] _statusText;
}
} File 6 of 16: Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender ( ) internal view virtual returns (address ) {
return msg .sender ;
}
function _msgData ( ) internal view virtual returns (bytes calldata ) {
return msg .data ;
}
}
File 7 of 16: Metadata.sol
pragma solidity >=0.8.0;
import {Base64 } from "./Base64.sol" ;
import {Util } from "./Util.sol" ;
library Metadata {
string constant JSON_BASE64_HEADER = "data:application/json;base64," ;
string constant SVG_XML_BASE64_HEADER = "data:image/svg+xml;base64," ;
function encodeMetadata (
uint256 _tokenId,
string memory _name,
string memory _description,
string memory _svg
) internal pure returns (string memory ) {
string memory metadata = string .concat (
"{" ,
Util.keyValue("tokenId" , Util.uint256ToString(_tokenId)),
"," ,
Util.keyValue("name" , _name),
"," ,
Util.keyValue("description" , _description),
"," ,
Util.keyValue("image" , _encodeSVG(_svg)),
"}"
);
return _encodeJSON(metadata);
}
function _encodeJSON (string memory _json ) internal pure returns (string memory ) {
return string .concat (JSON_BASE64_HEADER, Base64.encode(_json));
}
function _encodeSVG (string memory _svg ) internal pure returns (string memory ) {
return string .concat (SVG_XML_BASE64_HEADER, Base64.encode(bytes (_svg)));
}
}
File 8 of 16: Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol" ;
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred (address indexed previousOwner, address indexed newOwner ) ;
constructor ( ) {
_transferOwnership(_msgSender());
}
modifier onlyOwner ( ) {
_checkOwner();
_ ;
}
function owner ( ) public view virtual returns (address ) {
return _owner;
}
function _checkOwner ( ) internal view virtual {
require (owner() = = _msgSender(), "Ownable: caller is not the owner" );
}
function renounceOwnership ( ) public virtual onlyOwner {
_transferOwnership(address (0 ));
}
function transferOwnership (address newOwner ) public virtual onlyOwner {
require (newOwner ! = address (0 ), "Ownable: new owner is the zero address" );
_transferOwnership(newOwner);
}
function _transferOwnership (address newOwner ) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
File 9 of 16: Render.sol
pragma solidity >=0.8.0;
import {Metadata } from "./Metadata.sol" ;
import {Util } from "./Util.sol" ;
import {Traits } from "./Traits.sol" ;
import {Background } from "./Background.sol" ;
import {TextBody } from "./TextBody.sol" ;
import {TextLine } from "./TextLine.sol" ;
import {TextEdition } from "./TextEdition.sol" ;
import {TextOf } from "./TextOf.sol" ;
import {Traits } from "./Traits.sol" ;
import {SVG } from "./SVG.sol" ;
import {ConceptStruct } from "./ConceptStruct.sol" ;
library Render {
string public constant description =
"The BEEF series." ;
function tokenURI (uint256 _tokenId, ConceptStruct.Concept memory concept, string memory base64font ) internal pure returns (string memory ) {
bytes memory descriptionConcat;
for (uint i = 0 ; i < concept._bodyText.length ; i+ + ) {
descriptionConcat = abi .encodePacked (descriptionConcat, Util.bytes32ToBytes(concept._bodyText[i]));
}
return
Metadata.encodeMetadata({
_tokenId: _tokenId,
_name: Util.bytes32ToString(concept._title),
_description: string (abi .encodePacked (descriptionConcat)),
_svg: _svg(_tokenId, concept, base64font)
});
}
function renderSVG (uint256 _tokenId, ConceptStruct.Concept memory concept, string memory base64font ) internal pure returns (string memory ) {
return _svg(_tokenId, concept, base64font);
}
function renderSVGBase64 (uint256 _tokenId, ConceptStruct.Concept memory concept, string memory base64font ) internal pure returns (string memory ) {
return Metadata._encodeSVG(_svg(_tokenId, concept, base64font));
}
function _svg (
uint256 _tokenId,
ConceptStruct.Concept memory _concept,
string memory base64font
) internal pure returns (string memory ) {
bool isBeef = _tokenId = = 4 | | _tokenId = = 8 | | _tokenId = = 12 | | _tokenId = = 23 | | _tokenId = = 32 | | _tokenId = = 35 | | _tokenId = = 36 | | _tokenId = = 37 ;
return
SVG.element(
"svg" ,
SVG.svgAttributes(),
string .concat (
'<defs><style>' ,
'@font-face {font-family: "Norw";src: url("' ,
base64font,
'");}' ,
'text {text-transform: uppercase;'
'}</style></defs>'
),
Background.render(isBeef),
_renderText(_tokenId, _concept)
);
}
function _renderText (uint256 _tokenId, ConceptStruct.Concept memory _concept ) internal pure returns (string memory ) {
uint256 smallPrintOffset = 215 + _concept._bodyText.length * 30 + (_concept._bodyText.length > 0 ? 50 : 0 );
uint256 statusOffset = smallPrintOffset + _concept._smallPrintText.length * 20 + (_concept._smallPrintText.length > 0 ? 50 : 0 );
return SVG.element(
"g" ,
"" ,
TextLine.render(_concept._title, 155 , false ),
TextBody.render(_concept._bodyText, 215 , false ),
TextBody.render(_concept._statusText, statusOffset, false ),
TextBody.render(_concept._smallPrintText, smallPrintOffset, true ),
TextEdition.render(bytes32 (abi .encodePacked (Util.uint256ToString(_tokenId)))),
TextOf.render(_editionTextConcat(_tokenId, _concept))
);
}
function _editionTextConcat (uint256 _tokenId, ConceptStruct.Concept memory _concept ) internal pure returns (bytes32 ) {
uint256 editionCount = _tokenId - _concept._editionTokenRangeStart + 1 ;
return bytes32 (abi .encodePacked (Util.uint256ToString(editionCount), " of " , Util.uint256ToString(_concept._editionSize)));
}
function _name (uint256 _tokenId ) internal pure returns (string memory ) {
return string .concat ("Beef " , Util.uint256ToString(_tokenId, 4 ));
}
}
File 10 of 16: SVG.sol
pragma solidity >=0.8.0;
import {Util } from "./Util.sol" ;
library SVG {
function element (string memory _type, string memory _attributes ) internal pure returns (string memory ) {
return string .concat ("<" , _type, " " , _attributes, "/>" );
}
function element (
string memory _type,
string memory _attributes,
string memory _children
) internal pure returns (string memory ) {
return string .concat ("<" , _type, " " , _attributes, ">" , _children, "</" , _type, ">" );
}
function element (
string memory _type,
string memory _attributes,
string memory _child1,
string memory _child2
) internal pure returns (string memory ) {
return element(_type, _attributes, string .concat (_child1, _child2));
}
function element (
string memory _type,
string memory _attributes,
string memory _child1,
string memory _child2,
string memory _child3
) internal pure returns (string memory ) {
return element(_type, _attributes, string .concat (_child1, _child2, _child3));
}
function element (
string memory _type,
string memory _attributes,
string memory _child1,
string memory _child2,
string memory _child3,
string memory _child4
) internal pure returns (string memory ) {
return element(_type, _attributes, string .concat (_child1, _child2, _child3, _child4));
}
function element (
string memory _type,
string memory _attributes,
string memory _child1,
string memory _child2,
string memory _child3,
string memory _child4,
string memory _child5
) internal pure returns (string memory ) {
return element(_type, _attributes, string .concat (_child1, _child2, _child3, _child4, _child5));
}
function element (
string memory _type,
string memory _attributes,
string memory _child1,
string memory _child2,
string memory _child3,
string memory _child4,
string memory _child5,
string memory _child6
) internal pure returns (string memory ) {
return element(_type, _attributes, string .concat (_child1, _child2, _child3, _child4, _child5, _child6));
}
function element (
string memory _type,
string memory _attributes,
string memory _child1,
string memory _child2,
string memory _child3,
string memory _child4,
string memory _child5,
string memory _child6,
string memory _child7
) internal pure returns (string memory ) {
return
element(_type, _attributes, string .concat (_child1, _child2, _child3, _child4, _child5, _child6, _child7));
}
function element (
string memory _type,
string memory _attributes,
string memory _child1,
string memory _child2,
string memory _child3,
string memory _child4,
string memory _child5,
string memory _child6,
string memory _child7,
string memory _child8
) internal pure returns (string memory ) {
return
element(_type, _attributes, string .concat (_child1, _child2, _child3, _child4, _child5, _child6, _child7, _child8));
}
function svgAttributes ( ) internal pure returns (string memory ) {
return
string .concat (
'xmlns="http://www.w3.org/2000/svg" '
'xmlns:xlink="http://www.w3.org/1999/xlink" '
'width="100%" '
'height="100%" '
'viewBox="0 0 511 619" ' ,
'preserveAspectRatio="xMidYMid meet" ' ,
'fill="none" '
);
}
function textAttributes (
string [2 ] memory _coords,
string memory _fontSize,
string memory _fontFamily,
string memory _fill,
string memory _attributes
) internal pure returns (string memory ) {
return
string .concat (
"x=" ,
Util.quote(_coords[0 ]),
"y=" ,
Util.quote(_coords[1 ]),
"font-size=" ,
Util.quote(string .concat (_fontSize, "px" )),
"font-family=" ,
Util.quote(_fontFamily),
"fill=" ,
Util.quote(_fill),
" " ,
_attributes,
" "
);
}
function rectAttributes (
string memory _width,
string memory _height,
string memory _fill,
string memory _attributes
) internal pure returns (string memory ) {
return
string .concat (
"width=" ,
Util.quote(_width),
"height=" ,
Util.quote(_height),
"fill=" ,
Util.quote(_fill),
" " ,
_attributes,
" "
);
}
function filterAttribute (string memory _id ) internal pure returns (string memory ) {
return string .concat ("filter=" , '"' , "url(#" , _id, ")" , '" ' );
}
}
File 11 of 16: TextBody.sol
pragma solidity >=0.8.0;
import {Util } from "./Util.sol" ;
import {SVG } from "./SVG.sol" ;
library TextBody {
function render (bytes32 [] memory _text, uint256 yOffset, bool _small ) internal pure returns (string memory ) {
string memory textLines = "" ;
for (uint8 index = 0 ; index < _text.length ; + + index) {
textLines = string .concat (
textLines,
SVG.element(
"text" ,
SVG.textAttributes({
_fontSize: _small ? "14" : "26" ,
_fontFamily: "Norw, 'Courier New', monospace" ,
_coords: [
"60" ,
Util.uint256ToString(yOffset + index * (_small ? 20 : 30 ))
],
_fill: "white" ,
_attributes: ""
}),
Util.bytes32ToString(_text[index])
)
);
}
return
textLines;
}
}
File 12 of 16: TextEdition.sol
pragma solidity >=0.8.0;
import {Util } from "./Util.sol" ;
import {SVG } from "./SVG.sol" ;
library TextEdition {
function render (bytes32 _text ) internal pure returns (string memory ) {
return
SVG.element(
"text" ,
SVG.textAttributes({
_fontSize: "26" ,
_fontFamily: "Norw, 'Courier New', monospace" ,
_coords: ["12" , "35" ],
_fill: "white" ,
_attributes: ""
}),
Util.bytes32ToString(_text)
);
}
}
File 13 of 16: TextLine.sol
pragma solidity >=0.8.0;
import {Util } from "./Util.sol" ;
import {SVG } from "./SVG.sol" ;
library TextLine {
function render (bytes32 _text, uint256 yOffset, bool _small ) internal pure returns (string memory ) {
return
SVG.element(
"text" ,
SVG.textAttributes({
_fontSize: _small ? "14" : "26" ,
_fontFamily: "Norw, 'Courier New', monospace" ,
_coords: [
"60" ,
Util.uint256ToString(yOffset)
],
_fill: "white" ,
_attributes: ""
}),
Util.bytes32ToString(_text)
)
;
}
}
File 14 of 16: TextOf.sol
pragma solidity >=0.8.0;
import {Util } from "./Util.sol" ;
import {SVG } from "./SVG.sol" ;
library TextOf {
function render (bytes32 _text ) internal pure returns (string memory ) {
return
SVG.element(
"text" ,
SVG.textAttributes({
_fontSize: "26" ,
_fontFamily: "Norw, 'Courier New', monospace" ,
_coords: ["499" , "605" ],
_fill: "white" ,
_attributes: 'text-anchor="end"'
}),
Util.bytes32ToString(_text)
);
}
}
File 15 of 16: Traits.sol
pragma solidity >=0.8.0;
import {Util } from "./Util.sol" ;
library Traits {
function attributes (bytes32 [] memory _attributeLabels, bytes32 [] memory _attributeValues ) internal pure returns (string memory ) {
string memory result = "[" ;
for (uint i; i < _attributeValues.length ; i+ + ) {
result = string .concat (result, _attribute(string (abi .encodePacked (_attributeLabels[i])), string (abi .encodePacked (_attributeValues[i]))));
}
return string .concat (result, "]" );
}
function _attribute (string memory _traitType, string memory _value ) internal pure returns (string memory ) {
return string .concat ("{" , Util.keyValue("trait_type" , _traitType), "," , Util.keyValue("value" , _value), "}" );
}
}
File 16 of 16: Util.sol
pragma solidity >=0.8.0;
library Util {
error NumberHasTooManyDigits ( ) ;
function quote (string memory value ) internal pure returns (string memory ) {
return string .concat ('"' , value, '" ' );
}
function keyValue (string memory _key, string memory _value ) internal pure returns (string memory ) {
return string .concat ('"' , _key, '":"' , _value, '"' );
}
function keyValueNoQuotes (string memory _key, string memory _value ) internal pure returns (string memory ) {
return string .concat ('"' , _key, '":' , _value);
}
function uint256ToString (uint256 _tokenId, uint8 _digits ) internal pure returns (string memory result ) {
uint256 max = 10 * * _digits;
if (_tokenId > = max) revert NumberHasTooManyDigits();
result = uint256ToString(_tokenId + max);
assembly {
result := add (result, 1 )
mstore (result, _digits)
}
}
function uint256ToString (uint256 _value ) internal pure returns (string memory result ) {
if (_value = = 0 ) return "0" ;
assembly {
result := add (mload (0x40 ), 110 )
mstore (0x40 , result)
let digits := 0
for {
} gt (_value, 0 ) {
} {
digits := add (digits, 1 )
result := sub (result, 1 )
let c := add (mod (_value, 10 ), 48 )
mstore8 (result, c)
_value := div (_value, 10 )
}
result := sub (result, 32 )
mstore (result, digits)
}
}
function bytes1ToString (bytes1 _value ) internal pure returns (string memory ) {
return uint256ToString(uint8 (_value));
}
function uint8ToString (uint8 _value ) internal pure returns (string memory ) {
return uint256ToString(_value);
}
function stringToUint256 (string memory _value ) internal pure returns (uint256 result ) {
bytes memory value = bytes (_value);
if (value.length = = 0 ) return 0 ;
uint256 multiplier = 10 * * (value.length - 1 );
uint256 i;
while (multiplier ! = 0 ) {
result + = uint256 ((uint8 (value[i]) - 48 )) * multiplier;
unchecked {
multiplier / = 10 ;
+ + i;
}
}
}
function bytes1ToHex (bytes1 _value ) internal pure returns (string memory ) {
bytes memory result = new bytes (2 );
uint8 x = uint8 (_value);
result[0 ] = getHexChar(x > > 4 );
result[1 ] = getHexChar(x % 16 );
return string (result);
}
function bytes32ToBytes (bytes32 x ) internal pure returns (bytes memory ) {
bytes memory bytesString = new bytes (32 );
for (uint i = 0 ; i < 32 ; i+ + ) {
if (x[i] = = 0 ) {
bytesString[i] = bytes1 (0x20 );
} else {
bytesString[i] = x[i];
}
}
return abi .encodePacked (bytesString);
}
function bytes32ToString (bytes32 x ) internal pure returns (string memory ) {
return string (bytes32ToBytes(x));
}
function getHexChar (uint8 _value ) internal pure returns (bytes1 ) {
if (_value < 10 ) {
return bytes1 (_value + 48 );
}
_value - = 10 ;
return bytes1 (_value + 97 );
}
function stringToBytes1 (string memory _value ) internal pure returns (bytes1 result ) {
return bytes1 (uint8 (stringToUint256(_value)));
}
function getRGBString (bytes memory _palette, uint256 _pos ) internal pure returns (string memory result ) {
return
string .concat (
"#" ,
Util.bytes1ToHex(_palette[3 * _pos]),
Util.bytes1ToHex(_palette[3 * _pos + 1 ]),
Util.bytes1ToHex(_palette[3 * _pos + 2 ])
);
}
function getRGBString (bytes3 _color ) internal pure returns (string memory result ) {
return
string .concat (
"#" ,
Util.bytes1ToHex(_color[0 ]),
Util.bytes1ToHex(_color[1 ]),
Util.bytes1ToHex(_color[2 ])
);
}
}
{
"compilationTarget" : {
"contracts/Beef.sol" : "Beef"
} ,
"evmVersion" : "paris" ,
"libraries" : { } ,
"metadata" : {
"bytecodeHash" : "ipfs" ,
"useLiteralContent" : true
} ,
"optimizer" : {
"enabled" : true ,
"runs" : 2000000
} ,
"remappings" : [ ]
} [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Codependent","type":"error"},{"inputs":[],"name":"CurrentlyClosed","type":"error"},{"inputs":[],"name":"HalfOfTheTime","type":"error"},{"inputs":[],"name":"MutuallyExclusive","type":"error"},{"inputs":[],"name":"NoBeef","type":"error"},{"inputs":[],"name":"NotChromatic","type":"error"},{"inputs":[],"name":"NotCoinbase","type":"error"},{"inputs":[],"name":"NotContinuous","type":"error"},{"inputs":[],"name":"NotContract","type":"error"},{"inputs":[],"name":"NotDark","type":"error"},{"inputs":[],"name":"NotFairPrice","type":"error"},{"inputs":[],"name":"NotLight","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","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":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":"id","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"artist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyAtFairPrice","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"decreasable","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decrease","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"editionSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fairPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"increasable","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"increase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOpenHours","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"renderSVG","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"renderSVGBase64","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"retract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"_editionTokenRangeStart","type":"uint256"},{"internalType":"uint256","name":"_editionSize","type":"uint256"},{"internalType":"bytes32","name":"_title","type":"bytes32"},{"internalType":"bytes32[]","name":"_bodyText","type":"bytes32[]"},{"internalType":"bytes32[]","name":"_smallPrintText","type":"bytes32[]"},{"internalType":"bytes32[]","name":"_statusText","type":"bytes32[]"}],"internalType":"struct ConceptStruct.Concept[]","name":"_concepts","type":"tuple[]"}],"name":"setConceptData","outputs":[],"stateMutability":"nonpayable","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":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transfersLeft","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateTransitory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"whereIs","outputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"},{"internalType":"uint256","name":"z","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address payable","name":"_to","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]