Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x989E1Fb123b67afd66e10574c8B409bC6e812D9A
Balance 0.002110 ETH
Nonce 1
Code Size 16253 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

16253 bytes
0x6080604052600436106104105760003560e01c80635d64aa681161021e578063a9059cbb11610123578063e0bb933b116100ab578063e985e9c51161007a578063e985e9c51461119a578063ed60ade6146111d5578063f7d8c883146111f8578063faa0ae531461121b578063faf421251461123e57610410565b8063e0bb933b146110c2578063e6be9b5614611142578063e6cbe35114611170578063e8de704d1461118557610410565b8063c0ac9983116100f2578063c0ac998314610fed578063c87b56dd14611002578063d1741a8c1461102c578063d3e6f49f14611083578063dbbc853b146110ad57610410565b8063a9059cbb14610ec6578063b047fb5014610eff578063b0c35c0514610f14578063b88d4fde14610f2957610410565b806378c234e0116101a65780638c267b97116101755780638c267b9714610e1c57806391876e5714610e3157806392695a8814610e4657806395d89b4114610e76578063a22cb46514610e8b57610410565b806378c234e014610d435780638368071c14610da65780638456cb5914610dd45780638462151c14610de957610410565b80636af04a57116101ed5780636af04a5714610c6b5780636fbde40d14610c8057806370a0823114610cb35780637158798814610ce657806371f7aaca14610d1957610410565b80635d64aa6814610bed5780635fd8c71014610c175780636059c38414610c2c5780636352211e14610c4157610410565b806323b872dd1161032457806342842e0e116102ac5780634b85fd551161027b5780634b85fd5514610b185780634dfff04f14610b425780634e0a337914610b7b5780634f6ccce714610bae5780635c975abb14610bd857610410565b806342842e0e14610a4c57806346116e6f14610a8257806346d22c7014610aac5780634ad8c93814610adc57610410565b80632e1699d7116102f35780632e1699d71461092a5780632f745c591461098f5780633d7d3f5a146109c85780633f4ba83a14610a04578063416da14514610a1957610410565b806323b872dd1461083357806327d7874c146108695780632a896ece1461089c5780632ba73c15146108f757610410565b8063100b2783116103a757806315437dfb1161037657806315437dfb1461075b57806318160ddd146107ac5780631940a936146107c15780632072863b146107eb57806321717ebf1461081e57610410565b8063100b2783146105fd57806312065fe01461065b57806314001f4c14610670578063150b7a02146106a357610410565b806306fdde03116103e357806306fdde0314610508578063081812fc14610592578063095ea7b3146105bc5780630a0f8168146105e857610410565b806301ffc9a71461043e5780630304b213146104865780630519ce79146104b057806305ea0668146104e1575b6010546001600160a01b031633148061043357506011546001600160a01b031633145b61043c57600080fd5b005b34801561044a57600080fd5b506104726004803603602081101561046157600080fd5b50356001600160e01b031916611309565b604080519115158252519081900360200190f35b34801561049257600080fd5b5061043c600480360360208110156104a957600080fd5b503561132c565b3480156104bc57600080fd5b506104c561139c565b604080516001600160a01b039092168252519081900360200190f35b3480156104ed57600080fd5b506104f66113ab565b60408051918252519081900360200190f35b34801561051457600080fd5b5061051d6113b1565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561055757818101518382015260200161053f565b50505050905090810190601f1680156105845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561059e57600080fd5b506104c5600480360360208110156105b557600080fd5b50356113d4565b61043c600480360360408110156105d257600080fd5b506001600160a01b038135169060200135611414565b3480156105f457600080fd5b506104c56114cd565b34801561060957600080fd5b506106276004803603602081101561062057600080fd5b50356114dc565b604080516001600160401b039586168152938516602085015291841683830152909216606082015290519081900360800190f35b34801561066757600080fd5b506104f6611516565b34801561067c57600080fd5b5061043c6004803603602081101561069357600080fd5b50356001600160a01b0316611589565b3480156106af57600080fd5b5061073e600480360360808110156106c657600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561070057600080fd5b82018360208201111561071257600080fd5b803590602001918460018302840111600160201b8311171561073357600080fd5b509092509050611636565b604080516001600160e01b03199092168252519081900360200190f35b34801561076757600080fd5b5061043c600480360360a081101561077e57600080fd5b508035906001600160401b03602082013581169160408101358216916060820135811691608001351661165b565b3480156107b857600080fd5b506104f6611862565b3480156107cd57600080fd5b50610472600480360360208110156107e457600080fd5b503561186c565b3480156107f757600080fd5b5061043c6004803603602081101561080e57600080fd5b50356001600160a01b03166118b0565b34801561082a57600080fd5b506104c56118fc565b61043c6004803603606081101561084957600080fd5b506001600160a01b0381358116916020810135909116906040013561190b565b34801561087557600080fd5b5061043c6004803603602081101561088c57600080fd5b50356001600160a01b03166119eb565b3480156108a857600080fd5b5061043c600480360360e08110156108bf57600080fd5b508035906020810135906040810135906001600160401b036060820135811691608081013582169160a0820135169060c00135611a37565b34801561090357600080fd5b5061043c6004803603602081101561091a57600080fd5b50356001600160a01b0316611b5c565b34801561093657600080fd5b5061093f611ba8565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561097b578181015183820152602001610963565b505050509050019250505060405180910390f35b34801561099b57600080fd5b506104f6600480360360408110156109b257600080fd5b506001600160a01b038135169060200135611c54565b3480156109d457600080fd5b5061043c600480360360808110156109eb57600080fd5b5080359060208101359060408101359060600135611cb6565b348015610a1057600080fd5b5061043c611d90565b348015610a2557600080fd5b5061043c60048036036020811015610a3c57600080fd5b50356001600160a01b0316611e07565b61043c60048036036060811015610a6257600080fd5b506001600160a01b03813581169160208101359091169060400135611e53565b348015610a8e57600080fd5b506104c560048036036020811015610aa557600080fd5b5035611e73565b348015610ab857600080fd5b5061047260048036036040811015610acf57600080fd5b5080359060200135611e8e565b348015610ae857600080fd5b5061043c60048036036080811015610aff57600080fd5b5080359060208101359060408101359060600135611f0d565b348015610b2457600080fd5b5061043c60048036036020811015610b3b57600080fd5b5035611fc8565b348015610b4e57600080fd5b5061043c60048036036040811015610b6557600080fd5b506001600160a01b038135169060200135612038565b348015610b8757600080fd5b5061043c60048036036020811015610b9e57600080fd5b50356001600160a01b0316612090565b348015610bba57600080fd5b506104f660048036036020811015610bd157600080fd5b5035611586565b348015610be457600080fd5b506104726120dc565b348015610bf957600080fd5b506104c560048036036020811015610c1057600080fd5b50356120ec565b348015610c2357600080fd5b5061043c612107565b348015610c3857600080fd5b506104c56121c8565b348015610c4d57600080fd5b506104c560048036036020811015610c6457600080fd5b50356121d7565b348015610c7757600080fd5b506104c5612217565b348015610c8c57600080fd5b5061043c60048036036020811015610ca357600080fd5b50356001600160a01b0316612226565b348015610cbf57600080fd5b506104f660048036036020811015610cd657600080fd5b50356001600160a01b03166122d3565b348015610cf257600080fd5b5061043c60048036036020811015610d0957600080fd5b50356001600160a01b03166122ee565b348015610d2557600080fd5b506104c560048036036020811015610d3c57600080fd5b503561236f565b348015610d4f57600080fd5b5061043c600480360360c0811015610d6657600080fd5b5080359060208101356001600160401b03908116916040810135821691606082013581169160808101359091169060a001356001600160a01b031661238a565b348015610db257600080fd5b50610dbb612425565b6040805163ffffffff9092168252519081900360200190f35b348015610de057600080fd5b5061043c612431565b348015610df557600080fd5b5061093f60048036036020811015610e0c57600080fd5b50356001600160a01b03166124c8565b348015610e2857600080fd5b506104c561258f565b348015610e3d57600080fd5b5061043c61259e565b348015610e5257600080fd5b5061043c60048036036020811015610e6957600080fd5b503563ffffffff166126d5565b348015610e8257600080fd5b5061051d61275c565b348015610e9757600080fd5b5061043c60048036036040811015610eae57600080fd5b506001600160a01b038135169060200135151561277d565b348015610ed257600080fd5b5061043c60048036036040811015610ee957600080fd5b506001600160a01b0381351690602001356127f7565b348015610f0b57600080fd5b506104c561288b565b348015610f2057600080fd5b506104f661289a565b61043c60048036036080811015610f3f57600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b811115610f7957600080fd5b820183602082011115610f8b57600080fd5b803590602001918460018302840111600160201b83111715610fac57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506128a0945050505050565b348015610ff957600080fd5b5061051d612add565b34801561100e57600080fd5b5061051d6004803603602081101561102557600080fd5b5035612b6b565b34801561103857600080fd5b506104f6600480360360c081101561104f57600080fd5b508035906020810135906001600160401b0360408201358116916060810135821691608082013581169160a0013516612d75565b34801561108f57600080fd5b50610472600480360360208110156110a657600080fd5b5035612f5e565b3480156110b957600080fd5b5061051d612f9b565b3480156110ce57600080fd5b506110ec600480360360208110156110e557600080fd5b5035612ff6565b604080519b8c5260208c019a909a528a8a019890985260608a0196909652608089019490945260a088019290925260c087015260e086015261010085015261012084015261014083015251908190036101600190f35b34801561114e57600080fd5b5061115761319a565b6040805192835260208301919091528051918290030190f35b34801561117c57600080fd5b506104c5613223565b34801561119157600080fd5b506104f6613232565b3480156111a657600080fd5b50610472600480360360408110156111bd57600080fd5b506001600160a01b0381358116916020013516613238565b61043c600480360360408110156111eb57600080fd5b5080359060200135613266565b61043c6004803603604081101561120e57600080fd5b50803590602001356133c3565b61043c6004803603604081101561123157600080fd5b50803590602001356134b7565b34801561124a57600080fd5b5061043c6004803603604081101561126157600080fd5b810190602081018135600160201b81111561127b57600080fd5b82018360208201111561128d57600080fd5b803590602001918460018302840111600160201b831117156112ae57600080fd5b919390929091602081019035600160201b8111156112cb57600080fd5b8201836020820111156112dd57600080fd5b803590602001918460018302840111600160201b831117156112fe57600080fd5b509092509050613539565b6001600160e01b0319811660009081526005602052604090205460ff165b919050565b6000546001600160a01b031633148061134f57506001546001600160a01b031633145b8061136457506002546001600160a01b031633145b8061137957506003546001600160a01b031633145b8061138e57506004546001600160a01b031633145b61139757600080fd5b600f55565b6004546001600160a01b031681565b60135481565b604051806040016040528060078152602001664472616b6f6e7360c81b81525081565b60008181526009602052604081205482906001600160a01b03166113f757600080fd5b50506000908152600b60205260409020546001600160a01b031690565b600454600160a01b900460ff161561142b57600080fd5b6000818152600960205260409020546001600160a01b03163381148061147457506001600160a01b0381166000908152600e6020908152604080832033845290915290205460ff165b61147d57600080fd5b6114878284613570565b81836001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000546001600160a01b031681565b600d602052600090815260409020546001600160401b0380821691600160401b8104821691600160801b8204811691600160c01b90041684565b600080546001600160a01b031633148061153a57506001546001600160a01b031633145b8061154f57506002546001600160a01b031633145b8061156457506003546001600160a01b031633145b8061157957506004546001600160a01b031633145b61158257600080fd5b5030315b90565b6000546001600160a01b031633146115a057600080fd5b6000819050806001600160a01b03166376190f8f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115de57600080fd5b505afa1580156115f2573d6000803e3d6000fd5b505050506040513d602081101561160857600080fd5b505161161357600080fd5b601180546001600160a01b0319166001600160a01b039290921691909117905550565b60006040518080613f2260279139604051908190036027019020979650505050505050565b600454600160a01b900460ff161561167257600080fd5b6003546001600160a01b0316331461168957600080fd5b6000858152600d6020526040902080546001600160401b03908116908616116116b157600080fd5b80546001600160401b03600160401b909104811690851610156116d357600080fd5b80546001600160401b03600160801b909104811690841610156116f557600080fd5b80546001600160401b03600160c01b9091048116908316101561171757600080fd5b61171f613df7565b50604080516080810182526001600160401b03878116825286811660208084019182528783168486019081528784166060860190815260008d8152600d9093528683208651815495519351925167ffffffffffffffff199096169087161767ffffffffffffffff60401b1916600160401b938716939093029290921767ffffffffffffffff60801b1916600160801b91861691909102176001600160c01b0316600160c01b9390941692909202929092179055600f549251919233926108fc82150292818181858888f193505050501580156117ff573d6000803e3d6000fd5b50604080518881526001600160401b0380891660208301528088168284015280871660608301528516608082015290517f98677f77088375bf66a28fd8e22fe9e5bcdf31183e2f80c9cd9b92170df1b11e9181900360a00190a150505050505050565b6008546000190190565b600080821161187a57600080fd5b6008828154811061188757fe5b6000918252602090912060029091020160010154600160c01b900463ffffffff16151592915050565b6000546001600160a01b031633146118c757600080fd5b6001600160a01b0381166118da57600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b031681565b600454600160a01b900460ff161561192257600080fd5b6001600160a01b03821661193557600080fd5b6001600160a01b03821630141561194b57600080fd5b6000611956826121d7565b9050836001600160a01b0316816001600160a01b03161461197657600080fd5b6001600160a01b0381163314806119a357506000828152600b60205260409020546001600160a01b031633145b806119d157506001600160a01b0381166000908152600e6020908152604080832033845290915290205460ff165b6119da57600080fd5b6119e584848461359e565b50505050565b6000546001600160a01b03163314611a0257600080fd5b6001600160a01b038116611a1557600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331480611a5a57506001546001600160a01b031633145b80611a6f57506002546001600160a01b031633145b80611a8457506003546001600160a01b031633145b80611a9957506004546001600160a01b031633145b611aa257600080fd5b6000611ab860008060008b898989600030613677565b601054909150611ad29082906001600160a01b0316613570565b601054604080516313f5f20560e11b815260048101849052602481018a9052604481018990526064810185905230608482015290516001600160a01b03909216916327ebe40a9160a48082019260009290919082900301818387803b158015611b3a57600080fd5b505af1158015611b4e573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611b7357600080fd5b6001600160a01b038116611b8657600080fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b606060135460001415611bca5750604080516000815260208101909152611586565b6060601354604051908082528060200260200182016040528015611bf8578160200160208202803883390190505b5090506000611c05611862565b9050600060015b828111611c4857611c1c8161186c565b15611c405780848381518110611c2e57fe5b60209081029190910101526001909101905b600101611c0c565b83945050505050611586565b60008060015b611c62611862565b8111611caa576000818152600960205260409020546001600160a01b0386811691161415611ca25783821415611c9b579150611cb09050565b6001909101905b600101611c5a565b50600080fd5b92915050565b600454600160a01b900460ff1615611ccd57600080fd5b611cd73385613a0b565b611ce057600080fd5b611ce98461186c565b15611cf357600080fd5b601054611d0a9085906001600160a01b0316613570565b601054604080516313f5f20560e11b81526004810187905260248101869052604481018590526064810184905233608482015290516001600160a01b03909216916327ebe40a9160a48082019260009290919082900301818387803b158015611d7257600080fd5b505af1158015611d86573d6000803e3d6000fd5b5050505050505050565b6000546001600160a01b03163314611da757600080fd5b600454600160a01b900460ff16611dbd57600080fd5b6010546001600160a01b0316611dd257600080fd5b6011546001600160a01b0316611de757600080fd5b6016546001600160a01b031615611dfd57600080fd5b611e05613a2b565b565b6000546001600160a01b03163314611e1e57600080fd5b6001600160a01b038116611e3157600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b611e6e838383604051806020016040528060008152506128a0565b505050565b600c602052600090815260409020546001600160a01b031681565b6000808311611e9c57600080fd5b60008211611ea957600080fd5b600060088481548110611eb857fe5b90600052602060002090600202019050600060088481548110611ed757fe5b90600052602060002090600202019050611ef382868387613a67565b8015611f045750611f048486613c59565b95945050505050565b600454600160a01b900460ff1615611f2457600080fd5b611f2e3385613a0b565b611f3757600080fd5b611f4084612f5e565b611f4957600080fd5b601154611f609085906001600160a01b0316613570565b601154604080516313f5f20560e11b81526004810187905260248101869052604481018590526064810184905233608482015290516001600160a01b03909216916327ebe40a9160a48082019260009290919082900301818387803b158015611d7257600080fd5b6000546001600160a01b0316331480611feb57506001546001600160a01b031633145b8061200057506002546001600160a01b031633145b8061201557506003546001600160a01b031633145b8061202a57506004546001600160a01b031633145b61203357600080fd5b601255565b600454600160a01b900460ff161561204f57600080fd5b6120593382613a0b565b61206257600080fd5b6000908152600c6020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146120a757600080fd5b6001600160a01b0381166120ba57600080fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b600454600160a01b900460ff1681565b6009602052600090815260409020546001600160a01b031681565b6000546001600160a01b031633148061212a57506001546001600160a01b031633145b8061213f57506002546001600160a01b031633145b8061215457506003546001600160a01b031633145b8061216957506004546001600160a01b031633145b61217257600080fd5b601254601354303191600190910102808211156121c4576004546040516001600160a01b039091169082840380156108fc02916000818181858888f19350505050158015611e6e573d6000803e3d6000fd5b5050565b6001546001600160a01b031681565b60008181526009602052604081205482906001600160a01b03166121fa57600080fd5b50506000908152600960205260409020546001600160a01b031690565b6016546001600160a01b031681565b6000546001600160a01b0316331461223d57600080fd5b6000819050806001600160a01b03166385b861886040518163ffffffff1660e01b815260040160206040518083038186803b15801561227b57600080fd5b505afa15801561228f573d6000803e3d6000fd5b505050506040513d60208110156122a557600080fd5b50516122b057600080fd5b601080546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b03166000908152600a602052604090205490565b6000546001600160a01b0316331461230557600080fd5b600454600160a01b900460ff1661231b57600080fd5b601680546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f450db8da6efbe9c22f2347f7c2021231df1fc58d3ae9a2fa75d39fa4461993059181900360200190a150565b600b602052600090815260409020546001600160a01b031681565b6000546001600160a01b03163314806123ad57506001546001600160a01b031633145b806123c257506002546001600160a01b031633145b806123d757506003546001600160a01b031633145b806123ec57506004546001600160a01b031633145b6123f557600080fd5b806001600160a01b03811661241257506002546001600160a01b03165b611d8660008060008a8a8a8a8a89613677565b60145463ffffffff1681565b6000546001600160a01b031633148061245457506001546001600160a01b031633145b8061246957506002546001600160a01b031633145b8061247e57506003546001600160a01b031633145b8061249357506004546001600160a01b031633145b61249c57600080fd5b600454600160a01b900460ff16156124b357600080fd5b6004805460ff60a01b1916600160a01b179055565b606060006124d5836122d3565b9050806124f2575050604080516000815260208101909152611327565b60608160405190808252806020026020018201604052801561251e578160200160208202803883390190505b509050600061252b611862565b9050600060015b828111612582576000818152600960205260409020546001600160a01b038881169116141561257a578084838151811061256857fe5b60209081029190910101526001909101905b600101612532565b8395505050505050611327565b6002546001600160a01b031681565b6000546001600160a01b03163314806125c157506001546001600160a01b031633145b806125d657506002546001600160a01b031633145b806125eb57506003546001600160a01b031633145b8061260057506004546001600160a01b031633145b61260957600080fd5b601060009054906101000a90046001600160a01b03166001600160a01b0316635fd8c7106040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561265957600080fd5b505af115801561266d573d6000803e3d6000fd5b50505050601160009054906101000a90046001600160a01b03166001600160a01b0316635fd8c7106040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156126c157600080fd5b505af11580156119e5573d6000803e3d6000fd5b6000546001600160a01b03163314806126f857506001546001600160a01b031633145b8061270d57506002546001600160a01b031633145b8061272257506003546001600160a01b031633145b8061273757506004546001600160a01b031633145b61274057600080fd5b6014805463ffffffff191663ffffffff92909216919091179055565b6040518060400160405280600581526020016444524b4e5360d81b81525081565b60408051821515815290516001600160a01b0384169133917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319181900360200190a3336000908152600e602090815260408083206001600160a01b0395909516835293905291909120805460ff1916911515919091179055565b600454600160a01b900460ff161561280e57600080fd5b6001600160a01b03821661282157600080fd5b6001600160a01b03821630141561283757600080fd5b6010546001600160a01b038381169116141561285257600080fd5b6011546001600160a01b038381169116141561286d57600080fd5b6128773382613a0b565b61288057600080fd5b6121c433838361359e565b6003546001600160a01b031681565b60125481565b6001600160a01b0383166128b357600080fd5b6001600160a01b0383163014156128c957600080fd5b6010546001600160a01b03848116911614156128e457600080fd5b6011546001600160a01b03848116911614156128ff57600080fd5b600061290a836121d7565b9050846001600160a01b0316816001600160a01b03161461292a57600080fd5b6001600160a01b03811633148061295757506000838152600b60205260409020546001600160a01b031633145b8061298557506001600160a01b0381166000908152600e6020908152604080832033845290915290205460ff165b61298e57600080fd5b61299985858561359e565b833b63ffffffff811615612ad557604051859080602f613ef3823960405190819003602f018120630a85bd0160e11b825233600483018181526001600160a01b038c81166024860152604485018b90526080606486019081528a5160848701528a516001600160e01b031990951696509087169463150b7a02948e938d938d939192909160a40190602085019080838360005b83811015612a44578181015183820152602001612a2c565b50505050905090810190601f168015612a715780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015612a9357600080fd5b505af1158015612aa7573d6000803e3d6000fd5b505050506040513d6020811015612abd57600080fd5b50516001600160e01b03191614612ad357600080fd5b505b505050505050565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015612b635780601f10612b3857610100808354040283529160200191612b63565b820191906000526020600020905b815481529060010190602001808311612b4657829003601f168201915b505050505081565b60008181526009602052604090205460609082906001600160a01b0316612b9157600080fd5b60408051604e80825260808201909252606090826020820181803883390190505060068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281529394506000938993603093606093830182828015612c455780601f10612c1a57610100808354040283529160200191612c45565b820191906000526020600020905b815481529060010190602001808311612c2857829003601f168201915b505050505090505b8215612c905784516001850194600a80860495069184830160f81b9188918110612c7357fe5b60200101906001600160f81b031916908160001a90535050612c4d565b6060848251016040519080825280601f01601f191660200182016040528015612cc0576020820181803883390190505b50905060005b8251811015612d1157828181518110612cdb57fe5b602001015160f81c60f81b828281518110612cf257fe5b60200101906001600160f81b031916908160001a905350600101612cc6565b5060005b85811015612d67578681600188030381518110612d2e57fe5b602001015160f81c60f81b828451830181518110612d4857fe5b60200101906001600160f81b031916908160001a905350600101612d15565b509998505050505050505050565b600454600090600160a01b900460ff1615612d8f57600080fd5b6003546001600160a01b03163314612da657600080fd5b600060088881548110612db557fe5b6000918252602090912060029091020160018101549091506001600160401b0316612ddf57600080fd5b612de881613cae565b612df157600080fd5b600181015460088054600160c01b90920463ffffffff16916000919083908110612e1757fe5b6000918252602090912060018086015460029093029091019081015490925063ffffffff600160e01b9283900481169290910416811015612e6657506001810154600160e01b900463ffffffff165b60008b905060008a905060008a905060008a905060008a905060008f905060006009600088815260200190815260200160002060009054906101000a90046001600160a01b031690506000612ecb888c8b60010163ffffffff16868b8b8b8b8a613677565b600089815260156020526040808220805467ffffffffffffffff19811660016001600160401b039283168101909216179091558f01805463ffffffff60c01b1916905560138054600019019055601254905192935033926108fc82150292818181858888f19350505050158015612f46573d6000803e3d6000fd5b509b5050505050505050505050509695505050505050565b6000808211612f6c57600080fd5b600060088381548110612f7b57fe5b90600052602060002090600202019050612f9481613cc4565b9392505050565b6007805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015612b635780601f10612b3857610100808354040283529160200191612b63565b60008060008060008060008060008060008060088d8154811061301557fe5b906000526020600020906002020190506000600d60008f8152602001908152602001600020905081600001549c508160010160009054906101000a90046001600160401b03166001600160401b03169b508160010160089054906101000a90046001600160401b03166001600160401b03169a508160010160109054906101000a900463ffffffff1663ffffffff1699508160010160149054906101000a900463ffffffff1663ffffffff1698508160010160189054906101000a900463ffffffff1663ffffffff16975081600101601c9054906101000a900463ffffffff1663ffffffff1696508060000160009054906101000a90046001600160401b03166001600160401b031695508060000160089054906101000a90046001600160401b03166001600160401b031694508060000160109054906101000a90046001600160401b03166001600160401b031693508060000160189054906101000a90046001600160401b03166001600160401b03169250505091939597999b90929496989a50565b6000805481906001600160a01b03163314806131c057506001546001600160a01b031633145b806131d557506002546001600160a01b031633145b806131ea57506003546001600160a01b031633145b806131ff57506004546001600160a01b031633145b61320857600080fd5b50506010546011546001600160a01b03918216319116319091565b6010546001600160a01b031681565b600f5481565b6001600160a01b039182166000908152600e6020908152604080832093909416825291909152205460ff1690565b600454600160a01b900460ff161561327d57600080fd5b6132873382613a0b565b61329057600080fd5b61329981612f5e565b6132a257600080fd5b6132ac8183613cd9565b6132b557600080fd5b601154604080516362ae87ab60e11b81526004810185905290516000926001600160a01b03169163c55d0f56916024808301926020929190829003018186803b15801561330157600080fd5b505afa158015613315573d6000803e3d6000fd5b505050506040513d602081101561332b57600080fd5b5051601254909150810134101561334157600080fd5b6011546012546040805163454a2ab360e01b81526004810187905290516001600160a01b039093169263454a2ab39234039160248082019260009290919082900301818588803b15801561339457600080fd5b505af11580156133a8573d6000803e3d6000fd5b5050505050611e6e8263ffffffff168463ffffffff16613d24565b600454600160a01b900460ff16156133da57600080fd5b6012543410156133e957600080fd5b6133f33383613a0b565b6133fc57600080fd5b6134068183613c59565b61340f57600080fd5b60006008838154811061341e57fe5b9060005260206000209060020201905061343781613cc4565b61344057600080fd5b60006008838154811061344f57fe5b9060005260206000209060020201905061346881613cc4565b61347157600080fd5b60018201805467ffffffffffffffff60401b1916600160401b426001600160401b0316021790556134a482858386613a67565b6134ad57600080fd5b6119e58484613d24565b600454600160a01b900460ff16156134ce57600080fd5b600f543410156134dd57600080fd5b6000828152600d6020526040902080546001600160401b0316821161350157600080fd5b6040805184815290517f191e0543c66edcea968f62447117864399037ec1d189931eee2ddcbd5d45489d9181900360200190a1505050565b6000546001600160a01b0316331461355057600080fd5b61355c60068585613e1e565b5061356960078383613e1e565b5050505050565b6000918252600b602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b6001600160a01b038083166000818152600a60209081526040808320805460010190558583526009909152902080546001600160a01b0319169091179055831615613631576001600160a01b0383166000908152600a602090815260408083208054600019019055838352600c825280832080546001600160a01b0319908116909155600b909252909120805490911690555b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008963ffffffff168a1461368b57600080fd5b8863ffffffff16891461369d57600080fd5b8763ffffffff1688146136af57600080fd5b6136b7613e9c565b506040805160e0810182528881526001600160401b0342166020820152600091810182905263ffffffff808d1660608301528b8116608083015260a082019290925290891660c0820152613709613df7565b6040518060800160405280866001600160401b03168152602001896001600160401b03168152602001886001600160401b03168152602001876001600160401b0316815250905060006001600884908060018154018082558091505090600182039060005260206000209060020201600090919290919091506000820151816000015560208201518160010160006101000a8154816001600160401b0302191690836001600160401b0316021790555060408201518160010160086101000a8154816001600160401b0302191690836001600160401b0316021790555060608201518160010160106101000a81548163ffffffff021916908363ffffffff16021790555060808201518160010160146101000a81548163ffffffff021916908363ffffffff16021790555060a08201518160010160186101000a81548163ffffffff021916908363ffffffff16021790555060c082015181600101601c6101000a81548163ffffffff021916908363ffffffff160217905550505003905081600d600083815260200190815260200160002060008201518160000160006101000a8154816001600160401b0302191690836001600160401b0316021790555060208201518160000160086101000a8154816001600160401b0302191690836001600160401b0316021790555060408201518160000160106101000a8154816001600160401b0302191690836001600160401b0316021790555060608201518160000160186101000a8154816001600160401b0302191690836001600160401b031602179055509050508063ffffffff16811461396457600080fd5b606080840151608080860151865160c080890151604080516001600160a01b038e168152602081018a905263ffffffff9788168183015294871697850197909752938301919091529190921660a08301526001600160401b0389169082015290517fdf8d8992e7e860a8605ceb50aa640d5209227db91bcd9ec915a1d4c56d68a5b99181900360e00190a16139fb6000868361359e565b9c9b505050505050505050505050565b6000908152600960205260409020546001600160a01b0391821691161490565b6000546001600160a01b03163314613a4257600080fd5b600454600160a01b900460ff16613a5857600080fd5b6004805460ff60a01b19169055565b601454600084815260156020526040812054909163ffffffff166001600160401b0390911610613a9957506000613c51565b825485546e01ed09bead87c0378d8e640000000091829004919004808214613ac657600092505050613c51565b83861415613ad957600092505050613c51565b6001870154600160801b900463ffffffff16841480613b0857506001870154600160a01b900463ffffffff1684145b15613b1857600092505050613c51565b6001850154600160801b900463ffffffff16861480613b4757506001850154600160a01b900463ffffffff1686145b15613b5757600092505050613c51565b6001850154600160801b900463ffffffff161580613b8457506001870154600160801b900463ffffffff16155b15613b9457600192505050613c51565b60018781015490860154600160801b9182900463ffffffff90811692909104161480613bdf575060018088015490860154600160801b900463ffffffff908116600160a01b90920416145b15613bef57600092505050613c51565b60018088015490860154600160a01b900463ffffffff908116600160801b909204161480613c3a575060018781015490860154600160a01b9182900463ffffffff9081169290910416145b15613c4a57600092505050613c51565b6001925050505b949350505050565b60008181526009602052604080822054848352908220546001600160a01b03918216911680821480611f0457506000858152600c60205260409020546001600160a01b03908116908316149250505092915050565b60010154600160c01b900463ffffffff16151590565b60010154600160c01b900463ffffffff161590565b60008060088481548110613ce957fe5b90600052602060002090600202019050600060088481548110613d0857fe5b90600052602060002090600202019050611f0482868387613a67565b600060088381548110613d3357fe5b600091825260208083206001600290930201828101805463ffffffff8816600160c01b0263ffffffff60c01b19909116179055868452600c8252604080852080546001600160a01b0319908116909155878652818620805490911690556013805490940190935586845260098252928290205482516001600160a01b0391909116815290810186905280820185905290519192507f6b4808987a5cecdf67d54ca5dc20664fafca80ef7195097800c12549245ab20d919081900360600190a1505050565b60408051608081018252600080825260208201819052918101829052606081019190915290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613e5f5782800160ff19823516178555613e8c565b82800160010185558215613e8c579182015b82811115613e8c578235825591602001919060010190613e71565b50613e98929150613ed8565b5090565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b61158691905b80821115613e985760008155600101613ede56fe6f6e455243373231526563656976656428616464726573732c616464726573732c75696e743235362c6279746573296f6e455243373231526563656976656428616464726573732c75696e743235362c627974657329a265627a7a72305820a2519486d7e80a0b5f8dc4d89b1b059c0dc278b9f2a407309cb4f51303a42b3864736f6c634300050a0032

