Address Contract Partially Verified
Address
0xeFabE332D31c3982B76F8630a306C960169bD5b3
Balance
2.4210 ETH
Nonce
1
Code Size
14993 bytes
Creator
0xc4F3fE57...5152 at tx 0xd99a3910...5a597a
Indexed Transactions
0
Contract Bytecode
14993 bytes
0x60606040526004361061028f5763ffffffff60e060020a60003504166306fdde038114610294578063086013c01461031e578063095ea7b3146103505780630dd5127d1461038657806318160ddd146103b25780631d36e06c146103d757806323b872dd146103ed57806324b77f0514610417578063293c6a3a1461043057806329a40403146104525780632e1a7d4d1461047757806333a8c45a1461048d578063372e80c3146104a05780633733b378146104b35780633791792a146104e457806340a19a711461051b57806340ae7a5c1461052e57806340b8783d1461056c578063435ad5c1146105885780634bd8ae6f146105f457806359828c99146106105780636352211e146106235780636533b4bb14610639578063686996a31461064f5780636a8979991461066557806370740aab1461067e57806370a082311461069157806370f6956a146106b057806374f6c562146106df5780637712c870146106f55780638462151c146107085780638da5cb5b1461077a57806395d89b411461078d5780639e281a98146107a0578063a591398b146107c2578063a6c3e6b9146107d8578063a716144a146107eb578063a8bd9c321461084e578063a9059cbb14610864578063b20cf6fe14610886578063b6ef78c21461089f578063c31fa083146108b8578063d7959cf914610909578063da87c9691461091c578063dc45bfb314610932578063dd59c9541461093d578063ddc6a1711461096b578063de150d5d1461098d578063e1757a3c146109a9578063e4b50cb8146109bc578063e6e3540714610a00578063e9db787b14610a1c578063ed86132814610a32578063f14fcbc814610a59578063f2fde38b14610a6f578063f662112114610a8e578063f903facc14610aad575b600080fd5b341561029f57600080fd5b6102a7610ac3565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156102e35780820151838201526020016102cb565b50505050905090810190601f1680156103105780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561032957600080fd5b610334600435610afa565b604051600160a060020a03909116815260200160405180910390f35b341561035b57600080fd5b610372600160a060020a0360043516602435610b1b565b604051901515815260200160405180910390f35b341561039157600080fd5b61039c600435610b95565b60405160ff909116815260200160405180910390f35b34156103bd57600080fd5b6103c5610baa565b60405190815260200160405180910390f35b34156103e257600080fd5b610334600435610bb5565b34156103f857600080fd5b610415600160a060020a0360043581169060243516604435610bd0565b005b341561042257600080fd5b610372600435602435610c40565b341561043b57600080fd5b6103c5600435600160a060020a0360243516610eb4565b341561045d57600080fd5b61037260043560243560443560643560843560a435610f65565b341561048257600080fd5b6103726004356112db565b341561049857600080fd5b6102a7611349565b34156104ab57600080fd5b61039c611380565b34156104be57600080fd5b610372600160a060020a036004351660243560443560643560843560a43560c435611385565b34156104ef57600080fd5b61037260043560243560443560643560843560a43560c43560e4356101043561012435610144356113e4565b341561052657600080fd5b61039c6115c2565b341561053957600080fd5b6105446004356115c7565b604051600160a060020a03909216825263ffffffff1660208201526040908101905180910390f35b341561057757600080fd5b610372600435602435604435611605565b341561059357600080fd5b61059e600435611766565b604051998a5260208a01989098526040808a01979097526060890195909552608088019390935260a087019190915260c086015260e0850152610100840152610120830191909152610140909101905180910390f35b34156105ff57600080fd5b6103726004356024356044356117b8565b341561061b57600080fd5b61039c611ab5565b341561062e57600080fd5b610334600435611aba565b341561064457600080fd5b6103c5600435611ade565b341561065a57600080fd5b610334600435611af0565b341561067057600080fd5b610372600435602435611b0b565b341561068957600080fd5b6102a7611e7a565b341561069c57600080fd5b6103c5600160a060020a0360043516611eb1565b34156106bb57600080fd5b6106c6600435611ecc565b60405163ffffffff909116815260200160405180910390f35b34156106ea57600080fd5b6106c6600435611ee4565b341561070057600080fd5b610334611efc565b341561071357600080fd5b610727600160a060020a0360043516611f0b565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561076657808201518382015260200161074e565b505050509050019250505060405180910390f35b341561078557600080fd5b610334611fec565b341561079857600080fd5b6102a7611ffb565b34156107ab57600080fd5b610372600160a060020a0360043516602435612032565b34156107cd57600080fd5b61039c6004356120c9565b34156107e357600080fd5b6102a76120de565b34156107f657600080fd5b610801600435612115565b604051600160a060020a03909716875263ffffffff90951660208701526040808701949094526060860192909252608085015260a084015260c083019190915260e0909101905180910390f35b341561085957600080fd5b610334600435612172565b341561086f57600080fd5b610415600160a060020a036004351660243561218d565b341561089157600080fd5b6103c56004356024356121e7565b34156108aa57600080fd5b610372600435602435612209565b34156108c357600080fd5b61037260046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506122ef95505050505050565b341561091457600080fd5b6102a76123d3565b341561092757600080fd5b6103c5600435612471565b610372600435612483565b341561094857600080fd5b610372600435602435604435606435608435600160a060020a0360a43516612652565b341561097657600080fd5b610372600160a060020a03600435166024356128ab565b341561099857600080fd5b6103726004356024356044356128be565b34156109b457600080fd5b61039c612ec0565b34156109c757600080fd5b6109d2600435612ec5565b604051600160a060020a03909316835260208301919091526040808301919091526060909101905180910390f35b3415610a0b57600080fd5b610372600435602435604435612f12565b3415610a2757600080fd5b610372600435613014565b3415610a3d57600080fd5b61037260043560243560443560643560843560a43515156130db565b3415610a6457600080fd5b6103c5600435613402565b3415610a7a57600080fd5b610415600160a060020a0360043516613414565b3415610a9957600080fd5b610372600160a060020a03600435166134a2565b3415610ab857600080fd5b6103c56004356134fb565b60408051908101604052600881527f43727970746f6773000000000000000000000000000000000000000000000000602082015281565b6000818152600a6020526040902060050154600160a060020a03165b919050565b6000610b27338361350d565b1515610b3257600080fd5b610b3c828461352d565b7f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925338484604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a150600192915050565b600e6020526000908152604090205460ff1681565b600654600019015b90565b600060208190529081526040902054600160a060020a031681565b600160a060020a0382161515610be557600080fd5b30600160a060020a031682600160a060020a031614151515610c0657600080fd5b610c10338261355b565b1515610c1b57600080fd5b610c25838261350d565b1515610c3057600080fd5b610c3b83838361357b565b505050565b6000828152600a6020526040812060050154819033600160a060020a03908116911614610c6c57600080fd5b6000838152600b60205260409020548414610c8657600080fd5b6000848152600d602052604090205460ff1615610ca257600080fd5b50600580546000858152600a60205260408082208683529181902093840154600160a060020a0393841694859463291cef95943394909390911691905163ffffffff861660e060020a028152600160a060020a038516600482019081529060c481019085906024015b815481526020019060010190808311610d0b575050600160a060020a038416815260c081019083906020015b815481526020019060010190808311610d37575050945050505050602060405180830381600087803b1515610d6b57600080fd5b5af11515610d7857600080fd5b505050604051805190501515610d8d57600080fd5b6000848152600f60209081526040808320805463ffffffff431663ffffffff19909116179055858352600a8083528184206005808201548a8752601186528487208054600160a060020a031916600160a060020a03928316179055600d8652848720805460ff19166001908117909155600c87528588208b90559386528487208054601290975296859020958655825486850155868401546002808801919091559383015460038088019190915584880154600480890191909155948401549287019290925581870154600687015590820154600786015594820154600885015501546009909201919091558491869133909116907fdd7fd1363175947f3a52d7ffa23edbf873a9960b97f9f425fd4846acd371b360905160405180910390a45092915050565b600354600090819033600160a060020a03908116911614610ed457600080fd5b610edd84613650565b9050610eeb6000848361357b565b600080516020613a46833981519152600682815481101515610f0957fe5b600091825260208083209091015484835290829052604091829020549091600160a060020a0390911690849051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a19392505050565b600080610f70613832565b600554600160a060020a03161515610f8757600080fd5b60008881526020819052604090205433600160a060020a03908116911614610fae57600080fd5b60008781526020819052604090205433600160a060020a03908116911614610fd557600080fd5b60008681526020819052604090205433600160a060020a03908116911614610ffc57600080fd5b60008581526020819052604090205433600160a060020a0390811691161461102357600080fd5b60008481526020819052604090205433600160a060020a0390811691161461104a57600080fd5b60055461106090600160a060020a031689610b1b565b151561106b57600080fd5b60055461108190600160a060020a031688610b1b565b151561108c57600080fd5b6005546110a290600160a060020a031687610b1b565b15156110ad57600080fd5b6005546110c390600160a060020a031686610b1b565b15156110ce57600080fd5b6005546110e490600160a060020a031685610b1b565b15156110ef57600080fd5b6000898152600a602052604090206005015433600160a060020a039081169116141561111a57600080fd5b60098054600181019091553389604051928352600160a060020a03919091166c0100000000000000000000000002602083015260348201526054016040518091039020915060a06040519081016040528089815260200188815260200187815260200186815260200185815250905060606040519081016040908152828252600160a060020a03331660208084019190915263ffffffff4316828401526000858152600a9091522081516111d19082906005613859565b506020820151600582018054600160a060020a031916600160a060020a039290921691909117905560408201516005909101805463ffffffff92909216740100000000000000000000000000000000000000000277ffffffff000000000000000000000000000000000000000019909216919091179055506000828152600b6020526040908190208a905589904290600160a060020a033316907f47b61bcc3ca214175c4da7b195cc77174276ab281a2dc346245aa7dcf9289ad29086908d908d908d908d908d905195865260208601949094526040808601939093526060850191909152608084015260a083019190915260c0909101905180910390a450509695505050505050565b60035460009033600160a060020a039081169116146112f957600080fd5b600160a060020a033016318290101561131157600080fd5b600354600160a060020a031682156108fc0283604051600060405180830381858888f19350505050151561134157fe5b506001919050565b60408051908101604052601381527f68747470733a2f2f63727970746f67732e696f00000000000000000000000000602082015281565b604081565b6000611391888861218d565b61139b888761218d565b6113a5888661218d565b6113af888561218d565b6113b9888461218d565b6113c2886136d8565b156113d6576113d6888888888888886136e0565b506001979650505050505050565b60006113ee613897565b6113f66138b2565b60035433600160a060020a0390811691161461141157600080fd5b61141a8d613650565b82526114258c613650565b60208301526114338b613650565b60408301526114418a613650565b606083015261144f89613650565b608083015261145d88613650565b60a083015261146b87613650565b60c083015261147986613650565b60e083015261148785613650565b61010083015261149684613650565b61012083015260408051908101604052808381526020018f81525090507f4a8f671d58a221ebb1bed4383288e424fe80b12424415a4f0d1a1678c46e91816001600780548060010182816114ea91906138d4565b600092835260209092208591600b02018151611509908290600a613900565b506020820151600a919091015550038f8451602086015160408701516060880151608089015160a08a015160c08b015160e08c01516101008d01516101208e01516040519b8c5260208c019a909a526040808c019990995260608b019790975260808a019590955260a089019390935260c088019190915260e0870152610100860152610120850152610140840152610160830191909152610180909101905180910390a15060019d9c50505050505050505050505050565b600181565b600a60205260009081526040902060050154600160a060020a0381169074010000000000000000000000000000000000000000900463ffffffff1682565b6000838152600a60209081526040808320600501546011909252822054600160a060020a0390811691161415611664576000838152600a602052604090206005015433600160a060020a0390811691161461165f57600080fd5b61168e565b6000848152600a602052604090206005015433600160a060020a0390811691161461168e57600080fd5b6000838152600b602052604090205484146116a857600080fd5b6000848152600c602052604090205483146116c257600080fd5b6000848152600d602052604090205460ff166003146116e057600080fd5b600084815260136020908152604080832085905560108252808320805463ffffffff431663ffffffff19909116179055600d90915290819020805460ff191660041790557fc0ff20cfe5392a20092ea7efbdcdf530829097f1647cdd9763afb3152abe66fb90859084905191825260208201526040908101905180910390a19392505050565b6000908152601260205260409020805460018201546002830154600384015460048501546005860154600687015460078801546008890154600990990154979996989597949693959294919390929190565b6000838152600a6020526040812060050154819033600160a060020a039081169116146117e457600080fd5b6000848152600b602052604090205485146117fe57600080fd5b6000858152600c6020526040902054841461181857600080fd5b6000858152600d602052604090205460ff1660021461183657600080fd5b60008581526010602052604090205463ffffffff908116439091161161185b57600080fd5b600085815260136020526040908190205490849051908152602001604051908190039020146118db576000858152600d602052604090819020805460ff191660011790557ff635b6ec989f4625e37238e46592f6b9244568bac6557b4a51e189a03ea2516b9086905190815260200160405180910390a160009150611aad565b6000858152600d60209081526040808320805460ff19908116600317909155600e83528184208054909116600117905560109091529081902054849163ffffffff90911640905191825260208201526040908101905190819003902090506002810615156119fa576000858152600f60209081526040808320805463ffffffff431663ffffffff19909116179055868352600a8083528184206005908101548a8652601185528386208054600160a060020a031916600160a060020a0392831617905591909352928190209091015487927fa099bb85eb0810506ac87658bdecae67a43f87ce335e4e7e8521342e13d9e9729291169060019051600160a060020a039092168252151560208201526040908101905180910390a2611aa8565b6000858152600f60209081526040808320805463ffffffff431663ffffffff19909116179055600a808352818420600590810154601185528386208054600160a060020a031916600160a060020a03928316179055898652919093528184209092015488937fa099bb85eb0810506ac87658bdecae67a43f87ce335e4e7e8521342e13d9e97293919091169151600160a060020a039092168252151560208201526040908101905180910390a25b600191505b509392505050565b601081565b600081815260208190526040902054600160a060020a0316801515610b1657600080fd5b60086020526000908152604090205481565b601160205260009081526040902054600160a060020a031681565b6000828152600a602052604081206005015481908190819033600160a060020a0390811691161480611b5a57506000858152600a602052604090206005015433600160a060020a039081169116145b1515611b6557600080fd5b6000858152600b60205260409020548614611b7f57600080fd5b6000868152600c60205260409020548514611b9957600080fd5b60008681526011602052604090205433600160a060020a03908116911614611bc057600080fd5b6000868152600f602052604090205460b463ffffffff90911643031015611be657600080fd5b6000868152600d6020526040902054600960ff90911610611c0657600080fd5b600092505b600a8360ff161015611cf657600086815260126020526040812060ff8516600a8110611c3357fe5b01541115611ceb57600086815260126020526040902060ff8416600a8110611c5757fe5b015460008781526012602052604081209193509060ff8516600a8110611c7957fe5b015550600554600160a060020a03168063c8f2835f338460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515611cd357600080fd5b5af11515611ce057600080fd5b505050604051805150505b600190920191611c0b565b7fe5f81b734f3f18d93d36ec80c862452fc71443fc8ebf0e47d1c6d2f1dbd892e08660405190815260200160405180910390a16000868152600d60209081526040808320805460ff1916600917905560129091528120611d559161392d565b6000868152600a6020526040812090611d6e828261393f565b506005018054600160c060020a03191690556000858152600b60209081526040808320839055600a909152812090611da6828261393f565b506005018054600160c060020a03191690556000868152600f60209081526040808320805463ffffffff19908116909155601183528184208054600160a060020a0319169055600c8352818420849055600e8352818420805460ff1916905560108352818420805490911690556013909152808220919091557ffb2a8622b9c682baa4d8b678e6733ba9de2dd0e5c64083a82ffd4ab7499094e390879087903390519283526020830191909152600160a060020a03166040808301919091526060909101905180910390a150505092915050565b60408051908101604052600981527f45544844656e7665720000000000000000000000000000000000000000000000602082015281565b600160a060020a031660009081526001602052604090205490565b600f6020526000908152604090205463ffffffff1681565b60106020526000908152604090205463ffffffff1681565b600554600160a060020a031681565b611f13613962565b6000611f1d613962565b6000806000611f2b87611eb1565b9450841515611f5b576000604051805910611f435750595b90808252806020026020018201604052509550611fe2565b84604051805910611f695750595b90808252806020026020018201604052509350611f84610baa565b925060009150600190505b828111611fde57600081815260208190526040902054600160a060020a0388811691161415611fd65780848381518110611fc557fe5b602090810290910101526001909101905b600101611f8f565b8395505b5050505050919050565b600354600160a060020a031681565b60408051908101604052600481527f504f475300000000000000000000000000000000000000000000000000000000602082015281565b600354600090819033600160a060020a0390811691161461205257600080fd5b5082600160a060020a03811663a9059cbb338560405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156120a857600080fd5b5af115156120b557600080fd5b505050604051805150600195945050505050565b600d6020526000908152604090205460ff1681565b60408051908101604052601681527f41757374696e2054686f6d617320477269666669746800000000000000000000602082015281565b6000908152600a6020526040902060058101548154600183015460028401546003850154600490950154600160a060020a038516967401000000000000000000000000000000000000000090950463ffffffff1695939492939192565b600260205260009081526040902054600160a060020a031681565b600160a060020a03821615156121a257600080fd5b30600160a060020a031682600160a060020a0316141515156121c357600080fd5b6121cd338261350d565b15156121d857600080fd5b6121e333838361357b565b5050565b601260205260008281526040902081600a811061220057fe5b01549150829050565b6000818152600a602052604081206005015433600160a060020a0390811691161461223357600080fd5b6000828152600b6020526040902054831461224d57600080fd5b6000838152600d602052604090205460ff161561226957600080fd5b6000828152600a6020526040812090612282828261393f565b506005018054600160c060020a03191690556000828152600b6020526040808220919091558390429033600160a060020a0316907f062e1030c9368c55de9601fd749b2f18ac68e0ac3a47b1efb13cab12a71e8c7d9086905190815260200160405180910390a492915050565b60035460009033600160a060020a0390811691161461230d57600080fd5b6004828051612320929160200190613974565b507f3090bde09ffb6d36f4591138ff237ad3d1b676bc501c122d6976b94f3b23bfd76004604051602080825282546002600019610100600184161502019091160490820181905281906040820190849080156123bd5780601f10612392576101008083540402835291602001916123bd565b820191906000526020600020905b8154815290600101906020018083116123a057829003601f168201915b50509250505060405180910390a1506001919050565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156124695780601f1061243e57610100808354040283529160200191612469565b820191906000526020600020905b81548152906001019060200180831161244c57829003601f168201915b505050505081565b600b6020526000908152604090205481565b600080600060078481548110151561249757fe5b90600052602060002090600b0201600a01541115156124b557600080fd5b60078054849081106124c357fe5b90600052602060002090600b0201600a015434101515156124e357600080fd5b60006007848154811015156124f457fe5b90600052602060002090600b0201600a0181905550600090505b600a8160ff1610156125c1573360008060078681548110151561252d57fe5b60009182526020909120600b9091020160ff8516600a811061254b57fe5b0154815260200190815260200160002060006101000a815481600160a060020a030219169083600160a060020a031602179055506125b960003360078681548110151561259457fe5b60009182526020909120600b9091020160ff8516600a81106125b257fe5b015461357b565b60010161250e565b60078054849081106125cf57fe5b600091825260208220600b90910201906125e9828261392d565b600a82016000905550507f77169709497f21b632c8ed22314999645df83dda13ebcc08219e82776e6ceeb83384346040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a150919050565b600354600090819033600160a060020a0390811691161461267257600080fd5b61267b88613650565b90506126896000848361357b565b6000818152602081905260409081902054600080516020613a46833981519152918a91600160a060020a031690849051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a16126ea87613650565b90506126f86000848361357b565b6000818152602081905260409081902054600080516020613a46833981519152918991600160a060020a031690849051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a161275986613650565b90506127676000848361357b565b6000818152602081905260409081902054600080516020613a46833981519152918891600160a060020a031690849051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a16127c885613650565b90506127d66000848361357b565b6000818152602081905260409081902054600080516020613a46833981519152918791600160a060020a031690849051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a161283784613650565b90506128456000848361357b565b6000818152602081905260409081902054600080516020613a46833981519152918691600160a060020a031690849051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a1506001979650505050505050565b60006128b7838361355b565b9392505050565b60006128c8613897565b6000858152600a602090815260408083206005015460119092528220548291829182918291829182918291600160a060020a03918216911614156129355760008c8152600a602052604090206005015433600160a060020a0390811691161461293057600080fd5b61295f565b60008d8152600a602052604090206005015433600160a060020a0390811691161461295f57600080fd5b60008c8152600b60205260409020548d1461297957600080fd5b60008d8152600c60205260409020548c1461299357600080fd5b60008d8152600d602052604090205460ff166004146129b157600080fd5b60008d81526010602052604090205463ffffffff90811643909116116129d657600080fd5b60008d8152601360205260409081902054908c905190815260200160405190819003902014612a2f5760008d8152600d60205260408120805460ff19166003179055612a26908e9033908c613776565b60009950612eb0565b60008d8152600d60209081526040808320805460ff19166003179055601182528083205460109092529182902054600160a060020a0390911699508c9163ffffffff90911640905191825260208201526040908101905190819003902060008e8152600a6020908152604080832060050154601190925290912054919850600160a060020a0391821691161415612b705743600f60008f6000191660001916815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff160217905550600a60008d6000191660001916815260200190815260200160002060050160009054906101000a9004600160a060020a0316601160008f6000191660001916815260200190815260200160002060006101000a815481600160a060020a030219169083600160a060020a03160217905550612bc7565b60008d8152600f60209081526040808320805463ffffffff431663ffffffff19909116179055600a82528083206005015460119092529091208054600160a060020a031916600160a060020a039092169190911790555b6001955060009450600093505b600a8460ff161015612d4c5760008d815260126020526040812060ff8616600a8110612bfc57fe5b01541115612d41576001850194879060ff1660208110612c1857fe5b60008f8152600e602052604090819020547f01000000000000000000000000000000000000000000000000000000000000009390921a830292909204945060ff90811660100290910181169084161015612d3c5760008d815260126020526040902060ff8516600a8110612c8857fe5b01549150818960ff8616600a8110612c9c57fe5b6020908102919091019190915260008e815260129091526040812060ff8616600a8110612cc557fe5b015550600554600160a060020a03168063c8f2835f338460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515612d1f57600080fd5b5af11515612d2c57600080fd5b5050506040518051905050612d41565b600095505b600190930192612bd4565b612d588d338a8c613776565b8515612e88577fe5f81b734f3f18d93d36ec80c862452fc71443fc8ebf0e47d1c6d2f1dbd892e08d60405190815260200160405180910390a160008d8152600d60209081526040808320805460ff1916600917905560129091528120612dbd9161392d565b60008d8152600a6020526040812090612dd6828261393f565b506005018054600160c060020a031916905560008c8152600b60209081526040808320839055600a909152812090612e0e828261393f565b506005018054600160c060020a031916905560008d8152600f60209081526040808320805463ffffffff19908116909155601183528184208054600160a060020a0319169055600c8352818420849055600e8352818420805460ff1916905560108352818420805490911690556013909152812055612eab565b60008d8152600e60205260409020805460ff8082166001011660ff199091161790555b600199505b5050505050505050509392505050565b60b481565b6000806000600684815481101515612ed957fe5b6000918252602080832091909101548083526008825260408084205497845291839052912054600160a060020a03169590949350915050565b6000838152600a602052604081206005015433600160a060020a03908116911614612f3c57600080fd5b6000838152600b60205260409020548414612f5657600080fd5b6000848152600c60205260409020548314612f7057600080fd5b6000848152600d602052604090205460ff16600114612f8e57600080fd5b600084815260136020908152604080832085905560108252808320805463ffffffff431663ffffffff19909116179055600d90915290819020805460ff191660021790557fe7734e0c9b6c6b123b7d035fcfbe050bf56999397e9807c82f841ebfccb16e6e90859084905191825260208201526040908101905180910390a19392505050565b6000818152600a602052604081206005015433600160a060020a0390811691161461303e57600080fd5b6000828152600d602052604090205460ff161561305a57600080fd5b6000828152600b60205260409020541561307357600080fd5b6000828152600a602052604081209061308c828261393f565b506005018054600160c060020a0319169055814233600160a060020a03167f5988b3df3495bd77e3aea1be20b1e7a4750ef0d9a31fbc97a5b18d1c76b0a5d460405160405180910390a4919050565b6000806130e6613832565b600554600160a060020a031615156130fd57600080fd5b60008981526020819052604090205433600160a060020a0390811691161461312457600080fd5b60008881526020819052604090205433600160a060020a0390811691161461314b57600080fd5b60008781526020819052604090205433600160a060020a0390811691161461317257600080fd5b60008681526020819052604090205433600160a060020a0390811691161461319957600080fd5b60008581526020819052604090205433600160a060020a039081169116146131c057600080fd5b6005546131d690600160a060020a03168a610b1b565b15156131e157600080fd5b6005546131f790600160a060020a031689610b1b565b151561320257600080fd5b60055461321890600160a060020a031688610b1b565b151561322357600080fd5b60055461323990600160a060020a031687610b1b565b151561324457600080fd5b60055461325a90600160a060020a031686610b1b565b151561326557600080fd5b600980546001810190915533604051918252600160a060020a03166c010000000000000000000000000260208201526034016040518091039020915060a0604051908101604052808a815260200189815260200188815260200187815260200186815250905060606040519081016040908152828252600160a060020a03331660208084019190915263ffffffff4316828401526000858152600a9091522081516133139082906005613859565b506020820151600582018054600160a060020a031916600160a060020a039290921691909117905560408201516005909101805463ffffffff92909216740100000000000000000000000000000000000000000277ffffffff000000000000000000000000000000000000000019909216919091179055508142600160a060020a0333167f39372912b756024e0f55c30508adca06029ca2e832fcfa2da38e30f2a0f4c3318c8c8c8c8c8c60405195865260208601949094526040808601939093526060850191909152608084015290151560a083015260c0909101905180910390a450509695505050505050565b60136020526000908152604090205481565b60035433600160a060020a0390811691161461342f57600080fd5b600160a060020a038116151561344457600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360038054600160a060020a031916600160a060020a0392909216919091179055565b60035460009033600160a060020a039081169116146134c057600080fd5b600554600160a060020a0316156134d657600080fd5b5060058054600160a060020a038316600160a060020a03199091161790556001919050565b600c6020526000908152604090205481565b600090815260208190526040902054600160a060020a0391821691161490565b6000918252600260205260409091208054600160a060020a031916600160a060020a03909216919091179055565b600090815260026020526040902054600160a060020a0391821691161490565b600160a060020a038083166000818152600160208181526040808420805490930190925585835282905290208054600160a060020a03191690911790558316156135fb57600160a060020a03831660009081526001602090815260408083208054600019019055838352600290915290208054600160a060020a03191690555b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef838383604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a1505050565b600061365a613962565b600060206040519081016040528481526006805491935060019180830161368183826139e1565b6000928352602090922085910181519055506006805492909103925060089160009190849081106136ae57fe5b60009182526020808320909101548352820192909252604001902080546001019055915050919050565b6000903b1190565b86600160a060020a03811663610b16ab3389898989898960405160e060020a63ffffffff8a16028152600160a060020a039097166004880152602487019590955260448601939093526064850191909152608484015260a483015260c482015260e401600060405180830381600087803b151561375c57600080fd5b5af1151561376957600080fd5b5050505050505050505050565b600160a060020a03828116908416857faac628e491aa8536c36958d1dc3e71f2b3acfceb21172980887d7c74bed416738451602086015160408701516060880151608089015160a08a015160c08b015160e08c01516101008d01516101208e0151604051998a5260208a01989098526040808a01979097526060890195909552608088019390935260a087019190915260c086015260e0850152610100840152610120830191909152610140909101905180910390a450505050565b60a06040519081016040526005815b60008152602001906001900390816138415790505090565b8260058101928215613887579160200282015b8281111561388757825182559160200191906001019061386c565b50613893929150613a01565b5090565b61014060405190810160405260008152600960208201613841565b610160604051908101604052806138c7613897565b8152602001600081525090565b815481835581811511610c3b57600b0281600b028360005260206000209182019101610c3b9190613a1b565b82600a8101928215613887579160200282018281111561388757825182559160200191906001019061386c565b5061393c90600a810190613a01565b50565b506000815560010160008155600101600081556001016000815560010160009055565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106139b557805160ff1916838001178555613887565b82800160010185558215613887579182018281111561388757825182559160200191906001019061386c565b815481835581811511610c3b57600083815260209020610c3b9181019083015b610bb291905b808211156138935760008155600101613a07565b610bb291905b80821115613893576000613a35828261392d565b506000600a820155600b01613a215600f0bcd414edc501835c6c541058514fe45a43fa62a41671c9f62317c9889fcf7fa165627a7a7230582094a007fcd2f4d1607d7b62612b60d148c14a87aee8e0096d1082c8e6e9b89fa20029
Verified Source Code Partial Match
Compiler: v0.4.21+commit.dfe3193c
EVM: byzantium
Optimization: Yes (200 runs)
Cryptogs.sol 736 lines
pragma solidity ^0.4.15;
/*
https://cryptogs.io
--Austin Thomas Griffith for ETHDenver
( PS this gas guzzling beast is still unaudited )
*/
//adapted from https://github.com/ethereum/EIPs/issues/721
// thanks to Dieter Shirley && http://axiomzen.co
contract NFT {
function NFT() public { }
mapping (uint256 => address) public tokenIndexToOwner;
mapping (address => uint256) ownershipTokenCount;
mapping (uint256 => address) public tokenIndexToApproved;
function transfer(address _to,uint256 _tokenId) public {
require(_to != address(0));
require(_to != address(this));
require(_owns(msg.sender, _tokenId));
_transfer(msg.sender, _to, _tokenId);
}
function _transfer(address _from, address _to, uint256 _tokenId) internal {
ownershipTokenCount[_to]++;
tokenIndexToOwner[_tokenId] = _to;
if (_from != address(0)) {
ownershipTokenCount[_from]--;
delete tokenIndexToApproved[_tokenId];
}
Transfer(_from, _to, _tokenId);
}
event Transfer(address from, address to, uint256 tokenId);
function transferFrom(address _from,address _to,uint256 _tokenId) external {
require(_to != address(0));
require(_to != address(this));
require(_approvedFor(msg.sender, _tokenId));
require(_owns(_from, _tokenId));
_transfer(_from, _to, _tokenId);
}
function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
return tokenIndexToOwner[_tokenId] == _claimant;
}
function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) {
return tokenIndexToApproved[_tokenId] == _claimant;
}
function _approve(uint256 _tokenId, address _approved) internal {
tokenIndexToApproved[_tokenId] = _approved;
}
function approve(address _to,uint256 _tokenId) public returns (bool) {
require(_owns(msg.sender, _tokenId));
_approve(_tokenId, _to);
Approval(msg.sender, _to, _tokenId);
return true;
}
event Approval(address owner, address approved, uint256 tokenId);
function balanceOf(address _owner) public view returns (uint256 count) {
return ownershipTokenCount[_owner];
}
function ownerOf(uint256 _tokenId) external view returns (address owner) {
owner = tokenIndexToOwner[_tokenId];
require(owner != address(0));
}
function allowance(address _claimant, uint256 _tokenId) public view returns (bool) {
return _approvedFor(_claimant,_tokenId);
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() 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 {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Cryptogs is NFT, Ownable {
string public constant name = "Cryptogs";
string public constant symbol = "POGS";
string public constant purpose = "ETHDenver";
string public constant contact = "https://cryptogs.io";
string public constant author = "Austin Thomas Griffith";
uint8 public constant FLIPPINESS = 64;
uint8 public constant FLIPPINESSROUNDBONUS = 16;
uint8 public constant TIMEOUTBLOCKS = 180;
uint8 public constant BLOCKSUNTILCLEANUPSTACK=1;
string public ipfs;
function setIpfs(string _ipfs) public onlyOwner returns (bool){
ipfs=_ipfs;
IPFS(ipfs);
return true;
}
event IPFS(string ipfs);
function Cryptogs() public {
//0 index should be a blank item owned by no one
Item memory _item = Item({
image: ""
});
items.push(_item);
}
address public slammerTime;
function setSlammerTime(address _slammerTime) public onlyOwner returns (bool){
//in order to trust that this contract isn't sending a player's tokens
// to a different contract, the slammertime contract is set once and
// only once -- at deploy
require(slammerTime==address(0));
slammerTime=_slammerTime;
return true;
}
struct Item{
bytes32 image;
//perhaps some are harder to flip over?
//perhaps some have magical metadata?
//I don't know, it's late and I'm weird
}
Item[] private items;
function mint(bytes32 _image,address _owner) public onlyOwner returns (uint){
uint256 newId = _mint(_image);
_transfer(0, _owner, newId);
Mint(items[newId].image,tokenIndexToOwner[newId],newId);
return newId;
}
event Mint(bytes32 _image,address _owner,uint256 _id);
function mintBatch(bytes32 _image1,bytes32 _image2,bytes32 _image3,bytes32 _image4,bytes32 _image5,address _owner) public onlyOwner returns (bool){
uint256 newId = _mint(_image1);
_transfer(0, _owner, newId);
Mint(_image1,tokenIndexToOwner[newId],newId);
newId=_mint(_image2);
_transfer(0, _owner, newId);
Mint(_image2,tokenIndexToOwner[newId],newId);
newId=_mint(_image3);
_transfer(0, _owner, newId);
Mint(_image3,tokenIndexToOwner[newId],newId);
newId=_mint(_image4);
_transfer(0, _owner, newId);
Mint(_image4,tokenIndexToOwner[newId],newId);
newId=_mint(_image5);
_transfer(0, _owner, newId);
Mint(_image5,tokenIndexToOwner[newId],newId);
return true;
}
function _mint(bytes32 _image) internal returns (uint){
Item memory _item = Item({
image: _image
});
uint256 newId = items.push(_item) - 1;
tokensOfImage[items[newId].image]++;
return newId;
}
Pack[] private packs;
struct Pack{
uint256[10] tokens;
uint256 price;
}
function mintPack(uint256 _price,bytes32 _image1,bytes32 _image2,bytes32 _image3,bytes32 _image4,bytes32 _image5,bytes32 _image6,bytes32 _image7,bytes32 _image8,bytes32 _image9,bytes32 _image10) public onlyOwner returns (bool){
uint256[10] memory tokens;
tokens[0] = _mint(_image1);
tokens[1] = _mint(_image2);
tokens[2] = _mint(_image3);
tokens[3] = _mint(_image4);
tokens[4] = _mint(_image5);
tokens[5] = _mint(_image6);
tokens[6] = _mint(_image7);
tokens[7] = _mint(_image8);
tokens[8] = _mint(_image9);
tokens[9] = _mint(_image10);
Pack memory _pack = Pack({
tokens: tokens,
price: _price
});
MintPack(packs.push(_pack) - 1, _price,tokens[0],tokens[1],tokens[2],tokens[3],tokens[4],tokens[5],tokens[6],tokens[7],tokens[8],tokens[9]);
return true;
}
event MintPack(uint256 packId,uint256 price,uint256 token1,uint256 token2,uint256 token3,uint256 token4,uint256 token5,uint256 token6,uint256 token7,uint256 token8,uint256 token9,uint256 token10);
function buyPack(uint256 packId) public payable returns (bool) {
//make sure pack is for sale
require( packs[packId].price > 0 );
//make sure they sent in enough value
require( msg.value >= packs[packId].price );
//right away set price to 0 to avoid some sort of reentrance
packs[packId].price=0;
//give tokens to owner
for(uint8 i=0;i<10;i++){
tokenIndexToOwner[packs[packId].tokens[i]]=msg.sender;
_transfer(0, msg.sender, packs[packId].tokens[i]);
}
//clear the price so it is no longer for sale
delete packs[packId];
BuyPack(msg.sender,packId,msg.value);
}
event BuyPack(address sender, uint256 packId, uint256 price);
//lets keep a count of how many of a specific image is created too
//that will allow us to calculate rarity on-chain if we want
mapping (bytes32 => uint256) public tokensOfImage;
function getToken(uint256 _id) public view returns (address owner,bytes32 image,uint256 copies) {
image = items[_id].image;
copies = tokensOfImage[image];
return (
tokenIndexToOwner[_id],
image,
copies
);
}
uint256 nonce = 0;
struct Stack{
//this will be an array of ids but for now just doing one for simplicity
uint256[5] ids;
address owner;
uint32 block;
}
mapping (bytes32 => Stack) public stacks;
mapping (bytes32 => bytes32) public stackCounter;
function stackOwner(bytes32 _stack) public constant returns (address owner) {
return stacks[_stack].owner;
}
function getStack(bytes32 _stack) public constant returns (address owner,uint32 block,uint256 token1,uint256 token2,uint256 token3,uint256 token4,uint256 token5) {
return (stacks[_stack].owner,stacks[_stack].block,stacks[_stack].ids[0],stacks[_stack].ids[1],stacks[_stack].ids[2],stacks[_stack].ids[3],stacks[_stack].ids[4]);
}
//tx 1: of a game, player one approves the SlammerTime contract to take their tokens
//this triggers an event to broadcast to other players that there is an open challenge
function submitStack(uint256 _id,uint256 _id2,uint256 _id3,uint256 _id4,uint256 _id5, bool _public) public returns (bool) {
//make sure slammerTime was set at deploy
require(slammerTime!=address(0));
//the sender must own the token
require(tokenIndexToOwner[_id]==msg.sender);
require(tokenIndexToOwner[_id2]==msg.sender);
require(tokenIndexToOwner[_id3]==msg.sender);
require(tokenIndexToOwner[_id4]==msg.sender);
require(tokenIndexToOwner[_id5]==msg.sender);
//they approve the slammertime contract to take the token away from them
require(approve(slammerTime,_id));
require(approve(slammerTime,_id2));
require(approve(slammerTime,_id3));
require(approve(slammerTime,_id4));
require(approve(slammerTime,_id5));
bytes32 stack = keccak256(nonce++,msg.sender);
uint256[5] memory ids = [_id,_id2,_id3,_id4,_id5];
stacks[stack] = Stack(ids,msg.sender,uint32(block.number));
//the event is triggered to the frontend to display the stack
//the frontend will check if they want it public or not
SubmitStack(msg.sender,now,stack,_id,_id2,_id3,_id4,_id5,_public);
}
event SubmitStack(address indexed _sender,uint256 indexed timestamp,bytes32 indexed _stack,uint256 _token1,uint256 _token2,uint256 _token3,uint256 _token4,uint256 _token5,bool _public);
//tx 2: of a game, player two approves the SlammerTime contract to take their tokens
//this triggers an event to broadcast to player one that this player wants to rumble
function submitCounterStack(bytes32 _stack, uint256 _id, uint256 _id2, uint256 _id3, uint256 _id4, uint256 _id5) public returns (bool) {
//make sure slammerTime was set at deploy
require(slammerTime!=address(0));
//the sender must own the token
require(tokenIndexToOwner[_id]==msg.sender);
require(tokenIndexToOwner[_id2]==msg.sender);
require(tokenIndexToOwner[_id3]==msg.sender);
require(tokenIndexToOwner[_id4]==msg.sender);
require(tokenIndexToOwner[_id5]==msg.sender);
//they approve the slammertime contract to take the token away from them
require(approve(slammerTime,_id));
require(approve(slammerTime,_id2));
require(approve(slammerTime,_id3));
require(approve(slammerTime,_id4));
require(approve(slammerTime,_id5));
//stop playing with yourself
require(msg.sender!=stacks[_stack].owner);
bytes32 counterstack = keccak256(nonce++,msg.sender,_id);
uint256[5] memory ids = [_id,_id2,_id3,_id4,_id5];
stacks[counterstack] = Stack(ids,msg.sender,uint32(block.number));
stackCounter[counterstack] = _stack;
//the event is triggered to the frontend to display the stack
//the frontend will check if they want it public or not
CounterStack(msg.sender,now,_stack,counterstack,_id,_id2,_id3,_id4,_id5);
}
event CounterStack(address indexed _sender,uint256 indexed timestamp,bytes32 indexed _stack, bytes32 _counterStack, uint256 _token1, uint256 _token2, uint256 _token3, uint256 _token4, uint256 _token5);
// if someone creates a stack they should be able to clean it up
// its not really that big of a deal because we will have a timeout
// in the frontent, but still...
function cancelStack(bytes32 _stack) public returns (bool) {
//it must be your stack
require(msg.sender==stacks[_stack].owner);
//make sure there is no mode set yet
require(mode[_stack]==0);
//make sure they aren't trying to cancel a counterstack using this function
require(stackCounter[_stack]==0x00000000000000000000000000000000);
delete stacks[_stack];
CancelStack(msg.sender,now,_stack);
}
event CancelStack(address indexed _sender,uint256 indexed timestamp,bytes32 indexed _stack);
function cancelCounterStack(bytes32 _stack,bytes32 _counterstack) public returns (bool) {
//it must be your stack
require(msg.sender==stacks[_counterstack].owner);
//the counter must be a counter of stack 1
require(stackCounter[_counterstack]==_stack);
//make sure there is no mode set yet
require(mode[_stack]==0);
delete stacks[_counterstack];
delete stackCounter[_counterstack];
CancelCounterStack(msg.sender,now,_stack,_counterstack);
}
event CancelCounterStack(address indexed _sender,uint256 indexed timestamp,bytes32 indexed _stack,bytes32 _counterstack);
mapping (bytes32 => bytes32) public counterOfStack;
mapping (bytes32 => uint8) public mode;
mapping (bytes32 => uint8) public round;
mapping (bytes32 => uint32) public lastBlock;
mapping (bytes32 => uint32) public commitBlock;
mapping (bytes32 => address) public lastActor;
mapping (bytes32 => uint256[10]) public mixedStack;
//tx 3: of a game, player one approves counter stack and transfers everything in
function acceptCounterStack(bytes32 _stack, bytes32 _counterStack) public returns (bool) {
//sender must be owner of stack 1
require(msg.sender==stacks[_stack].owner);
//the counter must be a counter of stack 1
require(stackCounter[_counterStack]==_stack);
//make sure there is no mode set yet
require(mode[_stack]==0);
//do the transfer
SlammerTime slammerTimeContract = SlammerTime(slammerTime);
require( slammerTimeContract.startSlammerTime(msg.sender,stacks[_stack].ids,stacks[_counterStack].owner,stacks[_counterStack].ids) );
//save the block for a timeout
lastBlock[_stack]=uint32(block.number);
lastActor[_stack]=stacks[_counterStack].owner;
mode[_stack]=1;
counterOfStack[_stack]=_counterStack;
//// LOL @
mixedStack[_stack][0] = stacks[_stack].ids[0];
mixedStack[_stack][1] = stacks[_counterStack].ids[0];
mixedStack[_stack][2] = stacks[_stack].ids[1];
mixedStack[_stack][3] = stacks[_counterStack].ids[1];
mixedStack[_stack][4] = stacks[_stack].ids[2];
mixedStack[_stack][5] = stacks[_counterStack].ids[2];
mixedStack[_stack][6] = stacks[_stack].ids[3];
mixedStack[_stack][7] = stacks[_counterStack].ids[3];
mixedStack[_stack][8] = stacks[_stack].ids[4];
mixedStack[_stack][9] = stacks[_counterStack].ids[4];
//let the front end know that the transfer is good and we are ready for the coin flip
AcceptCounterStack(msg.sender,_stack,_counterStack);
}
event AcceptCounterStack(address indexed _sender,bytes32 indexed _stack, bytes32 indexed _counterStack);
mapping (bytes32 => bytes32) public commit;
function getMixedStack(bytes32 _stack) external view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256){
uint256[10] thisStack = mixedStack[_stack];
return (thisStack[0],thisStack[1],thisStack[2],thisStack[3],thisStack[4],thisStack[5],thisStack[6],thisStack[7],thisStack[8],thisStack[9]);
}
//tx 4: player one commits and flips coin up
//at this point, the timeout goes into effect and if any transaction including
//the coin flip don't come back in time, we need to allow the other party
//to withdraw all tokens... this keeps either player from refusing to
//reveal their commit. (every tx from here on out needs to update the lastBlock and lastActor)
//and in the withdraw function you check currentblock-lastBlock > timeout = refund to lastActor
//and by refund I mean let them withdraw if they want
//we could even have a little timer on the front end that tells you how long your opponnet has
//before they will forfet
function startCoinFlip(bytes32 _stack, bytes32 _counterStack, bytes32 _commit) public returns (bool) {
//make sure it's the owner of the first stack (player one) doing the flip
require(stacks[_stack].owner==msg.sender);
//the counter must be a counter of stack 1
require(stackCounter[_counterStack]==_stack);
require(counterOfStack[_stack]==_counterStack);
//make sure that we are in mode 1
require(mode[_stack]==1);
//store the commit for the next tx
commit[_stack]=_commit;
commitBlock[_stack]=uint32(block.number);
//inc the mode to 2
mode[_stack]=2;
StartCoinFlip(_stack,_commit);
}
event StartCoinFlip(bytes32 stack, bytes32 commit);
//tx5: player one ends coin flip with reveal
function endCoinFlip(bytes32 _stack, bytes32 _counterStack, bytes32 _reveal) public returns (bool) {
//make sure it's the owner of the first stack (player one) doing the flip
require(stacks[_stack].owner==msg.sender);
//the counter must be a counter of stack 1
require(stackCounter[_counterStack]==_stack);
require(counterOfStack[_stack]==_counterStack);
//make sure that we are in mode 2
require(mode[_stack]==2);
//make sure that we are on a later block than the commit block
require(uint32(block.number)>commitBlock[_stack]);
//make sure hash of reveal == commit
if(keccak256(_reveal)!=commit[_stack]){
//commit/reveal failed.. this can happen if they
//reload, so don't punish, just go back to the
//start of the coin flip stage
mode[_stack]=1;
CoinFlipFail(_stack);
return false;
}else{
//successful coin flip, ready to get random
mode[_stack]=3;
round[_stack]=1;
bytes32 pseudoRandomHash = keccak256(_reveal,block.blockhash(commitBlock[_stack]));
if(uint256(pseudoRandomHash)%2==0){
//player1 goes first
lastBlock[_stack]=uint32(block.number);
lastActor[_stack]=stacks[_counterStack].owner;
CoinFlipSuccess(_stack,stacks[_stack].owner,true);
}else{
//player2 goes first
lastBlock[_stack]=uint32(block.number);
lastActor[_stack]=stacks[_stack].owner;
CoinFlipSuccess(_stack,stacks[_counterStack].owner,false);
}
return true;
}
}
event CoinFlipSuccess(bytes32 indexed stack,address whosTurn,bool heads);
event CoinFlipFail(bytes32 stack);
//tx6 next player raises slammer
function raiseSlammer(bytes32 _stack, bytes32 _counterStack, bytes32 _commit) public returns (bool) {
if(lastActor[_stack]==stacks[_stack].owner){
//it is player2's turn
require(stacks[_counterStack].owner==msg.sender);
}else{
//it is player1's turn
require(stacks[_stack].owner==msg.sender);
}
//the counter must be a counter of stack 1
require(stackCounter[_counterStack]==_stack);
require(counterOfStack[_stack]==_counterStack);
//make sure that we are in mode 3
require(mode[_stack]==3);
//store the commit for the next tx
commit[_stack]=_commit;
commitBlock[_stack]=uint32(block.number);
//inc the mode to 2
mode[_stack]=4;
RaiseSlammer(_stack,_commit);
}
event RaiseSlammer(bytes32 stack, bytes32 commit);
//tx7 player throws slammer
function throwSlammer(bytes32 _stack, bytes32 _counterStack, bytes32 _reveal) public returns (bool) {
if(lastActor[_stack]==stacks[_stack].owner){
//it is player2's turn
require(stacks[_counterStack].owner==msg.sender);
}else{
//it is player1's turn
require(stacks[_stack].owner==msg.sender);
}
//the counter must be a counter of stack 1
require(stackCounter[_counterStack]==_stack);
require(counterOfStack[_stack]==_counterStack);
//make sure that we are in mode 4
require(mode[_stack]==4);
//make sure that we are on a later block than the commit block
require(uint32(block.number)>commitBlock[_stack]);
uint256[10] memory flipped;
if(keccak256(_reveal)!=commit[_stack]){
//commit/reveal failed.. this can happen if they
//reload, so don't punish, just go back to the
//start of the slammer raise
mode[_stack]=3;
throwSlammerEvent(_stack,msg.sender,address(0),flipped);
return false;
}else{
//successful slam!!!!!!!!!!!! At this point I have officially been awake for 24 hours !!!!!!!!!!
mode[_stack]=3;
address previousLastActor = lastActor[_stack];
bytes32 pseudoRandomHash = keccak256(_reveal,block.blockhash(commitBlock[_stack]));
//Debug(_reveal,block.blockhash(block.number-1),pseudoRandomHash);
if(lastActor[_stack]==stacks[_stack].owner){
//player1 goes next
lastBlock[_stack]=uint32(block.number);
lastActor[_stack]=stacks[_counterStack].owner;
}else{
//player2 goes next
lastBlock[_stack]=uint32(block.number);
lastActor[_stack]=stacks[_stack].owner;
}
//look through the stack of remaining pogs and compare to byte to see if less than FLIPPINESS and transfer back to correct owner
// oh man, that smells like reentrance -- I think the mode would actually break that right?
bool done=true;
uint8 randIndex = 0;
for(uint8 i=0;i<10;i++){
if(mixedStack[_stack][i]>0){
//there is still a pog here, check for flip
uint8 thisFlipper = uint8(pseudoRandomHash[randIndex++]);
//DebugFlip(pseudoRandomHash,i,randIndex,thisFlipper,FLIPPINESS);
if(thisFlipper<(FLIPPINESS+round[_stack]*FLIPPINESSROUNDBONUS)){
//ITS A FLIP!
uint256 tempId = mixedStack[_stack][i];
flipped[i]=tempId;
mixedStack[_stack][i]=0;
SlammerTime slammerTimeContract = SlammerTime(slammerTime);
//require( slammerTimeContract.transferBack(msg.sender,tempId) );
slammerTimeContract.transferBack(msg.sender,tempId);
}else{
done=false;
}
}
}
throwSlammerEvent(_stack,msg.sender,previousLastActor,flipped);
if(done){
FinishGame(_stack);
mode[_stack]=9;
delete mixedStack[_stack];
delete stacks[_stack];
delete stackCounter[_counterStack];
delete stacks[_counterStack];
delete lastBlock[_stack];
delete lastActor[_stack];
delete counterOfStack[_stack];
delete round[_stack];
delete commitBlock[_stack];
delete commit[_stack];
}else{
round[_stack]++;
}
return true;
}
}
event ThrowSlammer(bytes32 indexed stack, address indexed whoDoneIt, address indexed otherPlayer, uint256 token1Flipped, uint256 token2Flipped, uint256 token3Flipped, uint256 token4Flipped, uint256 token5Flipped, uint256 token6Flipped, uint256 token7Flipped, uint256 token8Flipped, uint256 token9Flipped, uint256 token10Flipped);
event FinishGame(bytes32 stack);
function throwSlammerEvent(bytes32 stack,address whoDoneIt,address otherAccount, uint256[10] flipArray) internal {
ThrowSlammer(stack,whoDoneIt,otherAccount,flipArray[0],flipArray[1],flipArray[2],flipArray[3],flipArray[4],flipArray[5],flipArray[6],flipArray[7],flipArray[8],flipArray[9]);
}
function drainStack(bytes32 _stack, bytes32 _counterStack) public returns (bool) {
//this function is for the case of a timeout in the commit / reveal
// if a player realizes they are going to lose, they can refuse to reveal
// therefore we must have a timeout of TIMEOUTBLOCKS and if that time is reached
// the other player can get in and drain the remaining tokens from the game
require( stacks[_stack].owner==msg.sender || stacks[_counterStack].owner==msg.sender );
//the counter must be a counter of stack 1
require( stackCounter[_counterStack]==_stack );
require( counterOfStack[_stack]==_counterStack );
//the bad guy shouldn't be able to drain
require( lastActor[_stack]==msg.sender );
//must be after timeout period
require( block.number - lastBlock[_stack] >= TIMEOUTBLOCKS);
//game must still be going
require( mode[_stack]<9 );
for(uint8 i=0;i<10;i++){
if(mixedStack[_stack][i]>0){
uint256 tempId = mixedStack[_stack][i];
mixedStack[_stack][i]=0;
SlammerTime slammerTimeContract = SlammerTime(slammerTime);
slammerTimeContract.transferBack(msg.sender,tempId);
}
}
FinishGame(_stack);
mode[_stack]=9;
delete mixedStack[_stack];
delete stacks[_stack];
delete stackCounter[_counterStack];
delete stacks[_counterStack];
delete lastBlock[_stack];
delete lastActor[_stack];
delete counterOfStack[_stack];
delete round[_stack];
delete commitBlock[_stack];
delete commit[_stack];
DrainStack(_stack,_counterStack,msg.sender);
}
event DrainStack(bytes32 stack,bytes32 counterStack,address sender);
function totalSupply() public view returns (uint) {
return items.length - 1;
}
function tokensOfOwner(address _owner) external view returns(uint256[]) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 total = totalSupply();
uint256 resultIndex = 0;
uint256 id;
for (id = 1; id <= total; id++) {
if (tokenIndexToOwner[id] == _owner) {
result[resultIndex] = id;
resultIndex++;
}
}
return result;
}
}
function withdraw(uint256 _amount) public onlyOwner returns (bool) {
require(this.balance >= _amount);
assert(owner.send(_amount));
return true;
}
function withdrawToken(address _token,uint256 _amount) public onlyOwner returns (bool) {
StandardToken token = StandardToken(_token);
token.transfer(msg.sender,_amount);
return true;
}
//adapted from ERC-677 from my dude Steve Ellis - thanks man!
function transferStackAndCall(address _to, uint _token1, uint _token2, uint _token3, uint _token4, uint _token5, bytes32 _data) public returns (bool) {
transfer(_to, _token1);
transfer(_to, _token2);
transfer(_to, _token3);
transfer(_to, _token4);
transfer(_to, _token5);
if (isContract(_to)) {
contractFallback(_to,_token1,_token2,_token3,_token4,_token5,_data);
}
return true;
}
function contractFallback(address _to, uint _token1, uint _token2, uint _token3, uint _token4, uint _token5, bytes32 _data) private {
StackReceiver receiver = StackReceiver(_to);
receiver.onTransferStack(msg.sender,_token1,_token2,_token3,_token4,_token5,_data);
}
function isContract(address _addr) private returns (bool hasCode) {
uint length;
assembly { length := extcodesize(_addr) }
return length > 0;
}
}
contract StackReceiver {
function onTransferStack(address _sender, uint _token1, uint _token2, uint _token3, uint _token4, uint _token5, bytes32 _data);
}
contract StandardToken {
function transfer(address _to, uint256 _value) public returns (bool) { }
}
contract SlammerTime {
function startSlammerTime(address _player1,uint256[5] _id1,address _player2,uint256[5] _id2) public returns (bool) { }
function transferBack(address _toWhom, uint256 _id) public returns (bool) { }
}
Read Contract
BLOCKSUNTILCLEANUPSTACK 0x40a19a71 → uint8
FLIPPINESS 0x372e80c3 → uint8
FLIPPINESSROUNDBONUS 0x59828c99 → uint8
TIMEOUTBLOCKS 0xe1757a3c → uint8
allowance 0xddc6a171 → bool
author 0xa6c3e6b9 → string
balanceOf 0x70a08231 → uint256
commit 0xf14fcbc8 → bytes32
commitBlock 0x74f6c562 → uint32
contact 0x33a8c45a → string
counterOfStack 0xf903facc → bytes32
getMixedStack 0x435ad5c1 → uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256
getStack 0xa716144a → address, uint32, uint256, uint256, uint256, uint256, uint256
getToken 0xe4b50cb8 → address, bytes32, uint256
ipfs 0xd7959cf9 → string
lastActor 0x686996a3 → address
lastBlock 0x70f6956a → uint32
mixedStack 0xb20cf6fe → uint256
mode 0xa591398b → uint8
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
purpose 0x70740aab → string
round 0x0dd5127d → uint8
slammerTime 0x7712c870 → address
stackCounter 0xda87c969 → bytes32
stackOwner 0x086013c0 → address
stacks 0x40ae7a5c → address, uint32
symbol 0x95d89b41 → string
tokenIndexToApproved 0xa8bd9c32 → address
tokenIndexToOwner 0x1d36e06c → address
tokensOfImage 0x6533b4bb → uint256
tokensOfOwner 0x8462151c → uint256[]
totalSupply 0x18160ddd → uint256
Write Contract 23 functions
These functions modify contract state and require a wallet transaction to execute.
acceptCounterStack 0x24b77f05
bytes32 _stack
bytes32 _counterStack
returns: bool
approve 0x095ea7b3
address _to
uint256 _tokenId
returns: bool
buyPack 0xdc45bfb3
uint256 packId
returns: bool
cancelCounterStack 0xb6ef78c2
bytes32 _stack
bytes32 _counterstack
returns: bool
cancelStack 0xe9db787b
bytes32 _stack
returns: bool
drainStack 0x6a897999
bytes32 _stack
bytes32 _counterStack
returns: bool
endCoinFlip 0x4bd8ae6f
bytes32 _stack
bytes32 _counterStack
bytes32 _reveal
returns: bool
mint 0x293c6a3a
bytes32 _image
address _owner
returns: uint256
mintBatch 0xdd59c954
bytes32 _image1
bytes32 _image2
bytes32 _image3
bytes32 _image4
bytes32 _image5
address _owner
returns: bool
mintPack 0x3791792a
uint256 _price
bytes32 _image1
bytes32 _image2
bytes32 _image3
bytes32 _image4
bytes32 _image5
bytes32 _image6
bytes32 _image7
bytes32 _image8
bytes32 _image9
bytes32 _image10
returns: bool
raiseSlammer 0x40b8783d
bytes32 _stack
bytes32 _counterStack
bytes32 _commit
returns: bool
setIpfs 0xc31fa083
string _ipfs
returns: bool
setSlammerTime 0xf6621121
address _slammerTime
returns: bool
startCoinFlip 0xe6e35407
bytes32 _stack
bytes32 _counterStack
bytes32 _commit
returns: bool
submitCounterStack 0x29a40403
bytes32 _stack
uint256 _id
uint256 _id2
uint256 _id3
uint256 _id4
uint256 _id5
returns: bool
submitStack 0xed861328
uint256 _id
uint256 _id2
uint256 _id3
uint256 _id4
uint256 _id5
bool _public
returns: bool
throwSlammer 0xde150d5d
bytes32 _stack
bytes32 _counterStack
bytes32 _reveal
returns: bool
transfer 0xa9059cbb
address _to
uint256 _tokenId
transferFrom 0x23b872dd
address _from
address _to
uint256 _tokenId
transferOwnership 0xf2fde38b
address newOwner
transferStackAndCall 0x3733b378
address _to
uint256 _token1
uint256 _token2
uint256 _token3
uint256 _token4
uint256 _token5
bytes32 _data
returns: bool
withdraw 0x2e1a7d4d
uint256 _amount
returns: bool
withdrawToken 0x9e281a98
address _token
uint256 _amount
returns: bool
Token Balances (1)
View Transfers →Recent Transactions
No transactions found for this address