Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
CircumnavigationURI
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 1500 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity 0.8.4; import "./AggregatorV3Interface.sol"; import "./ICircumnavigationURI.sol"; contract CircumnavigationURI is ICircumnavigationURI { struct CircumnavigationIIIUri { string wagmi; string ngmi; } // holds the uris for Circumnavigation III Gold, Silver, and Bronze (both states for each) CircumnavigationIIIUri[] private cIIIUris; AggregatorV3Interface private btcPriceFeed = AggregatorV3Interface(0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c); AggregatorV3Interface private ethPriceFeed = AggregatorV3Interface(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419); uint80 private roundInterval = 5; // ~once an hour constructor() { // Populates the uris for Circumnavigation III // index 0: gold cIIIUris.push( CircumnavigationIIIUri({ wagmi: "https://ipfs.io/ipfs/QmZveSf2iM4FwJ5ZtioKaxFWsgg1WpfpmpX8n42dB5yd3Q", ngmi: "https://ipfs.io/ipfs/QmXrpgyz1JZp7LebmsPJjUEYfVC7iA99Q11GiDSZdGSdYM" }) ); // index 1: silver cIIIUris.push( CircumnavigationIIIUri({ wagmi: "https://ipfs.io/ipfs/QmcgpNcUQPkpzHwVKPe9X6PBjgjHV87d26JwKaas6oJUYb", ngmi: "https://ipfs.io/ipfs/Qmc7fYRBwS9coYVYBv36D79j4v1jsWQdSS2KVwPpfY9Soo" }) ); // index 2: bronze cIIIUris.push( CircumnavigationIIIUri({ wagmi: "https://ipfs.io/ipfs/QmbCniBY2tEQ46a5vtiuFArt8d2aeVzxpyeTdaBetVjKev", ngmi: "https://ipfs.io/ipfs/QmeCJf1aEhh9d56UcNFrAd9tHnVFbtSLxM2pPd66LSKYJm" }) ); } /** * get the price for 0: BTC, 1: ETH * This should be the only function that needs to be duplicated if Open Editions * and drawings are still on a separate contract */ function getPrice(uint8 priceType) private view returns (uint256, uint256) { AggregatorV3Interface feed = priceType == 0 ? btcPriceFeed : ethPriceFeed; // current price data (uint80 roundId, int256 answer, , , ) = feed.latestRoundData(); uint256 current = uint256(answer) / (10**uint256(feed.decimals())); // previous price data (, int256 prevAnswer, , , ) = feed.getRoundData( roundId - roundInterval ); uint256 prev = uint256(prevAnswer) / (10**uint256(feed.decimals())); return (prev, current); } /** * Returns the token uri for Circumnavigation I (OE) * */ function cITokenURI() external view override returns (string memory) { (uint256 prevBTC, uint256 currentBTC) = getPrice(0); (uint256 prevETH, uint256 currentETH) = getPrice(1); // Both up if (currentBTC > prevBTC && currentETH > prevETH) return "https://ipfs.io/ipfs/Qmbr7w9D5gTuQyajGRxgG2xLcEQUffLXa3DcYcdweXC5ff"; // BTC up ETH down if (currentBTC > prevBTC && prevETH > currentETH) return "https://ipfs.io/ipfs/QmVp3dGZbnHpzbBJP56NyDnvCWx43w3bQYYuSZ7TMpUWQZ"; // ETH up BTC down if (prevBTC > currentBTC && currentETH > prevETH) return "https://ipfs.io/ipfs/QmYoeAvKYtiLoX7ASBabBS82m48zKuxa8gapBXVE35dMJB"; // Both down return "https://ipfs.io/ipfs/QmVsmdjgL4KQFmUANhcc5PUVGkSyFyZKAaBpZKEPJHREBa"; } /** * Returns the token uri for Circumnavigation II (GM, GA, GN) */ function cIITokenURI() external view override returns (string memory) { uint8 hour = uint8((block.timestamp / 60 / 60) % 24); // GM (morning) if (hour >= 5 && hour < 12) return "https://ipfs.io/ipfs/QmW4iZGe7ERjtAof3ikSqya4tySHZtUZ9J31yYNLrmSMBE"; // GA (afternoon) if (hour >= 12 && hour <= 17) return "https://ipfs.io/ipfs/QmNeGtVLr6GCvNrJ1wrL1M4ypdhKWViRsButyW6qkaq4TW"; // GN (night) return "https://ipfs.io/ipfs/QmczyDnpaRshUnH9cLs6QEcqi9K4xh4aDZwavBj9UgdL7D"; } /** * Returns the token uri for Circumnavigation III (WAGMI/NGMI) * niftyType 0: Gold * niftyType 1: Silver * niftyType 2: Bronze */ function cIIITokenURI(uint8 niftyType) external view override returns (string memory) { (uint256 prevBTC, uint256 currentBTC) = getPrice(0); (uint256 prevETH, uint256 currentETH) = getPrice(1); if (currentBTC + currentETH >= prevBTC + prevETH) return cIIIUris[niftyType].wagmi; return cIIIUris[niftyType].ngmi; } /** * Returns the token uri for Circumnavigation I (one of one) */ function cIOneOfOneTokenURI() external pure override returns (string memory) { return "https://ipfs.io/ipfs/QmUUbqDQdAXAKvXbJpNs1hk9Gbq35AEYTnoAUhbJ8NGfZC"; } /** * Returns the token uri for Circumnavigation II (one of one) */ function cIIOneOfOneTokenURI() external pure override returns (string memory) { return "https://ipfs.io/ipfs/QmcPFA4r3J9LcGXA1vCeJs86QsoiccmJhnC2joKFPod9z5"; } }
pragma solidity 0.8.4; // Part: smartcontractkit/[email protected]/AggregatorV3Interface // Interface declaration would need to be in both Open Edition and Drawings contracts interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
pragma solidity 0.8.4; interface ICircumnavigationURI { function cITokenURI() external view returns (string memory); function cIITokenURI() external view returns (string memory); function cIIITokenURI(uint8 niftyType) external view returns (string memory); function cIOneOfOneTokenURI() external view returns (string memory); function cIIOneOfOneTokenURI() external view returns (string memory); }
{ "optimizer": { "enabled": true, "runs": 1500 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint8","name":"niftyType","type":"uint8"}],"name":"cIIITokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cIIOneOfOneTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"cIITokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cIOneOfOneTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"cITokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6080604052600180546001600160a01b03191673f4030086522a5beea4988f8ca5b36dbc97bee88c1790556002805474055f4ec3df9cbd43714fe2740f5e3616155c5b84196001600160f01b03199091161790553480156200006057600080fd5b506040805160c081018252604391810182815260009282919062000f44606084013981526020016040518060800160405280604381526020016200100d60439139905281546001810183556000928352602092839020825180519394600290930290910192620000d4928492019062000226565b506020828101518051620000ef926001850192019062000226565b505050600060405180604001604052806040518060800160405280604381526020016200109360439139815260200160405180608001604052806043815260200162001050604391399052815460018101835560009283526020928390208251805193946002909302909101926200016b928492019062000226565b50602082810151805162000186926001850192019062000226565b5050506000604051806040016040528060405180608001604052806043815260200162000f8760439139815260200160405180608001604052806043815260200162000fca6043913990528154600181018355600092835260209283902082518051939460029093029091019262000202928492019062000226565b5060208281015180516200021d926001850192019062000226565b50505062000309565b8280546200023490620002cc565b90600052602060002090601f016020900481019282620002585760008555620002a3565b82601f106200027357805160ff1916838001178555620002a3565b82800160010185558215620002a3579182015b82811115620002a357825182559160200191906001019062000286565b50620002b1929150620002b5565b5090565b5b80821115620002b15760008155600101620002b6565b600181811c90821680620002e157607f821691505b602082108114156200030357634e487b7160e01b600052602260045260246000fd5b50919050565b610c2b80620003196000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c8063382d1d0d11610050578063382d1d0d1461009d578063b89ca698146100a5578063f596320e146100ad57600080fd5b80631f2312021461006c57806331cf05521461008a575b600080fd5b6100746100b5565b6040516100819190610776565b60405180910390f35b6100746100983660046106e8565b6100d5565b61007461021c565b6100746102da565b6100746103bf565b6060604051806080016040528060438152602001610a6460439139905090565b60606000806100e460006103df565b915091506000806100f560016103df565b909250905061010482856107c9565b61010e82856107c9565b106101dc5760008660ff168154811061013757634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020160000180546101539061090d565b80601f016020809104026020016040519081016040528092919081815260200182805461017f9061090d565b80156101cc5780601f106101a1576101008083540402835291602001916101cc565b820191906000526020600020905b8154815290600101906020018083116101af57829003601f168201915b5050505050945050505050919050565b60008660ff168154811061020057634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020160010180546101539061090d565b606060006018603c61022e81426107e1565b61023891906107e1565b6102429190610948565b905060058160ff161015801561025b5750600c8160ff16105b1561027f57604051806080016040528060438152602001610aa76043913991505090565b600c8160ff1610158015610297575060118160ff1611155b156102bb57604051806080016040528060438152602001610bb36043913991505090565b6040518060800160405280604381526020016109de6043913991505090565b60606000806102e960006103df565b915091506000806102fa60016103df565b91509150838311801561030c57508181115b1561033357604051806080016040528060438152602001610aea6043913994505050505090565b838311801561034157508082115b156103685760405180608001604052806043815260200161099b6043913994505050505090565b828411801561037657508181115b1561039d57604051806080016040528060438152602001610b706043913994505050505090565b604051806080016040528060438152602001610a216043913994505050505090565b6060604051806080016040528060438152602001610b2d60439139905090565b6000808060ff84161561040a5760025473ffffffffffffffffffffffffffffffffffffffff16610424565b60015473ffffffffffffffffffffffffffffffffffffffff165b90506000808273ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561046f57600080fd5b505afa158015610483573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a7919061070b565b5050509150915060008373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156104f657600080fd5b505afa15801561050a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052e919061075a565b61053c9060ff16600a610838565b61054690836107e1565b905060008473ffffffffffffffffffffffffffffffffffffffff16639a6fc8f5600260149054906101000a900469ffffffffffffffffffff168661058a91906108e2565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815269ffffffffffffffffffff909116600482015260240160a06040518083038186803b1580156105e457600080fd5b505afa1580156105f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061c919061070b565b50505091505060008573ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561066a57600080fd5b505afa15801561067e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a2919061075a565b6106b09060ff16600a610838565b6106ba90836107e1565b99929850919650505050505050565b805169ffffffffffffffffffff811681146106e357600080fd5b919050565b6000602082840312156106f9578081fd5b813561070481610988565b9392505050565b600080600080600060a08688031215610722578081fd5b61072b866106c9565b945060208601519350604086015192506060860151915061074e608087016106c9565b90509295509295909350565b60006020828403121561076b578081fd5b815161070481610988565b6000602080835283518082850152825b818110156107a257858101830151858201604001528201610786565b818111156107b35783604083870101525b50601f01601f1916929092016040019392505050565b600082198211156107dc576107dc61095c565b500190565b6000826107f0576107f0610972565b500490565b600181815b808511156108305781600019048211156108165761081661095c565b8085161561082357918102915b93841c93908002906107fa565b509250929050565b6000610704838360008261084e575060016108dc565b8161085b575060006108dc565b8160018114610871576002811461087b57610897565b60019150506108dc565b60ff84111561088c5761088c61095c565b50506001821b6108dc565b5060208310610133831016604e8410600b84101617156108ba575081810a6108dc565b6108c483836107f5565b80600019048211156108d8576108d861095c565b0290505b92915050565b600069ffffffffffffffffffff838116908316818110156109055761090561095c565b039392505050565b600181811c9082168061092157607f821691505b6020821081141561094257634e487b7160e01b600052602260045260246000fd5b50919050565b60008261095757610957610972565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b60ff8116811461099757600080fd5b5056fe68747470733a2f2f697066732e696f2f697066732f516d56703364475a626e48707a62424a5035364e79446e76435778343377336251595975535a37544d705557515a68747470733a2f2f697066732e696f2f697066732f516d637a79446e7061527368556e4839634c73365145637169394b3478683461445a776176426a395567644c374468747470733a2f2f697066732e696f2f697066732f516d56736d646a674c344b51466d55414e68636335505556476b537946795a4b416142705a4b45504a485245426168747470733a2f2f697066732e696f2f697066732f516d635046413472334a394c63475841317643654a73383651736f6963636d4a686e43326a6f4b46506f64397a3568747470733a2f2f697066732e696f2f697066732f516d5734695a47653745526a74416f6633696b5371796134747953485a74555a394a333179594e4c726d534d424568747470733a2f2f697066732e696f2f697066732f516d627237773944356754755179616a475278674732784c6345515566664c58613344635963647765584335666668747470733a2f2f697066732e696f2f697066732f516d555562714451644158414b7658624a704e7331686b394762713335414559546e6f415568624a384e47665a4368747470733a2f2f697066732e696f2f697066732f516d596f6541764b5974694c6f58374153426162425338326d34387a4b75786138676170425856453335644d4a4268747470733a2f2f697066732e696f2f697066732f516d4e654774564c72364743764e724a3177724c314d34797064684b5756695273427574795736716b6171345457a2646970667358221220a4c00b8087453def9030304032d5bb0e040901b7b49760c699b4ea8e00d62cbb64736f6c6343000804003368747470733a2f2f697066732e696f2f697066732f516d5a7665536632694d3446774a355a74696f4b6178465773676731577066706d7058386e34326442357964335168747470733a2f2f697066732e696f2f697066732f516d62436e694259327445513436613576746975464172743864326165567a78707965546461426574566a4b657668747470733a2f2f697066732e696f2f697066732f516d65434a6631614568683964353655634e467241643974486e56466274534c784d3270506436364c534b594a6d68747470733a2f2f697066732e696f2f697066732f516d58727067797a314a5a70374c65626d73504a6a5545596656433769413939513131476944535a64475364594d68747470733a2f2f697066732e696f2f697066732f516d633766595242775339636f595659427633364437396a3476316a735751645353324b56775070665939536f6f68747470733a2f2f697066732e696f2f697066732f516d6367704e635551506b707a4877564b506539583650426a676a485638376432364a774b616173366f4a555962
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100675760003560e01c8063382d1d0d11610050578063382d1d0d1461009d578063b89ca698146100a5578063f596320e146100ad57600080fd5b80631f2312021461006c57806331cf05521461008a575b600080fd5b6100746100b5565b6040516100819190610776565b60405180910390f35b6100746100983660046106e8565b6100d5565b61007461021c565b6100746102da565b6100746103bf565b6060604051806080016040528060438152602001610a6460439139905090565b60606000806100e460006103df565b915091506000806100f560016103df565b909250905061010482856107c9565b61010e82856107c9565b106101dc5760008660ff168154811061013757634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020160000180546101539061090d565b80601f016020809104026020016040519081016040528092919081815260200182805461017f9061090d565b80156101cc5780601f106101a1576101008083540402835291602001916101cc565b820191906000526020600020905b8154815290600101906020018083116101af57829003601f168201915b5050505050945050505050919050565b60008660ff168154811061020057634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020160010180546101539061090d565b606060006018603c61022e81426107e1565b61023891906107e1565b6102429190610948565b905060058160ff161015801561025b5750600c8160ff16105b1561027f57604051806080016040528060438152602001610aa76043913991505090565b600c8160ff1610158015610297575060118160ff1611155b156102bb57604051806080016040528060438152602001610bb36043913991505090565b6040518060800160405280604381526020016109de6043913991505090565b60606000806102e960006103df565b915091506000806102fa60016103df565b91509150838311801561030c57508181115b1561033357604051806080016040528060438152602001610aea6043913994505050505090565b838311801561034157508082115b156103685760405180608001604052806043815260200161099b6043913994505050505090565b828411801561037657508181115b1561039d57604051806080016040528060438152602001610b706043913994505050505090565b604051806080016040528060438152602001610a216043913994505050505090565b6060604051806080016040528060438152602001610b2d60439139905090565b6000808060ff84161561040a5760025473ffffffffffffffffffffffffffffffffffffffff16610424565b60015473ffffffffffffffffffffffffffffffffffffffff165b90506000808273ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561046f57600080fd5b505afa158015610483573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a7919061070b565b5050509150915060008373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156104f657600080fd5b505afa15801561050a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052e919061075a565b61053c9060ff16600a610838565b61054690836107e1565b905060008473ffffffffffffffffffffffffffffffffffffffff16639a6fc8f5600260149054906101000a900469ffffffffffffffffffff168661058a91906108e2565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815269ffffffffffffffffffff909116600482015260240160a06040518083038186803b1580156105e457600080fd5b505afa1580156105f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061c919061070b565b50505091505060008573ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561066a57600080fd5b505afa15801561067e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a2919061075a565b6106b09060ff16600a610838565b6106ba90836107e1565b99929850919650505050505050565b805169ffffffffffffffffffff811681146106e357600080fd5b919050565b6000602082840312156106f9578081fd5b813561070481610988565b9392505050565b600080600080600060a08688031215610722578081fd5b61072b866106c9565b945060208601519350604086015192506060860151915061074e608087016106c9565b90509295509295909350565b60006020828403121561076b578081fd5b815161070481610988565b6000602080835283518082850152825b818110156107a257858101830151858201604001528201610786565b818111156107b35783604083870101525b50601f01601f1916929092016040019392505050565b600082198211156107dc576107dc61095c565b500190565b6000826107f0576107f0610972565b500490565b600181815b808511156108305781600019048211156108165761081661095c565b8085161561082357918102915b93841c93908002906107fa565b509250929050565b6000610704838360008261084e575060016108dc565b8161085b575060006108dc565b8160018114610871576002811461087b57610897565b60019150506108dc565b60ff84111561088c5761088c61095c565b50506001821b6108dc565b5060208310610133831016604e8410600b84101617156108ba575081810a6108dc565b6108c483836107f5565b80600019048211156108d8576108d861095c565b0290505b92915050565b600069ffffffffffffffffffff838116908316818110156109055761090561095c565b039392505050565b600181811c9082168061092157607f821691505b6020821081141561094257634e487b7160e01b600052602260045260246000fd5b50919050565b60008261095757610957610972565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b60ff8116811461099757600080fd5b5056fe68747470733a2f2f697066732e696f2f697066732f516d56703364475a626e48707a62424a5035364e79446e76435778343377336251595975535a37544d705557515a68747470733a2f2f697066732e696f2f697066732f516d637a79446e7061527368556e4839634c73365145637169394b3478683461445a776176426a395567644c374468747470733a2f2f697066732e696f2f697066732f516d56736d646a674c344b51466d55414e68636335505556476b537946795a4b416142705a4b45504a485245426168747470733a2f2f697066732e696f2f697066732f516d635046413472334a394c63475841317643654a73383651736f6963636d4a686e43326a6f4b46506f64397a3568747470733a2f2f697066732e696f2f697066732f516d5734695a47653745526a74416f6633696b5371796134747953485a74555a394a333179594e4c726d534d424568747470733a2f2f697066732e696f2f697066732f516d627237773944356754755179616a475278674732784c6345515566664c58613344635963647765584335666668747470733a2f2f697066732e696f2f697066732f516d555562714451644158414b7658624a704e7331686b394762713335414559546e6f415568624a384e47665a4368747470733a2f2f697066732e696f2f697066732f516d596f6541764b5974694c6f58374153426162425338326d34387a4b75786138676170425856453335644d4a4268747470733a2f2f697066732e696f2f697066732f516d4e654774564c72364743764e724a3177724c314d34797064684b5756695273427574795736716b6171345457a2646970667358221220a4c00b8087453def9030304032d5bb0e040901b7b49760c699b4ea8e00d62cbb64736f6c63430008040033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.