Verified Source Code Partial Match

Compiler: v0.5.10+commit.5a6ea5b1 EVM: petersburg Optimization: Yes (200 runs)
DragonCore.sol 2237 lines
// File: contracts/Ownable.sol

pragma solidity ^0.5.10;

contract Ownable {
    address public owner;


    /**
     * @dev The Ownable constructor sets the original `owner` of the contract to the sender
     * account.
     */
    constructor() public {
        owner = msg.sender;
    }


    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }


    /**
     * @dev Allows the current owner to transfer control of the contract to a newOwner.
     * @param newOwner The address to transfer ownership to.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        if (newOwner != address(0)) {
            owner = newOwner;
        }
    }

}

// File: contracts/Pausable.sol

pragma solidity ^0.5.10;


contract Pausable is Ownable {
    event Pause();
    event Unpause();

    bool public paused = false;


    /**
     * @dev modifier to allow actions only when the contract IS paused
     */
    modifier whenNotPaused() {
        require(!paused);
        _;
    }

    /**
     * @dev modifier to allow actions only when the contract IS NOT paused
     */
    modifier whenPaused {
        require(paused);
        _;
    }

    /**
     * @dev called by the owner to pause, triggers stopped state
     */
    function pause() public onlyOwner whenNotPaused returns (bool) {
        paused = true;
        emit Pause();
        return true;
    }

    /**
     * @dev called by the owner to unpause, returns to normal state
     */
    function unpause() public onlyOwner whenPaused returns (bool) {
        paused = false;
        emit Unpause();
        return true;
    }
}

