Address Contract Verified
Address
0x29c0eAedd6F8330413070368F6437F6F2809d5e9
Balance
0 ETH
Nonce
1
Code Size
9223 bytes
Creator
0x66De7D87...c176 at tx 0x49e9efb0...a5b324
Indexed Transactions
0
Contract Bytecode
9223 bytes
0x608060405234801561001057600080fd5b50600436106102115760003560e01c806374bbc53811610125578063b88d4fde116100ad578063dd62ed3e1161007c578063dd62ed3e146104c1578063e0df5b6f146104ec578063e985e9c5146104ff578063f28ca1dd1461052d578063f2fde38b1461053557600080fd5b8063b88d4fde14610480578063c87b56dd14610493578063d547cfb7146104a6578063d7a71868146104ae57600080fd5b806395d89b41116100f457806395d89b41146104265780639b19251a1461042e578063a22cb46514610451578063a2c9d63014610464578063a9059cbb1461046d57600080fd5b806374bbc538146103e5578063827858a4146103ed5780638ac9feff146104005780638da5cb5b1461041357600080fd5b80632b968958116101a85780634f02c420116101775780634f02c42014610383578063504334c21461038c57806353d6fd591461039f5780636352211e146103b257806370a08231146103c557600080fd5b80632b9689581461031c578063313ce567146103245780633fc8cef31461035d57806342842e0e1461037057600080fd5b80631755ff21116101e45780631755ff21146102ac57806318160ddd146102bf57806318d217c3146102f457806323b872dd1461030957600080fd5b806306fdde03146102165780630761581514610234578063081812fc14610258578063095ea7b314610299575b600080fd5b61021e610548565b60405161022b919061192b565b60405180910390f35b600f5461024890600160a01b900460ff1681565b604051901515815260200161022b565b61028161026636600461195e565b6006602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161022b565b6102486102a736600461198f565b6105d6565b600f54610281906001600160a01b031681565b6102e67f00000000000000000000000000000000000000000000000d8d726b7177a8000081565b60405190815260200161022b565b610307610302366004611a5e565b610727565b005b610307610317366004611a9b565b610761565b610307610aea565b61034b7f000000000000000000000000000000000000000000000000000000000000001281565b60405160ff909116815260200161022b565b600e54610281906001600160a01b031681565b61030761037e366004611a9b565b610b50565b6102e660035481565b61030761039a366004611adc565b610c25565b6103076103ad366004611b4e565b610c59565b6102816103c036600461195e565b610cae565b6102e66103d3366004611b87565b60046020526000908152604090205481565b6102e6610ce9565b6103076103fb366004611ba4565b610ddc565b61030761040e366004611b87565b610e24565b600054610281906001600160a01b031681565b61021e610e70565b61024861043c366004611b87565b600b6020526000908152604090205460ff1681565b61030761045f366004611b4e565b610e7d565b6102e660105481565b61024861047b36600461198f565b610ee9565b61030761048e366004611bc1565b610efd565b61021e6104a136600461195e565b610fc0565b61021e61122e565b6103076104bc36600461195e565b61123b565b6102e66104cf366004611c60565b600560209081526000928352604080842090915290825290205481565b6103076104fa366004611a5e565b61127d565b61024861050d366004611c60565b600760209081526000928352604080842090915290825290205460ff1681565b61021e6112b3565b610307610543366004611b87565b6112c0565b6001805461055590611c8e565b80601f016020809104026020016040519081016040528092919081815260200182805461058190611c8e565b80156105ce5780601f106105a3576101008083540402835291602001916105ce565b820191906000526020600020905b8154815290600101906020018083116105b157829003601f168201915b505050505081565b600060035482111580156105ea5750600082115b156106c1576000828152600860205260409020546001600160a01b031633811480159061063b57506001600160a01b038116600090815260076020908152604080832033845290915290205460ff16155b15610658576040516282b42960e81b815260040160405180910390fd5b60008381526006602090815260409182902080546001600160a01b0319166001600160a01b038881169182179092559251868152908416917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35061071d565b3360008181526005602090815260408083206001600160a01b03881680855290835292819020869055518581529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35b5060015b92915050565b6000546001600160a01b03163314610751576040516282b42960e81b815260040160405180910390fd5b600c61075d8282611d16565b5050565b6003548111610a7b576000818152600860205260409020546001600160a01b038481169116146107a457604051636edaef2f60e11b815260040160405180910390fd5b6001600160a01b0382166107cb57604051634e46966960e11b815260040160405180910390fd5b336001600160a01b0384161480159061080857506001600160a01b038316600090815260076020908152604080832033845290915290205460ff16155b801561082b57506000818152600660205260409020546001600160a01b03163314155b15610848576040516282b42960e81b815260040160405180910390fd5b61085061135c565b6001600160a01b03841660009081526004602052604081208054909190610878908490611dec565b90915550610886905061135c565b6001600160a01b03808416600081815260046020908152604080832080549096019095558582526008815284822080546001600160a01b0319908116909417905560068152848220805490931690925591861682526009905290812080546108f090600190611dec565b8154811061090057610900611dff565b60009182526020808320909101546001600160a01b0387168352600982526040808420868552600a9093529092205481549293508392811061094457610944611dff565b60009182526020808320909101929092556001600160a01b038616815260099091526040902080548061097957610979611e15565b600082815260208082208301600019908101839055909201909255838252600a8152604080832054848452818420556001600160a01b0386168084526009835290832080546001818101835582865293852001869055925290546109dd9190611dec565b6000838152600a602052604080822092909255905183916001600160a01b0380871692908816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4826001600160a01b0316846001600160a01b03167fe59fdd36d0d223c0c7d996db7ad796880f45e1936cb0bb7ac102e7082e031487610a6461135c565b60405190815260200160405180910390a350505050565b6001600160a01b03831660009081526005602090815260408083203384529091529020546000198114610ad757610ab28282611dec565b6001600160a01b03851660009081526005602090815260408083203384529091529020555b610ae284848461138e565b50505b505050565b6000546001600160a01b03163314610b14576040516282b42960e81b815260040160405180910390fd5b600080546001600160a01b031916815560405133907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3565b610b5b838383610761565b6001600160a01b0382163b15801590610c075750604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af1158015610bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfa9190611e2b565b6001600160e01b03191614155b15610ae557604051633da6393160e01b815260040160405180910390fd5b6000546001600160a01b03163314610c4f576040516282b42960e81b815260040160405180910390fd5b61075d8282611550565b6000546001600160a01b03163314610c83576040516282b42960e81b815260040160405180910390fd5b6001600160a01b03919091166000908152600b60205260409020805460ff1916911515919091179055565b6000818152600860205260409020546001600160a01b031680610ce45760405163c5723b5160e01b815260040160405180910390fd5b919050565b600f54600090600160a01b900460ff16610dd557600f5460408051633850c7bd60e01b815290516001600160a01b03909216916000918391633850c7bd9160048082019260e0929091908290030181865afa158015610d4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d709190611e67565b505050505050905060006002826001600160a01b0316610d909190611fea565b9050600160c01b811115610db457610dac600160c01b82611ff9565b935050505090565b600160c01b610dcb82670de0b6b3a764000061201b565b610dac9190611ff9565b5060105490565b6000546001600160a01b03163314610e06576040516282b42960e81b815260040160405180910390fd5b600f8054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610e4e576040516282b42960e81b815260040160405180910390fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6002805461055590611c8e565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000610ef633848461138e565b9392505050565b610f08858585610761565b6001600160a01b0384163b15801590610fa25750604051630a85bd0160e11b808252906001600160a01b0386169063150b7a0290610f529033908a90899089908990600401612032565b6020604051808303816000875af1158015610f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f959190611e2b565b6001600160e01b03191614155b15610ae257604051633da6393160e01b815260040160405180910390fd5b60606000600d8054610fd190611c8e565b9050111561100b57600d610fe483611569565b604051602001610ff5929190612086565b6040516020818303038152906040529050919050565b606080600061101985611569565b90506000611025610ce9565b9050673782dace9d90000081116110735781604051602001611047919061210d565b60408051601f19818403018152828201909152600382526214d85960ea1b6020830152945092506110fe565b6801158e460913d0000081116110c357816040516020016110949190612136565b60408051601f198184030181528282019091526006825265139bdc9b585b60d21b6020830152945092506110fe565b816040516020016110d4919061216a565b60408051601f198184030181528282019091526005825264486170707960d81b6020830152945092505b600061110987611569565b604051602001611119919061219d565b60408051601f1981840301815290829052611136916020016121d8565b604051602081830303815290604052600c86604051602001611159929190612086565b60408051601f198184030181529082905261117792916020016122f1565b604051602081830303815290604052905060008460405160200161119b9190612317565b60408051601f1981840301815282820182526004835263227d5d7d60e01b60208481019190915291519093506111d59185918591016122f1565b60408051601f19818403018152908290526111f49183906020016122f1565b60408051601f198184030181529082905261121191602001612373565b604051602081830303815290604052975050505050505050919050565b600d805461055590611c8e565b6000546001600160a01b03163314611265576040516282b42960e81b815260040160405180910390fd5b600f805460ff60a01b1916600160a01b179055601055565b6000546001600160a01b031633146112a7576040516282b42960e81b815260040160405180910390fd5b600d61075d8282611d16565b600c805461055590611c8e565b6000546001600160a01b031633146112ea576040516282b42960e81b815260040160405180910390fd5b6001600160a01b038116611311576040516349e27cff60e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b60006113897f0000000000000000000000000000000000000000000000000000000000000012600a611fea565b905090565b60008061139961135c565b6001600160a01b038087166000818152600460205260408082208054948a16835290822054928252939450919290918691906113d58386611dec565b90915550506001600160a01b03808716600090815260046020908152604080832080548a019055928a168252600b9052205460ff16611471576001600160a01b038716600090815260046020526040812054611432908590611ff9565b61143c8585611ff9565b6114469190611dec565b905060005b8181101561146e5761145c896115fc565b80611466816123b8565b91505061144b565b50505b6001600160a01b0386166000908152600b602052604090205460ff166114f657600061149d8483611ff9565b6001600160a01b0388166000908152600460205260409020546114c1908690611ff9565b6114cb9190611dec565b905060005b818110156114f3576114e188611724565b806114eb816123b8565b9150506114d0565b50505b856001600160a01b0316876001600160a01b03167fe59fdd36d0d223c0c7d996db7ad796880f45e1936cb0bb7ac102e7082e0314878760405161153b91815260200190565b60405180910390a35060019695505050505050565b600161155c8382611d16565b506002610ae58282611d16565b606060006115768361182f565b600101905060008167ffffffffffffffff811115611596576115966119bb565b6040519080825280601f01601f1916602001820160405280156115c0576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846115ca57509392505050565b6001600160a01b03811661162357604051636edaef2f60e11b815260040160405180910390fd5b6001600160a01b0381166000908152600960205260408120805461164990600190611dec565b8154811061165957611659611dff565b9060005260206000200154905060096000836001600160a01b03166001600160a01b0316815260200190815260200160002080548061169a5761169a611e15565b600082815260208082208301600019908101839055909201909255828252600a815260408083208390556008825280832080546001600160a01b031990811690915560069092528083208054909216909155518291906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b03811661174b57604051634e46966960e11b815260040160405180910390fd5b60038054600101908190556000818152600860205260409020546001600160a01b03161561178c5760405163119b4fd360e11b815260040160405180910390fd5b600081815260086020908152604080832080546001600160a01b0319166001600160a01b0387169081179091558084526009835290832080546001818101835582865293852001859055925290546117e49190611dec565b6000828152600a602052604080822092909255905182916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061186e5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061189a576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106118b857662386f26fc10000830492506010015b6305f5e10083106118d0576305f5e100830492506008015b61271083106118e457612710830492506004015b606483106118f6576064830492506002015b600a83106107215760010192915050565b60005b8381101561192257818101518382015260200161190a565b50506000910152565b602081526000825180602084015261194a816040850160208701611907565b601f01601f19169190910160400192915050565b60006020828403121561197057600080fd5b5035919050565b6001600160a01b038116811461198c57600080fd5b50565b600080604083850312156119a257600080fd5b82356119ad81611977565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126119e257600080fd5b813567ffffffffffffffff808211156119fd576119fd6119bb565b604051601f8301601f19908116603f01168101908282118183101715611a2557611a256119bb565b81604052838152866020858801011115611a3e57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600060208284031215611a7057600080fd5b813567ffffffffffffffff811115611a8757600080fd5b611a93848285016119d1565b949350505050565b600080600060608486031215611ab057600080fd5b8335611abb81611977565b92506020840135611acb81611977565b929592945050506040919091013590565b60008060408385031215611aef57600080fd5b823567ffffffffffffffff80821115611b0757600080fd5b611b13868387016119d1565b93506020850135915080821115611b2957600080fd5b50611b36858286016119d1565b9150509250929050565b801515811461198c57600080fd5b60008060408385031215611b6157600080fd5b8235611b6c81611977565b91506020830135611b7c81611b40565b809150509250929050565b600060208284031215611b9957600080fd5b8135610ef681611977565b600060208284031215611bb657600080fd5b8135610ef681611b40565b600080600080600060808688031215611bd957600080fd5b8535611be481611977565b94506020860135611bf481611977565b935060408601359250606086013567ffffffffffffffff80821115611c1857600080fd5b818801915088601f830112611c2c57600080fd5b813581811115611c3b57600080fd5b896020828501011115611c4d57600080fd5b9699959850939650602001949392505050565b60008060408385031215611c7357600080fd5b8235611c7e81611977565b91506020830135611b7c81611977565b600181811c90821680611ca257607f821691505b602082108103611cc257634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610ae557600081815260208120601f850160051c81016020861015611cef5750805b601f850160051c820191505b81811015611d0e57828155600101611cfb565b505050505050565b815167ffffffffffffffff811115611d3057611d306119bb565b611d4481611d3e8454611c8e565b84611cc8565b602080601f831160018114611d795760008415611d615750858301515b600019600386901b1c1916600185901b178555611d0e565b600085815260208120601f198616915b82811015611da857888601518255948401946001909101908401611d89565b5085821015611dc65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b8181038181111561072157610721611dd6565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b600060208284031215611e3d57600080fd5b81516001600160e01b031981168114610ef657600080fd5b805161ffff81168114610ce457600080fd5b600080600080600080600060e0888a031215611e8257600080fd5b8751611e8d81611977565b8097505060208801518060020b8114611ea557600080fd5b9550611eb360408901611e55565b9450611ec160608901611e55565b9350611ecf60808901611e55565b925060a088015160ff81168114611ee557600080fd5b60c0890151909250611ef681611b40565b8091505092959891949750929550565b600181815b80851115611f41578160001904821115611f2757611f27611dd6565b80851615611f3457918102915b93841c9390800290611f0b565b509250929050565b600082611f5857506001610721565b81611f6557506000610721565b8160018114611f7b5760028114611f8557611fa1565b6001915050610721565b60ff841115611f9657611f96611dd6565b50506001821b610721565b5060208310610133831016604e8410600b8410161715611fc4575081810a610721565b611fce8383611f06565b8060001904821115611fe257611fe2611dd6565b029392505050565b6000610ef660ff841683611f49565b60008261201657634e487b7160e01b600052601260045260246000fd5b500490565b808202811582820484141761072157610721611dd6565b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290526000828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b600080845461209481611c8e565b600182811680156120ac57600181146120c1576120f0565b60ff19841687528215158302870194506120f0565b8860005260208060002060005b858110156120e75781548a8201529084019082016120ce565b50505082870194505b505050508351612104818360208801611907565b01949350505050565b6000825161211f818460208701611907565b642e6a70656760d81b920191825250600501919050565b60008251612148818460208701611907565b61169960f11b920191825250642e6a70656760d81b6002820152600701919050565b6000825161217c818460208701611907565b612d3360f01b920191825250632e6a706760e01b6002820152600601919050565b717b226e616d65223a20224342756c6c73202360701b815281516000906121cb816012850160208701611907565b9190910160120192915050565b600082516121ea818460208701611907565b7f222c226465736372697074696f6e223a224120636f6c6c656374696f6e206f669201918252507f203235302065766f6c757469766520436f6e66757365642042756c6c7320656e60208201527f61626c6564206279204552433430342c20616e206578706572696d656e74616c60408201527f20746f6b656e207374616e646172642e222c2265787465726e616c5f75726c2260608201527f3a2268747470733a2f2f697066732e696f2f697066732f516d516e367861683160808201527f355567644b594d4466503361664147666f4a715077316f73704e44724167335260a08201527033b9292cb41791161134b6b0b3b2911d1160791b60c082015260d101919050565b60008351612303818460208801611907565b835190830190612104818360208801611907565b7f222c2261747472696275746573223a5b7b2274726169745f74797065223a225481526d3cb8329116113b30b63ab2911d1160911b60208201526000825161236681602e850160208701611907565b91909101602e0192915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c00000000008152600082516123ab81601b850160208701611907565b91909101601b0192915050565b6000600182016123ca576123ca611dd6565b506001019056fea264697066735822122028b17db404ec9e2d8ec524baa47b6c6d7d463708d0019e6e6daf9f89d974cd8a64736f6c63430008130033
Verified Source Code Full Match
Compiler: v0.8.19+commit.7dd6d404
EVM: paris
Optimization: Yes (200 runs)
CBulls.sol 190 lines
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/*
#@# #@#
#@%#@ #@%#@
#@?++@# @?;*#@
#@#*?++## #@*;?*S@#
#@S*++;*@# @%;+++%@@#
#@#??*+;;S@ ##;;;+%?S@#
@@%++*+;:;## #@*:;++++?#@#
@S?%*;++;:+@# @?:;++;+?%%@#
@%?%+;+++;:+@# @?::;++++?%?@#
##++++++++;:;S@SS##########S%%%%?**?*;;+?**?%%%%SS#########SS#@+::+++++;++%@
@%+%++++++;::+S@@@SS%SS%S#S+;;+;;;;;;;;;+;;;+++;;%#S%SS%SS#@@#*::;+++++;??*@#
@%*S;++++++;::;*%#SSS%%%SS#S*;;+++++++++++++;;;+%##S%%%SSS#S?+::;;+++++;?S*@#
@#+*+;++++++;:::;%#S########*++++++++++++++++++*S########S#;:::;+++++++;*+%@
@%;?*;++++++;;;+#S######S#@@?;+;;;;+;;+;;;;+++#@########%@*;;;++++++;+%+*@#
@?*S*;;+++++++%#%##########SSS?S%%#S%S%%S??#%##########SS#+;+++++;;+S?*#@
@%*++*+;++;+SS%##########S#@##@########@###@###########S%#*;;++;+*+*?@#
@@%*??*;+%#SS###############S##########################S%#S*++??*?#@#
@@S??S##SS###########S#SS#@@#######S#@#S%#SS###########S#@#%?%#@#
##@@@#############@S?%+;:;?S@########?+:::;+?@@#############@@@##
######SS##SS##############%%@@@?:::+S@####@@*;:::::;+?###############S###S######
#@####SS#################S;?##%;;;+++#####@?;+;;;?S*+;?@#################S#####@
#@@##############@######@?;++;++++++#####@?+++;?@@@%*#@#######@#############@@#
#@#############@#######@?;;;++;;;+#@#####@?;;;*##S++###S####@#############@#
#@@#@@@##@@@@@##@###SSS??*;;***S#######S#?**;;+?*SSS####@#@@@@@###@@#@@##
#########SS@@######SS#@S%%#@#SS######SSS@#%%S@#SS###S###@#S#########
#@##########SSSS###############SS#S#########@@
#@#@##########S%?%S#######S%%S##########@#@@
@@#@#######S+:;;;;+%%?%*;;+;:;%@########@@#
@@########:;S#@@S+;;;;;%#@@#*:?@######@@#
@@#@##S@?;+#@@@#++++++%@@@@?;+@###@#@@#
#@@###@S;++*?*++++++++*?*+;;*@####@@#
#@@@#*++;*%%*S%??%??S??S?+;++S@@@#
#@@%+;+%#@#S##%SS%S@##@@S*;;*@@#
#@#?S%%%S@#@####@##S%%%#%S@#
#@@?%??S???S#*??%??%?S@@
#@#%+??*+?%*+??+?S@##
##@?;+;+++;++#@#
#@*+%?*S*+S#
#@#####@@#
PFP collection of 250 evolutionary bulls enabled by ERC404.
https://twitter.com/ConfusedBulls
*/
import "./ERC404/ERC404.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
// import IERC20
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// import String
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
interface IUniswapV3Pool {
function slot0() external view returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint8 feeProtocol,
bool unlocked
);
}
contract CBulls is ERC404 {
string public dataURI;
string public baseTokenURI;
IERC20 public weth;
address public poolAddress;
bool public priceMode = false;
uint256 public manualPrice;
constructor(
address _owner,
address _team,
address _marketing,
address _dev1,
address _dev2,
address _weth
) ERC404("CBulls", "CBULLS", 18, 250, _owner) {
balanceOf[_owner] = 215 ether;
balanceOf[_team] = 6.5 ether;
balanceOf[_marketing] = 22.5 ether;
balanceOf[_dev1] = 3 ether;
balanceOf[_dev2] = 3 ether;
weth = IERC20(_weth);
}
function setDataURI(string memory _dataURI) public onlyOwner {
dataURI = _dataURI;
}
function setTokenURI(string memory _tokenURI) public onlyOwner {
baseTokenURI = _tokenURI;
}
function setNameSymbol(
string memory _name,
string memory _symbol
) public onlyOwner {
_setNameSymbol(_name, _symbol);
}
function getCBullsPrice() public view returns (uint256){
if(!priceMode){
IUniswapV3Pool pool = IUniswapV3Pool(poolAddress);
(uint160 sqrtPriceX96,,,,,,) = pool.slot0();
uint256 priceRatioX96 = uint256(sqrtPriceX96) ** 2;
if (priceRatioX96 > 2**192) {
return priceRatioX96 / (2**192);
} else {
return (priceRatioX96 * 10**18) / (2**192);
}
} else {
return manualPrice;
}
}
function setpoolAddress(address _poolAddress) public onlyOwner {
poolAddress = _poolAddress;
}
function setManualPrice(uint256 _price) public onlyOwner {
priceMode = true;
manualPrice = _price;
}
function setPriceMode(bool _priceMode) public onlyOwner {
priceMode = _priceMode;
}
function tokenURI(uint256 id) public view override returns (string memory) {
if (bytes(baseTokenURI).length > 0) {
return string.concat(baseTokenURI, Strings.toString(id));
} else {
string memory image;
string memory bullType;
string memory idStr = Strings.toString(id);
uint256 cBullsPrice = getCBullsPrice();
// turn id to string
if(cBullsPrice <= 4 ether){
image = string.concat(idStr, ".jpeg");
bullType = "Sad";
} else if (cBullsPrice <= 20 ether){
image = string.concat(idStr, "-2", ".jpeg");
bullType = "Normal";
} else {
image = string.concat(idStr, "-3", ".jpg");
bullType = "Happy";
}
string memory jsonPreImage = string.concat(
string.concat(
string.concat('{"name": "CBulls #', Strings.toString(id)),
'","description":"A collection of 250 evolutive Confused Bulls enabled by ERC404, an experimental token standard.","external_url":"https://ipfs.io/ipfs/QmQn6xah15UgdKYMDfP3afAGfoJqPw1ospNDrAg3RgrRYh/","image":"'
),
string.concat(dataURI, image)
);
string memory jsonPostImage = string.concat(
'","attributes":[{"trait_type":"Type","value":"',
bullType
);
string memory jsonPostTrait = '"}]}';
return
string.concat(
"data:application/json;utf8,",
string.concat(
string.concat(jsonPreImage, jsonPostImage),
jsonPostTrait
)
);
}
}
}
ERC404.sol 394 lines
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
abstract contract Ownable {
event OwnershipTransferred(address indexed user, address indexed newOwner);
error Unauthorized();
error InvalidOwner();
address public owner;
modifier onlyOwner() virtual {
if (msg.sender != owner) revert Unauthorized();
_;
}
constructor(address _owner) {
if (_owner == address(0)) revert InvalidOwner();
owner = _owner;
emit OwnershipTransferred(address(0), _owner);
}
function transferOwnership(address _owner) public virtual onlyOwner {
if (_owner == address(0)) revert InvalidOwner();
owner = _owner;
emit OwnershipTransferred(msg.sender, _owner);
}
function revokeOwnership() public virtual onlyOwner {
owner = address(0);
emit OwnershipTransferred(msg.sender, address(0));
}
}
abstract contract ERC721Receiver {
function onERC721Received(
address,
address,
uint256,
bytes calldata
) external virtual returns (bytes4) {
return ERC721Receiver.onERC721Received.selector;
}
}
/// @notice ERC404
/// A gas-efficient, mixed ERC20 / ERC721 implementation
/// with native liquidity and fractionalization.
///
/// This is an experimental standard designed to integrate
/// with pre-existing ERC20 / ERC721 support as smoothly as
/// possible.
///
/// @dev In order to support full functionality of ERC20 and ERC721
/// supply assumptions are made that slightly constraint usage.
/// Ensure decimals are sufficiently large (standard 18 recommended)
/// as ids are effectively encoded in the lowest range of amounts.
///
/// NFTs are spent on ERC20 functions in a FILO queue, this is by
/// design.
///
abstract contract ERC404 is Ownable {
// Events
event ERC20Transfer(
address indexed from,
address indexed to,
uint256 amount
);
event Approval(
address indexed owner,
address indexed spender,
uint256 amount
);
event Transfer(
address indexed from,
address indexed to,
uint256 indexed id
);
event ERC721Approval(
address indexed owner,
address indexed spender,
uint256 indexed id
);
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
// Errors
error NotFound();
error AlreadyExists();
error InvalidRecipient();
error InvalidSender();
error UnsafeRecipient();
// Metadata
/// @dev Token name
string public name;
/// @dev Token symbol
string public symbol;
/// @dev Decimals for fractional representation
uint8 public immutable decimals;
/// @dev Total supply in fractionalized representation
uint256 public immutable totalSupply;
/// @dev Current mint counter, monotonically increasing to ensure accurate ownership
uint256 public minted;
// Mappings
/// @dev Balance of user in fractional representation
mapping(address => uint256) public balanceOf;
/// @dev Allowance of user in fractional representation
mapping(address => mapping(address => uint256)) public allowance;
/// @dev Approval in native representaion
mapping(uint256 => address) public getApproved;
/// @dev Approval for all in native representation
mapping(address => mapping(address => bool)) public isApprovedForAll;
/// @dev Owner of id in native representation
mapping(uint256 => address) internal _ownerOf;
/// @dev Array of owned ids in native representation
mapping(address => uint256[]) internal _owned;
/// @dev Tracks indices for the _owned mapping
mapping(uint256 => uint256) internal _ownedIndex;
/// @dev Addresses whitelisted from minting / burning for gas savings (pairs, routers, etc)
mapping(address => bool) public whitelist;
// Constructor
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _totalNativeSupply,
address _owner
) Ownable(_owner) {
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _totalNativeSupply * (10 ** decimals);
}
/// @notice Initialization function to set pairs / etc
/// saving gas by avoiding mint / burn on unnecessary targets
function setWhitelist(address target, bool state) public onlyOwner {
whitelist[target] = state;
}
/// @notice Function to find owner of a given native token
function ownerOf(uint256 id) public view virtual returns (address owner) {
owner = _ownerOf[id];
if (owner == address(0)) {
revert NotFound();
}
}
/// @notice tokenURI must be implemented by child contract
function tokenURI(uint256 id) public view virtual returns (string memory);
/// @notice Function for token approvals
/// @dev This function assumes id / native if amount less than or equal to current max id
function approve(
address spender,
uint256 amountOrId
) public virtual returns (bool) {
if (amountOrId <= minted && amountOrId > 0) {
address owner = _ownerOf[amountOrId];
if (msg.sender != owner && !isApprovedForAll[owner][msg.sender]) {
revert Unauthorized();
}
getApproved[amountOrId] = spender;
emit Approval(owner, spender, amountOrId);
} else {
allowance[msg.sender][spender] = amountOrId;
emit Approval(msg.sender, spender, amountOrId);
}
return true;
}
/// @notice Function native approvals
function setApprovalForAll(address operator, bool approved) public virtual {
isApprovedForAll[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
/// @notice Function for mixed transfers
/// @dev This function assumes id / native if amount less than or equal to current max id
function transferFrom(
address from,
address to,
uint256 amountOrId
) public virtual {
if (amountOrId <= minted) {
if (from != _ownerOf[amountOrId]) {
revert InvalidSender();
}
if (to == address(0)) {
revert InvalidRecipient();
}
if (
msg.sender != from &&
!isApprovedForAll[from][msg.sender] &&
msg.sender != getApproved[amountOrId]
) {
revert Unauthorized();
}
balanceOf[from] -= _getUnit();
unchecked {
balanceOf[to] += _getUnit();
}
_ownerOf[amountOrId] = to;
delete getApproved[amountOrId];
// update _owned for sender
uint256 updatedId = _owned[from][_owned[from].length - 1];
_owned[from][_ownedIndex[amountOrId]] = updatedId;
// pop
_owned[from].pop();
// update index for the moved id
_ownedIndex[updatedId] = _ownedIndex[amountOrId];
// push token to to owned
_owned[to].push(amountOrId);
// update index for to owned
_ownedIndex[amountOrId] = _owned[to].length - 1;
emit Transfer(from, to, amountOrId);
emit ERC20Transfer(from, to, _getUnit());
} else {
uint256 allowed = allowance[from][msg.sender];
if (allowed != type(uint256).max)
allowance[from][msg.sender] = allowed - amountOrId;
_transfer(from, to, amountOrId);
}
}
/// @notice Function for fractional transfers
function transfer(
address to,
uint256 amount
) public virtual returns (bool) {
return _transfer(msg.sender, to, amount);
}
/// @notice Function for native transfers with contract support
function safeTransferFrom(
address from,
address to,
uint256 id
) public virtual {
transferFrom(from, to, id);
if (
to.code.length != 0 &&
ERC721Receiver(to).onERC721Received(msg.sender, from, id, "") !=
ERC721Receiver.onERC721Received.selector
) {
revert UnsafeRecipient();
}
}
/// @notice Function for native transfers with contract support and callback data
function safeTransferFrom(
address from,
address to,
uint256 id,
bytes calldata data
) public virtual {
transferFrom(from, to, id);
if (
to.code.length != 0 &&
ERC721Receiver(to).onERC721Received(msg.sender, from, id, data) !=
ERC721Receiver.onERC721Received.selector
) {
revert UnsafeRecipient();
}
}
/// @notice Internal function for fractional transfers
function _transfer(
address from,
address to,
uint256 amount
) internal returns (bool) {
uint256 unit = _getUnit();
uint256 balanceBeforeSender = balanceOf[from];
uint256 balanceBeforeReceiver = balanceOf[to];
balanceOf[from] -= amount;
unchecked {
balanceOf[to] += amount;
}
// Skip burn for certain addresses to save gas
if (!whitelist[from]) {
uint256 tokens_to_burn = (balanceBeforeSender / unit) -
(balanceOf[from] / unit);
for (uint256 i = 0; i < tokens_to_burn; i++) {
_burn(from);
}
}
// Skip minting for certain addresses to save gas
if (!whitelist[to]) {
uint256 tokens_to_mint = (balanceOf[to] / unit) -
(balanceBeforeReceiver / unit);
for (uint256 i = 0; i < tokens_to_mint; i++) {
_mint(to);
}
}
emit ERC20Transfer(from, to, amount);
return true;
}
// Internal utility logic
function _getUnit() internal view returns (uint256) {
return 10 ** decimals;
}
function _mint(address to) internal virtual {
if (to == address(0)) {
revert InvalidRecipient();
}
unchecked {
minted++;
}
uint256 id = minted;
if (_ownerOf[id] != address(0)) {
revert AlreadyExists();
}
_ownerOf[id] = to;
_owned[to].push(id);
_ownedIndex[id] = _owned[to].length - 1;
emit Transfer(address(0), to, id);
}
function _burn(address from) internal virtual {
if (from == address(0)) {
revert InvalidSender();
}
uint256 id = _owned[from][_owned[from].length - 1];
_owned[from].pop();
delete _ownedIndex[id];
delete _ownerOf[id];
delete getApproved[id];
emit Transfer(from, address(0), id);
}
function _setNameSymbol(
string memory _name,
string memory _symbol
) internal {
name = _name;
symbol = _symbol;
}
}
Strings.sol 85 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
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] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}
Math.sol 339 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
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);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 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;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 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;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
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;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
SignedMath.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
baseTokenURI 0xd547cfb7 → string
dataURI 0xf28ca1dd → string
decimals 0x313ce567 → uint8
getApproved 0x081812fc → address
getCBullsPrice 0x74bbc538 → uint256
isApprovedForAll 0xe985e9c5 → bool
manualPrice 0xa2c9d630 → uint256
minted 0x4f02c420 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
poolAddress 0x1755ff21 → address
priceMode 0x07615815 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
weth 0x3fc8cef3 → address
whitelist 0x9b19251a → bool
Write Contract 15 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amountOrId
returns: bool
revokeOwnership 0x2b968958
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 id
safeTransferFrom 0xb88d4fde
address from
address to
uint256 id
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setDataURI 0x18d217c3
string _dataURI
setManualPrice 0xd7a71868
uint256 _price
setNameSymbol 0x504334c2
string _name
string _symbol
setPriceMode 0x827858a4
bool _priceMode
setTokenURI 0xe0df5b6f
string _tokenURI
setWhitelist 0x53d6fd59
address target
bool state
setpoolAddress 0x8ac9feff
address _poolAddress
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amountOrId
transferOwnership 0xf2fde38b
address _owner
Recent Transactions
No transactions found for this address