// File: contracts/DragonAccessControl.sol

pragma solidity ^0.5.10;



contract DragonAccessControl {
    /// @dev Emited when contract is upgraded - See README.md for updgrade plan
    event ContractUpgrade(address newContract);

    // The addresses of the accounts (or contracts) that can execute actions within each roles.
    address payable public ceoAddress;
    address payable public cioAddress;
    address payable public cmoAddress;
    address payable public cooAddress;
    address payable public cfoAddress;

    // @dev Keeps track whether the contract is paused. When that is true, most actions are blocked
    bool public paused = false;

    /// @dev Access modifier for CEO-only functionality
    modifier onlyCEO() {
        require(msg.sender == ceoAddress);
        _;
    }

    /// @dev Access modifier for CIO-only functionality
    modifier onlyCIO() {
        require(msg.sender == cioAddress);
        _;
    }

    /// @dev Access modifier for CMO-only functionality
    modifier onlyCMO() {
        require(msg.sender == cmoAddress);
        _;
    }

    /// @dev Access modifier for COO-only functionality
    modifier onlyCOO() {
        require(msg.sender == cooAddress);
        _;
    }

    /// @dev Access modifier for CFO-only functionality
    modifier onlyCFO() {
        require(msg.sender == cfoAddress);
        _;
    }

    modifier onlyCLevel() {
        require(
            msg.sender == ceoAddress ||
            msg.sender == cioAddress ||
            msg.sender == cmoAddress ||
            msg.sender == cooAddress ||
            msg.sender == cfoAddress
        );
        _;
    }

    /// @dev Assigns a new address to act as the CEO. Only available to the current CEO.
    /// @param _newCEO The address of the new CEO
    function setCEO(address payable _newCEO) external onlyCEO {
        require(_newCEO != address(0));

        ceoAddress = _newCEO;
    }

    /// @dev Assigns a new address to act as the CIO. Only available to the current CEO.
    /// @param _newCIO The address of the new CIO
    function setCIO(address payable _newCIO) external onlyCEO {
        require(_newCIO != address(0));

        cioAddress = _newCIO;
    }

    /// @dev Assigns a new address to act as the CMO. Only available to the current CEO.
    /// @param _newCMO The address of the new CMO
    function setCMO(address payable _newCMO) external onlyCEO {
        require(_newCMO != address(0));

        cmoAddress = _newCMO;
    }

    /// @dev Assigns a new address to act as the COO. Only available to the current CEO.
    /// @param _newCOO The address of the new COO
    function setCOO(address payable _newCOO) external onlyCEO {
        require(_newCOO != address(0));

        cooAddress = _newCOO;
    }

    /// @dev Assigns a new address to act as the CFO. Only available to the current CEO.
    /// @param _newCFO The address of the new CFO
    function setCFO(address payable _newCFO) external onlyCEO {
        require(_newCFO != address(0));

        cfoAddress = _newCFO;
    }

    /// @dev Modifier to allow actions only when the contract IS NOT paused
    modifier whenNotPaused() {
        require(!paused);
        _;
    }

    /// @dev Modifier to allow actions only when the contract IS paused
    modifier whenPaused {
        require(paused);
        _;
    }

    /// @dev Called by any "C-level" role to pause the contract. Used only when
    ///  a bug or exploit is detected and we need to limit damage.
    function pause() external onlyCLevel whenNotPaused {
        paused = true;
    }

    /// @dev Unpauses the smart contract. Can only be called by the CEO, since
    ///  one reason we may pause the contract is when CIO or CMO accounts are
    ///  compromised.
    /// @notice This is public rather than external so it can be called by
    ///  derived contracts.
    function unpause() public onlyCEO whenPaused {
        // can't unpause if contract was upgraded
        paused = false;
    }
}

// File: contracts/DragonERC721.sol

pragma solidity ^0.5.10;


/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://eips.ethereum.org/EIPS/eip-721
///  Note: the ERC-165 identifier for this interface is 0x80ac58cd.
interface ERC721 /* is ERC165 */ {
    /// @dev This emits when ownership of any NFT changes by any mechanism.
    ///  This event emits when NFTs are created (`from` == 0) and destroyed
    ///  (`to` == 0). Exception: during contract creation, any number of NFTs
    ///  may be created and assigned without emitting Transfer. At the time of
    ///  any transfer, the approved address for that NFT (if any) is reset to none.
    event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);

    /// @dev This emits when the approved address for an NFT is changed or
    ///  reaffirmed. The zero address indicates there is no approved address.
    ///  When a Transfer event emits, this also indicates that the approved
    ///  address for that NFT (if any) is reset to none.
    event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);

    /// @dev This emits when an operator is enabled or disabled for an owner.
    ///  The operator can manage all NFTs of the owner.
    event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);

    /// @notice Count all NFTs assigned to an owner
    /// @dev NFTs assigned to the zero address are considered invalid, and this
    ///  function throws for queries about the zero address.
    /// @param _owner An address for whom to query the balance
    /// @return The number of NFTs owned by `_owner`, possibly zero
    function balanceOf(address _owner) external view returns (uint256);

    /// @notice Find the owner of an NFT
    /// @dev NFTs assigned to zero address are considered invalid, and queries
    ///  about them do throw.
    /// @param _tokenId The identifier for an NFT
    /// @return The address of the owner of the NFT
    function ownerOf(uint256 _tokenId) external view returns (address);

    /// @notice Transfers the ownership of an NFT from one address to another address
    /// @dev Throws unless `msg.sender` is the current owner, an authorized
    ///  operator, or the approved address for this NFT. Throws if `_from` is
    ///  not the current owner. Throws if `_to` is the zero address. Throws if
    ///  `_tokenId` is not a valid NFT. When transfer is complete, this function
    ///  checks if `_to` is a smart contract (code size > 0). If so, it calls
    ///  `onERC721Received` on `_to` and throws if the return value is not
    ///  `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    /// @param data Additional data with no specified format, sent in call to `_to`
    function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes calldata data) external payable;

    /// @notice Transfers the ownership of an NFT from one address to another address
    /// @dev This works identically to the other function with an extra data parameter,
    ///  except this function just sets data to "".
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;

    /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
    ///  TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
    ///  THEY MAY BE PERMANENTLY LOST
    /// @dev Throws unless `msg.sender` is the current owner, an authorized
    ///  operator, or the approved address for this NFT. Throws if `_from` is
    ///  not the current owner. Throws if `_to` is the zero address. Throws if
    ///  `_tokenId` is not a valid NFT.
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    function transferFrom(address _from, address _to, uint256 _tokenId) external payable;

    /// @notice Change or reaffirm the approved address for an NFT
    /// @dev The zero address indicates there is no approved address.
    ///  Throws unless `msg.sender` is the current NFT owner, or an authorized
    ///  operator of the current owner.
    /// @param _approved The new approved NFT controller
    /// @param _tokenId The NFT to approve
    function approve(address _approved, uint256 _tokenId) external payable;

    /// @notice Enable or disable approval for a third party ("operator") to manage
    ///  all of `msg.sender`'s assets
    /// @dev Emits the ApprovalForAll event. The contract MUST allow
    ///  multiple operators per owner.
    /// @param _operator Address to add to the set of authorized operators
    /// @param _approved True if the operator is approved, false to revoke approval
    function setApprovalForAll(address _operator, bool _approved) external;

    /// @notice Get the approved address for a single NFT
    /// @dev Throws if `_tokenId` is not a valid NFT.
    /// @param _tokenId The NFT to find the approved address for
    /// @return The approved address for this NFT, or the zero address if there is none
    function getApproved(uint256 _tokenId) external view returns (address);

    /// @notice Query if an address is an authorized operator for another address
    /// @param _owner The address that owns the NFTs
    /// @param _operator The address that acts on behalf of the owner
    /// @return True if `_operator` is an approved operator for `_owner`, false otherwise
    function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}

interface ERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}

interface ERC721TokenReceiver {
    /// @notice Handle the receipt of an NFT
    /// @dev The ERC721 smart contract calls this function on the recipient
    ///  after a `transfer`. This function MAY throw to revert and reject the
    ///  transfer. Return of other than the magic value MUST result in the
    ///  transaction being reverted.
    ///  Note: the contract address is always the message sender.
    /// @param _operator The address which called `safeTransferFrom` function
    /// @param _from The address which previously owned the token
    /// @param _tokenId The NFT identifier which is being transferred
    /// @param _data Additional data with no specified format
    /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    ///  unless throwing
    function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external returns(bytes4);
}

/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
///  Note: the ERC-165 identifier for this interface is 0x5b5e139f
interface ERC721Metadata /* is IERC721Base */ {
  /// @notice A descriptive name for a collection of NFTs in this contract
  function name() external pure returns (string memory _name);

  /// @notice An abbreviated name for NFTs in this contract
  function symbol() external pure returns (string memory _symbol);

  /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
  /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC
  ///  3986. The URI may point to a JSON file that conforms to the "ERC721
  ///  Metadata JSON Schema".
  function tokenURI(uint256 _tokenId) external view returns (string memory);
}

/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
/// @dev See https://eips.ethereum.org/EIPS/eip-721
///  Note: the ERC-165 identifier for this interface is 0x780e9d63.
interface ERC721Enumerable /* is ERC721 */ {
    /// @notice Count NFTs tracked by this contract
    /// @return A count of valid NFTs tracked by this contract, where each one of
    ///  them has an assigned and queryable owner not equal to the zero address
    function totalSupply() external view returns (uint256);

    /// @notice Enumerate valid NFTs
    /// @dev Throws if `_index` >= `totalSupply()`.
    /// @param _index A counter less than `totalSupply()`
    /// @return The token identifier for the `_index`th NFT,
    ///  (sort order not specified)
    function tokenByIndex(uint256 _index) external view returns (uint256);

    /// @notice Enumerate NFTs assigned to an owner
    /// @dev Throws if `_index` >= `balanceOf(_owner)` or if
    ///  `_owner` is the zero address, representing invalid NFTs.
    /// @param _owner An address where we are interested in NFTs owned by them
    /// @param _index A counter less than `balanceOf(_owner)`
    /// @return The token identifier for the `_index`th NFT assigned to `_owner`,
    ///   (sort order not specified)
    function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
}

//contract DragonERC721 is IERC721, ERC721Metadata, ERC721TokenReceiver, ERC721Enumerable {
contract DragonERC721 is ERC165, ERC721, ERC721Metadata, ERC721TokenReceiver, ERC721Enumerable {

    mapping (bytes4 => bool) internal supportedInterfaces;

    string public tokenURIPrefix = "https://www.drakons.io/server/api/dragon/metadata/";
    string public tokenURISuffix = "";

    function name() external pure returns (string memory) {
      return "Drakons";
    }

    function symbol() external pure returns (string memory) {
      return "DRKNS";
    }

    function supportsInterface(bytes4 interfaceID) external view returns (bool) {
        return supportedInterfaces[interfaceID];
    }

    function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external returns(bytes4){
        return bytes4(keccak256("onERC721Received(address,uint256,bytes)"));
    }

}

// File: contracts/ClockAuctionBase.sol

pragma solidity ^0.5.10;


contract ClockAuctionBase {

    // Represents an auction on an NFT
    struct Auction {
        // Current owner of NFT
        address payable seller;
        // Price (in wei) at beginning of auction
        uint128 startingPrice;
        // Price (in wei) at end of auction
        uint128 endingPrice;
        // Duration (in seconds) of auction
        uint64 duration;
        // Time when auction started
        // NOTE: 0 if this auction has been concluded
        uint64 startedAt;
    }

    // Reference to contract tracking NFT ownership
    DragonERC721 public nonFungibleContract;

    // Cut owner takes on each auction, measured in basis points (1/100 of a percent).
    // Values 0-10,000 map to 0%-100%
    uint256 public ownerCut;

    address payable public ceoAddress;
    address payable public cfoAddress;

    modifier onlyCEOCFO() {
        require(
            msg.sender == ceoAddress ||
            msg.sender == cfoAddress
        );
        _;
    }

    modifier onlyCEO() {
        require(msg.sender == ceoAddress);
        _;
    }

    // Map from token ID to their corresponding auction.
    mapping (uint256 => Auction) tokenIdToAuction;

    event AuctionCreated(uint256 tokenId, uint256 startingPrice, uint256 endingPrice, uint256 duration);
    event AuctionSuccessful(uint256 tokenId, uint256 totalPrice, address buyer, address seller);
    event AuctionCancelled(uint256 tokenId);


    function setCEO(address payable _newCEO) external onlyCEO {
        require(_newCEO != address(0));

        ceoAddress = _newCEO;
    }

    function setCFO(address payable _newCFO) external onlyCEO {
        require(_newCFO != address(0));

        cfoAddress = _newCFO;
    }

    /// @dev Returns true if the claimant owns the token.
    /// @param _claimant - Address claiming to own the token.
    /// @param _tokenId - ID of token whose ownership to verify.
    function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
        return (nonFungibleContract.ownerOf(_tokenId) == _claimant);
    }

    /// @dev Escrows the NFT, assigning ownership to this contract.
    /// Throws if the escrow fails.
    /// @param _owner - Current owner address of token to escrow.
    /// @param _tokenId - ID of token whose approval to verify.
    function _escrow(address _owner, uint256 _tokenId) internal {
        // it will throw if transfer fails
        nonFungibleContract.transferFrom(_owner, address(this), _tokenId);
    }

    /// @dev Transfers an NFT owned by this contract to another address.
    /// Returns true if the transfer succeeds.
    /// @param _receiver - Address to transfer NFT to.
    /// @param _tokenId - ID of token to transfer.
    function _transfer(address _receiver, uint256 _tokenId) internal {
        // it will throw if transfer fails
        //nonFungibleContract.transfer(_receiver, _tokenId);
        nonFungibleContract.transferFrom(address(this), _receiver, _tokenId);
    }

    /// @dev Adds an auction to the list of open auctions. Also fires the
    ///  AuctionCreated event.
    /// @param _tokenId The ID of the token to be put on auction.
    /// @param _auction Auction to add.
    function _addAuction(uint256 _tokenId, Auction memory _auction) internal {
        // Require that all auctions have a duration of
        // at least one minute. (Keeps our math from getting hairy!)
        require(_auction.duration >= 1 minutes);

        tokenIdToAuction[_tokenId] = _auction;

        //cpt added emit
        emit AuctionCreated(
            uint256(_tokenId),
            uint256(_auction.startingPrice),
            uint256(_auction.endingPrice),
            uint256(_auction.duration)
        );
    }

    /// @dev Cancels an auction unconditionally.
    function _cancelAuction(uint256 _tokenId, address _seller) internal {
        _removeAuction(_tokenId);
        _transfer(_seller, _tokenId);
        emit AuctionCancelled(_tokenId);
    }

    /// @dev Computes the price and transfers winnings.
    /// Does NOT transfer ownership of token.
    function _bid(uint256 _tokenId, uint256 _bidAmount)
    internal
    returns (uint256)
    {
        // Get a reference to the auction struct
        Auction storage auction = tokenIdToAuction[_tokenId];

        // Explicitly check that this auction is currently live.
        // (Because of how Ethereum mappings work, we can't just count
        // on the lookup above failing. An invalid _tokenId will just
        // return an auction object that is all zeros.)
        require(_isOnAuction(auction));

        // Check that the bid is greater than or equal to the current price
        uint256 price = _currentPrice(auction);
        require(_bidAmount >= price);

        // Grab a reference to the seller before the auction struct
        // gets deleted.
        address payable seller = auction.seller;

        // The bid is good! Remove the auction before sending the fees
        // to the sender so we can't have a reentrancy attack.
        _removeAuction(_tokenId);

        // Transfer proceeds to seller (if there are any!)
        if (price > 0) {
            // Calculate the auctioneer's cut.
            // (NOTE: _computeCut() is guaranteed to return a
            // value <= price, so this subtraction can't go negative.)
            uint256 auctioneerCut = _computeCut(price);
            uint256 sellerProceeds = price - auctioneerCut;

            // NOTE: Doing a transfer() in the middle of a complex
            // method like this is generally discouraged because of
            // reentrancy attacks and DoS attacks if the seller is
            // a contract with an invalid fallback function. We explicitly
            // guard against reentrancy attacks by removing the auction
            // before calling transfer(), and the only thing the seller
            // can DoS is the sale of their own asset! (And if it's an
            // accident, they can call cancelAuction(). )
            seller.transfer(sellerProceeds);
        }

        // Calculate any excess funds included with the bid. If the excess
        // is anything worth worrying about, transfer it back to bidder.
        // NOTE: We checked above that the bid amount is greater than or
        // equal to the price so this cannot underflow.
        uint256 bidExcess = _bidAmount - price;

        // Return the funds. Similar to the previous transfer, this is
        // not susceptible to a re-entry attack because the auction is
        // removed before any transfers occur.
        msg.sender.transfer(bidExcess);

        // Tell the world!
        emit AuctionSuccessful(_tokenId, price, msg.sender, seller);

        return price;
    }

    /// @dev Removes an auction from the list of open auctions.
    /// @param _tokenId - ID of NFT on auction.
    function _removeAuction(uint256 _tokenId) internal {
        delete tokenIdToAuction[_tokenId];
    }

    /// @dev Returns true if the NFT is on auction.
    /// @param _auction - Auction to check.
    function _isOnAuction(Auction storage _auction) internal view returns (bool) {
        return (_auction.startedAt > 0);
    }

    /// @dev Returns current price of an NFT on auction. Broken into two
    ///  functions (this one, that computes the duration from the auction
    ///  structure, and the other that does the price computation) so we
    ///  can easily test that the price computation works correctly.
    function _currentPrice(Auction storage _auction)
    internal
    view
    returns (uint256)
    {
        uint256 secondsPassed = 0;

        // A bit of insurance against negative values (or wraparound).
        // Probably not necessary (since Ethereum guarnatees that the
        // now variable doesn't ever go backwards).
        if (now > _auction.startedAt) {
            secondsPassed = now - _auction.startedAt;
        }

        return _computeCurrentPrice(
            _auction.startingPrice,
            _auction.endingPrice,
            _auction.duration,
            secondsPassed
        );
    }

    /// @dev Computes the current price of an auction. Factored out
    ///  from _currentPrice so we can run extensive unit tests.
    ///  When testing, make this function public and turn on
    ///  `Current price computation` test suite.
    function _computeCurrentPrice(
        uint256 _startingPrice,
        uint256 _endingPrice,
        uint256 _duration,
        uint256 _secondsPassed
    )
    internal
    pure
    returns (uint256)
    {
        // NOTE: We don't use SafeMath (or similar) in this function because
        //  all of our public functions carefully cap the maximum values for
        //  time (at 64-bits) and currency (at 128-bits). _duration is
        //  also known to be non-zero (see the require() statement in
        //  _addAuction())
        if (_secondsPassed >= _duration) {
            // We've reached the end of the dynamic pricing portion
            // of the auction, just return the end price.
            return _endingPrice;
        } else {
            // Starting price can be higher than ending price (and often is!), so
            // this delta can be negative.
            int256 totalPriceChange = int256(_endingPrice) - int256(_startingPrice);

            // This multiplication can't overflow, _secondsPassed will easily fit within
            // 64-bits, and totalPriceChange will easily fit within 128-bits, their product
            // will always fit within 256-bits.
            int256 currentPriceChange = totalPriceChange * int256(_secondsPassed) / int256(_duration);

            // currentPriceChange can be negative, but if so, will have a magnitude
            // less that _startingPrice. Thus, this result will always end up positive.
            int256 currentPrice = int256(_startingPrice) + currentPriceChange;

            return uint256(currentPrice);
        }
    }

    /// @dev Computes owner's cut of a sale.
    /// @param _price - Sale price of NFT.
    function _computeCut(uint256 _price) internal view returns (uint256) {
        // NOTE: We don't use SafeMath (or similar) in this function because
        //  all of our entry functions carefully cap the maximum values for
        //  currency (at 128-bits), and ownerCut <= 10000 (see the require()
        //  statement in the ClockAuction constructor). The result of this
        //  function is always guaranteed to be <= _price.
        return _price * ownerCut / 10000;
    }
}

// File: contracts/ClockAuction.sol

pragma solidity ^0.5.10;



contract ClockAuction is Pausable, ClockAuctionBase {

    /// @dev The ERC-165 interface signature for ERC-721.
    ///  Ref: https://github.com/ethereum/EIPs/issues/165
    ///  Ref: https://github.com/ethereum/EIPs/issues/721
    //bytes4 constant InterfaceSignature_ERC721 = bytes4(0x5b5e139f);
    bytes4 constant InterfaceSignature_ERC721 = bytes4(0x80ac58cd);

    /// @dev Constructor creates a reference to the NFT ownership contract
    ///  and verifies the owner cut is in the valid range.
    /// @param _nftAddress - address of a deployed contract implementing
    ///  the Nonfungible Interface.
    /// @param _cut - percent cut the owner takes on each auction, must be
    ///  between 0-10,000.
    constructor (address _nftAddress, uint256 _cut) public {
        require(_cut <= 10000);
        ownerCut = _cut;

        ceoAddress = msg.sender;
        cfoAddress = msg.sender;

        DragonERC721 candidateContract = DragonERC721(_nftAddress);
        //require(candidateContract.supportsInterface(InterfaceSignature_ERC721));
        nonFungibleContract = candidateContract;
    }


    /// @dev Remove all Ether from the contract, which is the owner's cuts
    ///  as well as any Ether sent directly to the contract address.
    ///  Always transfers to the NFT contract, but can be called either by
    ///  the owner or the NFT contract.
    function withdrawBalance() external {
        address payable nftAddress = address(uint160(address(nonFungibleContract)));

        require(
            msg.sender == owner ||
            msg.sender == nftAddress
        );
        // We are using this boolean method to make sure that even if one fails it will still work
        //bool res = nftAddress.send(address(this).balance);
        nftAddress.transfer(address(this).balance);
    }

    /// @dev Creates and begins a new auction.
    /// @param _tokenId - ID of token to auction, sender must be owner.
    /// @param _startingPrice - Price of item (in wei) at beginning of auction.
    /// @param _endingPrice - Price of item (in wei) at end of auction.
    /// @param _duration - Length of time to move between starting
    ///  price and ending price (in seconds).
    /// @param _seller - Seller, if not the message sender
    function createAuction(
        uint256 _tokenId,
        uint256 _startingPrice,
        uint256 _endingPrice,
        uint256 _duration,
        address payable _seller
    )
    external
    whenNotPaused
    {
        // Sanity check that no inputs overflow how many bits we've allocated
        // to store them in the auction struct.
        require(_startingPrice == uint256(uint128(_startingPrice)));
        require(_endingPrice == uint256(uint128(_endingPrice)));
        require(_duration == uint256(uint64(_duration)));

        require(_owns(msg.sender, _tokenId));
        _escrow(msg.sender, _tokenId);
        Auction memory auction = Auction(
            _seller,
            uint128(_startingPrice),
            uint128(_endingPrice),
            uint64(_duration),
            uint64(now)
        );
        _addAuction(_tokenId, auction);
    }

    /// @dev Bids on an open auction, completing the auction and transferring
    ///  ownership of the NFT if enough Ether is supplied.
    /// @param _tokenId - ID of token to bid on.
    function bid(uint256 _tokenId)
    external
    payable
    whenNotPaused
    {
        // _bid will throw if the bid or funds transfer fails
        _bid(_tokenId, msg.value);
        _transfer(msg.sender, _tokenId);
    }

    /// @dev Cancels an auction that hasn't been won yet.
    ///  Returns the NFT to original owner.
    /// @notice This is a state-modifying function that can
    ///  be called while the contract is paused.
    /// @param _tokenId - ID of token on auction
    function cancelAuction(uint256 _tokenId)
    external
    {
        Auction storage auction = tokenIdToAuction[_tokenId];
        require(_isOnAuction(auction));
        address seller = auction.seller;
        require(msg.sender == seller || msg.sender == address(nonFungibleContract));
        _cancelAuction(_tokenId, seller);
    }

    /// @dev Cancels an auction when the contract is paused.
    ///  Only the owner may do this, and NFTs are returned to
    ///  the seller. This should only be used in emergencies.
    /// @param _tokenId - ID of the NFT on auction to cancel.
    function cancelAuctionWhenPaused(uint256 _tokenId)
    whenPaused
    onlyOwner
    external
    {
        Auction storage auction = tokenIdToAuction[_tokenId];
        require(_isOnAuction(auction));
        _cancelAuction(_tokenId, auction.seller);
    }

    /// @dev Returns auction info for an NFT on auction.
    /// @param _tokenId - ID of NFT on auction.
    function getAuction(uint256 _tokenId)
    external
    view
    returns
    (
        address payable seller,
        uint256 startingPrice,
        uint256 endingPrice,
        uint256 duration,
        uint256 startedAt
    ) {
        Auction storage auction = tokenIdToAuction[_tokenId];
        require(_isOnAuction(auction));
        return (
        auction.seller,
        auction.startingPrice,
        auction.endingPrice,
        auction.duration,
        auction.startedAt
        );
    }

    /// @dev Returns the current price of an auction.
    /// @param _tokenId - ID of the token price we are checking.
    function getCurrentPrice(uint256 _tokenId)
    external
    view
    returns (uint256)
    {
        Auction storage auction = tokenIdToAuction[_tokenId];
        require(_isOnAuction(auction));
        return _currentPrice(auction);
    }
}

// File: contracts/SaleClockAuction.sol

pragma solidity ^0.5.10;


contract SaleClockAuction is ClockAuction {

    // @dev Sanity check that allows us to ensure that we are pointing to the
    //  right auction in our setSaleAuctionAddress() call.
    bool public isSaleClockAuction = true;

    // Delegate constructor
    constructor(address _nftAddr, uint256 _cut) public
    ClockAuction(_nftAddr, _cut) {}

    /// @dev Creates and begins a new auction.
    /// @param _tokenId - ID of token to auction, sender must be owner.
    /// @param _startingPrice - Price of item (in wei) at beginning of auction.
    /// @param _endingPrice - Price of item (in wei) at end of auction.
    /// @param _duration - Length of auction (in seconds).
    /// @param _seller - Seller, if not the message sender
    function createAuction(
        uint256 _tokenId,
        uint256 _startingPrice,
        uint256 _endingPrice,
        uint256 _duration,
        address payable _seller
    )
    external
    {
        // Sanity check that no inputs overflow how many bits we've allocated
        // to store them in the auction struct.
        require(_startingPrice == uint256(uint128(_startingPrice)));
        require(_endingPrice == uint256(uint128(_endingPrice)));
        require(_duration == uint256(uint64(_duration)));

        require(msg.sender == address(nonFungibleContract));
        _escrow(_seller, _tokenId);

        Auction memory auction = Auction(
            _seller,
            uint128(_startingPrice),
            uint128(_endingPrice),
            uint64(_duration),
            uint64(now)
        );
        _addAuction(_tokenId, auction);
    }

    /// @dev Updates lastSalePrice if seller is the nft contract
    /// Otherwise, works the same as default bid method.
    function bid(uint256 _tokenId)
    external
    payable
    {
        // _bid verifies token ID size
        _bid(_tokenId, msg.value);
        _transfer(msg.sender, _tokenId);
    }

    function setOwnerCut(uint256 val) external onlyCEOCFO {
        ownerCut = val;
    }
}

// File: contracts/SiringClockAuction.sol

pragma solidity ^0.5.10;


contract SiringClockAuction is ClockAuction {

    // @dev Sanity check that allows us to ensure that we are pointing to the
    //  right auction in our setSiringAuctionAddress() call.
    bool public isSiringClockAuction = true;

    // Delegate constructor
    constructor(address _nftAddr, uint256 _cut) public
    ClockAuction(_nftAddr, _cut) {}

    /// @dev Creates and begins a new auction. Since this function is wrapped,
    /// require sender to be DragonCore contract.
    /// @param _tokenId - ID of token to auction, sender must be owner.
    /// @param _startingPrice - Price of item (in wei) at beginning of auction.
    /// @param _endingPrice - Price of item (in wei) at end of auction.
    /// @param _duration - Length of auction (in seconds).
    /// @param _seller - Seller, if not the message sender
    function createAuction(
        uint256 _tokenId,
        uint256 _startingPrice,
        uint256 _endingPrice,
        uint256 _duration,
        address payable _seller
    )
    external
    {
        // Sanity check that no inputs overflow how many bits we've allocated
        // to store them in the auction struct.
        require(_startingPrice == uint256(uint128(_startingPrice)));
        require(_endingPrice == uint256(uint128(_endingPrice)));
        require(_duration == uint256(uint64(_duration)));

        require(msg.sender == address(nonFungibleContract));
        _escrow(_seller, _tokenId);
        Auction memory auction = Auction(
            _seller,
            uint128(_startingPrice),
            uint128(_endingPrice),
            uint64(_duration),
            uint64(now)
        );
        _addAuction(_tokenId, auction);
    }

    /// @dev Places a bid for siring. Requires the sender
    /// is the DragonCore contract because all bid methods
    /// should be wrapped. Also returns the Dragon to the
    /// seller rather than the winner.
    function bid(uint256 _tokenId)
    external
    payable
    {
        require(msg.sender == address(nonFungibleContract));
        address seller = tokenIdToAuction[_tokenId].seller;
        // _bid checks that token ID is valid and will throw if bid fails
        _bid(_tokenId, msg.value);
        // We transfer the dragon back to the seller, the winner will get
        // the offspring
        _transfer(seller, _tokenId);
    }

    function setOwnerCut(uint256 val) external onlyCEOCFO {
        ownerCut = val;
    }

}

// File: contracts/DragonBase.sol

pragma solidity ^0.5.10;





contract DragonBase is DragonAccessControl, DragonERC721 {

    event Birth(address owner, uint256 dragonId, uint256 matronId, uint256 sireId, uint256 dna, uint32 generation, uint64 runeLevel);
    event DragonAssetsUpdated(uint256 _dragonId, uint64 _rune, uint64 _agility, uint64 _strength, uint64 _intelligence);
    event DragonAssetRequest(uint256 _dragonId);
    //event Transfer(address from, address to, uint256 tokenId, uint32 generation);

    struct Dragon {
        // The Dragon's genetic code is packed into these 256-bits.
        uint256 dna;
        uint64 birthTime;
        uint64 breedTime;
        uint32 matronId;
        uint32 sireId;
        uint32 siringWithId;
        uint32 generation;
    }

    struct DragonAssets {
        uint64 runeLevel;
        uint64 agility;
        uint64 strength;
        uint64 intelligence;
    }

    Dragon[] dragons;
    mapping (uint256 => address) public dragonIndexToOwner;
    mapping (address => uint256) ownershipTokenCount;
    mapping (uint256 => address) public dragonIndexToApproved;
    mapping (uint256 => address) public sireAllowedToAddress;
    mapping (uint256 => DragonAssets) public dragonAssets;

    mapping (address => mapping (address => bool)) internal authorised;

    uint256 public updateAssetFee = 8 finney;

    SaleClockAuction public saleAuction;
    SiringClockAuction public siringAuction;

    modifier isValidToken(uint256 _tokenId) {
        require(dragonIndexToOwner[_tokenId] != address(0));
        _;
    }

    /// @dev Assigns ownership of a specific Dragon to an address.
    function _transfer(address _from, address _to, uint256 _tokenId) internal {
        // Since the number of dragons is capped to 2^32 we can't overflow this
        // Declaration: mapping (address => uint256) ownershipTokenCount;
        ownershipTokenCount[_to]++;
        // transfer ownership
        // Declaration: mapping (uint256 => address) public dragonIndexToOwner;
        dragonIndexToOwner[_tokenId] = _to;
        // When creating new dragons _from is 0x0, but we can't account that address.
        if (_from != address(0)) {
            ownershipTokenCount[_from]--;
            // once the dragon is transferred also clear sire allowances
            delete sireAllowedToAddress[_tokenId];
            // clear any previously approved ownership exchange
            delete dragonIndexToApproved[_tokenId];
        }

        //Dragon storage dragon = dragons[_tokenId];

        // Emit the transfer event.
        emit Transfer(_from, _to, _tokenId);
    }

    /// @dev An internal method that creates a new dragon and stores it. This
    ///  method doesn't do any checking and should only be called when the
    ///  input data is known to be valid. Will generate both a Birth event
    ///  and a Transfer event.
    /// @param _matronId The dragon ID of the matron of this dragon (zero for firstGen)
    /// @param _sireId The dragon ID of the sire of this dragon (zero for firstGen)
    /// @param _generation The generation number of this dragon, must be computed by caller.
    /// @param _dna The dragon's genetic code.
    /// @param _agility The dragon's agility
    /// @param _strength The dragon's strength
    /// @param _intelligence The dragon's intelligence
    /// @param _runelevel The dragon's rune level
    /// @param _owner The inital owner of this dragon, must be non-zero (except for the mythical beast, ID 0)
    function _createDragon(
        uint256 _matronId,
        uint256 _sireId,
        uint256 _generation,
        uint256 _dna,
        uint64 _agility,
        uint64 _strength,
        uint64 _intelligence,
        uint64 _runelevel,
        address _owner
    )
    internal
    returns (uint)
    {
        require(_matronId == uint256(uint32(_matronId)));
        require(_sireId == uint256(uint32(_sireId)));
        require(_generation == uint256(uint32(_generation)));

        Dragon memory _dragon = Dragon({
            dna: _dna,
            birthTime: uint64(now),
            breedTime: 0,
            matronId: uint32(_matronId),
            sireId: uint32(_sireId),
            siringWithId: 0,
            generation: uint32(_generation)
            });

        DragonAssets memory _dragonAssets = DragonAssets({
            runeLevel: _runelevel,
            agility: _agility,
            strength: _strength,
            intelligence: _intelligence
            });

        uint256 newDragonId = dragons.push(_dragon) - 1;

        dragonAssets[newDragonId] = _dragonAssets;

        // It's probably never going to happen, 4 billion dragons is A LOT, but
        // let's just be 100% sure we never let this happen.
        require(newDragonId == uint256(uint32(newDragonId)));

        // emit the birth event
        emit Birth(
            _owner,
            newDragonId,
            uint256(_dragon.matronId),
            uint256(_dragon.sireId),
            _dragon.dna,
            _dragon.generation,
            _runelevel
        );

        // This will assign ownership, and also emit the Transfer event as
        // per ERC721 draft
        _transfer(address(0), _owner, newDragonId);

        return newDragonId;
    }

    function setUpdateAssetFee(uint256 newFee) external onlyCLevel {
        updateAssetFee = newFee;
    }


    function updateDragonAsset(uint256 _dragonId, uint64 _rune, uint64 _agility, uint64 _strength, uint64 _intelligence)
    external
    whenNotPaused
    onlyCOO
    {

        DragonAssets storage currentDragonAsset = dragonAssets[_dragonId];

        require(_rune > currentDragonAsset.runeLevel);
        require(_agility >= currentDragonAsset.agility);
        require(_strength >= currentDragonAsset.strength);
        require(_intelligence >= currentDragonAsset.intelligence);

        DragonAssets memory _dragonAsset = DragonAssets({
            runeLevel: _rune,
            agility: _agility,
            strength: _strength,
            intelligence: _intelligence
            });

        dragonAssets[_dragonId] = _dragonAsset;
        msg.sender.transfer(updateAssetFee);
        emit DragonAssetsUpdated(_dragonId, _rune, _agility, _strength, _intelligence);

    }

    function requestAssetUpdate(uint256 _dragonId, uint256 _rune)
    external
    payable
    whenNotPaused
    {
        require(msg.value >= updateAssetFee);

        DragonAssets storage currentDragonAsset = dragonAssets[_dragonId];
        require(_rune > currentDragonAsset.runeLevel);

        emit DragonAssetRequest(_dragonId);

        //assetManagement.requestAssetUpdate.value(msg.value)(_dragonId);
    }

    /// @notice Query if an address is an authorized operator for another address
    /// @param _owner The address that owns the NFTs
    /// @param _operator The address that acts on behalf of the owner
    /// @return True if `_operator` is an approved operator for `_owner`, false otherwise
    function isApprovedForAll(address _owner, address _operator) external view returns (bool)
    {
        return authorised[_owner][_operator];
    }

    /// @notice Enable or disable approval for a third party ("operator") to manage
    ///  all of `msg.sender`'s assets
    /// @dev Emits the ApprovalForAll event. The contract MUST allow
    ///  multiple operators per owner.
    /// @param _operator Address to add to the set of authorized operators
    /// @param _approved True if the operator is approved, false to revoke approval
    function setApprovalForAll(address _operator, bool _approved) external
    {
        emit ApprovalForAll(msg.sender,_operator, _approved);
        authorised[msg.sender][_operator] = _approved;
    }

    function tokenURI(uint256 _tokenId) external view isValidToken(_tokenId) returns (string memory)
    {
        uint maxlength = 78;
        bytes memory reversed = new bytes(maxlength);
        uint i = 0;
        uint _tmpTokenId = _tokenId;
        uint _offset = 48;

        bytes memory _uriBase;
        _uriBase = bytes(tokenURIPrefix);

        while (_tmpTokenId != 0) {
            uint remainder = _tmpTokenId % 10;
            _tmpTokenId = _tmpTokenId / 10;
            reversed[i++] = byte(uint8(_offset + remainder));
        }

        bytes memory s = new bytes(_uriBase.length + i);
        uint j;

        //add the base to the final array
        for (j = 0; j < _uriBase.length; j++) {
            s[j] = _uriBase[j];
        }
        //add the tokenId to the final array
        for (j = 0; j < i; j++) {
            s[j + _uriBase.length] = reversed[i - 1 - j];
        }
        //turn it into a string and return it
        return string(s);
    }
}

// File: contracts/DragonOwnership.sol

pragma solidity ^0.5.10;


/// @title The facet of the BlockDragons core contract that manages ownership, ERC-721 (draft) compliant.
/// @author Zynappse Corporation (https://www.zynapse.com)
/// @dev Ref: https://github.com/ethereum/EIPs/issues/721
///  @dev Refer to the Dragon contract documentation for details in contract interactions.
contract DragonOwnership is DragonBase {

    /// @notice Name and symbol of the non fungible token, as defined in ERC721.
    string public constant name = "Drakons";
    string public constant symbol = "DRKNS";

    //bytes4 constant InterfaceSignature_ERC165 = bytes4(keccak256('supportsInterface(bytes4)'));

    //bytes4 constant InterfaceSignature_ERC721 =
    //bytes4(keccak256('name()')) ^
    //bytes4(keccak256('symbol()')) ^
    //bytes4(keccak256('totalSupply()')) ^
    //bytes4(keccak256('balanceOf(address)')) ^
    //bytes4(keccak256('ownerOf(uint256)')) ^
    //bytes4(keccak256('approve(address,uint256)')) ^
    //bytes4(keccak256('transfer(address,uint256)')) ^
    //bytes4(keccak256('transferFrom(address,address,uint256)')) ^
    //bytes4(keccak256('tokensOfOwner(address)')) ^
    //bytes4(keccak256('tokenMetadata(uint256,string)'));

    /// @notice Introspection interface as per ERC-165 (https://github.com/ethereum/EIPs/issues/165).
    ///  Returns true for any standardized interfaces implemented by this contract. We implement
    ///  ERC-165 (obviously!) and ERC-721.
    //function supportsInterface(bytes4 _interfaceID) external view returns (bool)
    //{
    //    return ((_interfaceID == InterfaceSignature_ERC165) || (_interfaceID == InterfaceSignature_ERC721));
    //}

    function setTokenURIAffixes(string calldata _prefix, string calldata _suffix) external onlyCEO {
        tokenURIPrefix = _prefix;
        tokenURISuffix = _suffix;
    }

    /// @dev Checks if a given address is the current owner of a particular Dragon.
    /// @param _claimant the address we are validating against.
    /// @param _tokenId dragon id, only valid when > 0
    function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
        return dragonIndexToOwner[_tokenId] == _claimant;
    }

    /// @dev Checks if a given address currently has transferApproval for a particular Dragon.
    /// @param _claimant the address we are confirming dragon is approved for.
    /// @param _tokenId dragon id, only valid when > 0
    function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) {
        return dragonIndexToApproved[_tokenId] == _claimant;
    }

    /// @dev Marks an address as being approved for transferFrom(), overwriting any previous
    ///  approval. Setting _approved to address(0) clears all transfer approval.
    ///  NOTE: _approve() does NOT send the Approval event. This is intentional because
    ///  _approve() and transferFrom() are used together for putting Dragons on auction, and
    ///  there is no value in spamming the log with Approval events in that case.
    function _approve(uint256 _tokenId, a...

// [truncated — 88295 bytes total]

Read Contract

BREEDING_LIMIT 0x8368071c → uint32
autoBirthFee 0xb0c35c05 → uint256
balanceOf 0x70a08231 → uint256
canBreedWith 0x46d22c70 → bool
ceoAddress 0x0a0f8168 → address
cfoAddress 0x0519ce79 → address
cioAddress 0x6059c384 → address
cmoAddress 0x8c267b97 → address
cooAddress 0xb047fb50 → address
dragonAssets 0x100b2783 → uint64, uint64, uint64, uint64
dragonIndexToApproved 0x71f7aaca → address
dragonIndexToOwner 0x5d64aa68 → address
getApproved 0x081812fc → address
getAuctionBalances 0xe6be9b56 → uint256, uint256
getBalance 0x12065fe0 → uint256
getDragon 0xe0bb933b → uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256
getPregnantDragons 0x2e1699d7 → uint256[]
isApprovedForAll 0xe985e9c5 → bool
isPregnant 0x1940a936 → bool
isReadyToBreed 0xd3e6f49f → bool
name 0x06fdde03 → string
newContractAddress 0x6af04a57 → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
pregnantDragons 0x05ea0668 → uint256
saleAuction 0xe6cbe351 → address
sireAllowedToAddress 0x46116e6f → address
siringAuction 0x21717ebf → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
tokenURIPrefix 0xc0ac9983 → string
tokenURISuffix 0xdbbc853b → string
tokensOfOwner 0x8462151c → uint256[]
totalSupply 0x18160ddd → uint256
updateAssetFee 0xe8de704d → uint256

Write Contract 33 functions

These functions modify contract state and require a wallet transaction to execute.

approve 0x095ea7b3
address _approved
uint256 _tokenId
approveSiring 0x4dfff04f
address _addr
uint256 _sireId
bidOnSiringAuction 0xed60ade6
uint256 _sireId
uint256 _matronId
breedWithAuto 0xf7d8c883
uint256 _matronId
uint256 _sireId
createGen0Auction 0x2a896ece
uint256 _dna
uint256 _startingPrice
uint256 _endingPrice
uint64 _agility
uint64 _strength
uint64 _intelligence
uint256 _duration
createPromoDragon 0x78c234e0
uint256 _dna
uint64 _agility
uint64 _strength
uint64 _intelligence
uint64 _runelevel
address _owner
createSaleAuction 0x3d7d3f5a
uint256 _dragonId
uint256 _startingPrice
uint256 _endingPrice
uint256 _duration
createSiringAuction 0x4ad8c938
uint256 _dragonId
uint256 _startingPrice
uint256 _endingPrice
uint256 _duration
giveBirth 0xd1741a8c
uint256 _matronId
uint256 _dna
uint64 _agility
uint64 _strength
uint64 _intelligence
uint64 _runelevel
returns: uint256
onERC721Received 0x150b7a02
address _operator
address _from
uint256 _tokenId
bytes _data
returns: bytes4
pause 0x8456cb59
No parameters
requestAssetUpdate 0xfaa0ae53
uint256 _dragonId
uint256 _rune
safeTransferFrom 0x42842e0e
address _from
address _to
uint256 _tokenId
safeTransferFrom 0xb88d4fde
address _from
address _to
uint256 _tokenId
bytes data
setApprovalForAll 0xa22cb465
address _operator
bool _approved
setAutoBirthFee 0x4b85fd55
uint256 val
setBreedingLimit 0x92695a88
uint32 _value
setCEO 0x27d7874c
address _newCEO
setCFO 0x4e0a3379
address _newCFO
setCIO 0x416da145
address _newCIO
setCMO 0x2072863b
address _newCMO
setCOO 0x2ba73c15
address _newCOO
setNewAddress 0x71587988
address _newAddress
setSaleAuctionAddress 0x6fbde40d
address _address
setSiringAuctionAddress 0x14001f4c
address _address
setTokenURIAffixes 0xfaf42125
string _prefix
string _suffix
setUpdateAssetFee 0x0304b213
uint256 newFee
transfer 0xa9059cbb
address _to
uint256 _tokenId
transferFrom 0x23b872dd
address _from
address _to
uint256 _tokenId
unpause 0x3f4ba83a
No parameters
updateDragonAsset 0x15437dfb
uint256 _dragonId
uint64 _rune
uint64 _agility
uint64 _strength
uint64 _intelligence
withdrawAuctionBalances 0x91876e57
No parameters
withdrawBalance 0x5fd8c710
No parameters

Recent Transactions

No transactions found for this address