Address Contract Partially Verified
Address
0xA29939f74C3e527C83011Fab972B09Ac68e71A47
Balance
0 ETH
Nonce
1
Code Size
14781 bytes
Creator
0x3f8C962e...19D4 at tx 0x983d24c0...621646
Indexed Transactions
0
Contract Bytecode
14781 bytes
0x6080604052600436106102455763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301ffc9a7811461024a57806303cfe12d1461028057806306fdde03146102e55780630701fd6b1461036f578063081812fc14610493578063095ea7b3146104c75780630988ca8c146104ed578063128ee1611461055457806318160ddd146106c957806318b919e9146106f057806319fa8f50146107055780631db1b4fd14610737578063217fe6c61461074f57806323b872dd146107b657806324953eaa146107e0578063286dd3f5146108355780632f745c591461085657806337073a871461087a5780633b3a1a7a1461095f57806342842e0e1461097457806342966c681461099e578063473b0d46146109b65780634e99b800146109ce5780634f558e79146109e35780634f6ccce7146109fb5780635a3f267214610a135780635f75d62d14610a345780636352211e14610a9657806370a0823114610aae578063715018a614610acf5780637b9417c814610ae45780638074dc5914610b055780638da5cb5b14610ba25780638dc1076814610bb75780638ef79e9114610c5257806395d89b4114610c725780639b19251a14610c87578063a22cb46514610ca8578063aaffadf314610cce578063b88d4fde14610ce3578063c87b56dd14610d52578063e2ec6ec314610d6a578063e60a955d14610dbf578063e985e9c514610ddc578063f2fde38b14610e03578063f7ad51ce14610e24578063f9256de114610e39578063fc314e3114610e4e575b600080fd5b34801561025657600080fd5b5061026c600160e060020a031960043516610e66565b604080519115158252519081900360200190f35b34801561028c57600080fd5b50610295610e85565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102d15781810151838201526020016102b9565b505050509050019250505060405180910390f35b3480156102f157600080fd5b506102fa610ede565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561033457818101518382015260200161031c565b50505050905090810190601f1680156103615780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037b57600080fd5b50610387600435610f6b565b6040518087600160a060020a0316600160a060020a031681526020018681526020018060200180602001858152602001848152602001838103835287818151815260200191508051906020019080838360005b838110156103f25781810151838201526020016103da565b50505050905090810190601f16801561041f5780820380516001836020036101000a031916815260200191505b50838103825286518152865160209182019188019080838360005b8381101561045257818101518382015260200161043a565b50505050905090810190601f16801561047f5780820380516001836020036101000a031916815260200191505b509850505050505050505060405180910390f35b34801561049f57600080fd5b506104ab6004356110bd565b60408051600160a060020a039092168252519081900360200190f35b3480156104d357600080fd5b506104eb600160a060020a03600435166024356110d8565b005b3480156104f957600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526104eb958335600160a060020a03169536956044949193909101919081908401838280828437509497506111819650505050505050565b34801561056057600080fd5b5061056c6004356111ef565b6040518085600160a060020a0316600160a060020a03168152602001806020018060200180602001848103845287818151815260200191508051906020019080838360005b838110156105c95781810151838201526020016105b1565b50505050905090810190601f1680156105f65780820380516001836020036101000a031916815260200191505b50848103835286518152865160209182019188019080838360005b83811015610629578181015183820152602001610611565b50505050905090810190601f1680156106565780820380516001836020036101000a031916815260200191505b50848103825285518152855160209182019187019080838360005b83811015610689578181015183820152602001610671565b50505050905090810190601f1680156106b65780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b3480156106d557600080fd5b506106de6113c5565b60408051918252519081900360200190f35b3480156106fc57600080fd5b506102fa6113cb565b34801561071157600080fd5b5061071a6113f0565b60408051600160e060020a03199092168252519081900360200190f35b34801561074357600080fd5b5061056c600435611414565b34801561075b57600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261026c958335600160a060020a03169536956044949193909101919081908401838280828437509497506117c09650505050505050565b3480156107c257600080fd5b506104eb600160a060020a0360043581169060243516604435611833565b3480156107ec57600080fd5b50604080516020600480358082013583810280860185019096528085526104eb953695939460249493850192918291850190849080828437509497506118d69650505050505050565b34801561084157600080fd5b506104eb600160a060020a0360043516611925565b34801561086257600080fd5b506106de600160a060020a036004351660243561196c565b34801561088657600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261026c9482359460248035600160a060020a03169536959460649492019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506119b99650505050505050565b34801561096b57600080fd5b506106de611c5d565b34801561098057600080fd5b506104eb600160a060020a0360043581169060243516604435611c63565b3480156109aa57600080fd5b506104eb600435611c84565b3480156109c257600080fd5b506104eb600435611cf9565b3480156109da57600080fd5b506102fa611d85565b3480156109ef57600080fd5b5061026c600435611e13565b348015610a0757600080fd5b506106de600435611e30565b348015610a1f57600080fd5b50610295600160a060020a0360043516611e65565b348015610a4057600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261026c958335953695604494919390910191908190840183828082843750949750505050913515159250611ed1915050565b348015610aa257600080fd5b506104ab600435612017565b348015610aba57600080fd5b506106de600160a060020a0360043516612041565b348015610adb57600080fd5b506104eb612074565b348015610af057600080fd5b506104eb600160a060020a03600435166120d5565b604080516020601f60643560048181013592830184900484028501840190955281845261026c94600160a060020a03813516946024803595604435953695608494930191819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506121199650505050505050565b348015610bae57600080fd5b506104ab612554565b348015610bc357600080fd5b50610bcf600435612563565b604051808060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610c16578181015183820152602001610bfe565b50505050905090810190601f168015610c435780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b348015610c5e57600080fd5b506104eb600480356024810191013561260d565b348015610c7e57600080fd5b506102fa6126a4565b348015610c9357600080fd5b5061026c600160a060020a0360043516612705565b348015610cb457600080fd5b506104eb600160a060020a03600435166024351515612734565b348015610cda57600080fd5b506106de6127b8565b348015610cef57600080fd5b50604080516020601f6064356004818101359283018490048402850184019095528184526104eb94600160a060020a0381358116956024803590921695604435953695608494019181908401838280828437509497506127be9650505050505050565b348015610d5e57600080fd5b506102fa6004356127e0565b348015610d7657600080fd5b50604080516020600480358082013583810280860185019096528085526104eb953695939460249493850192918291850190849080828437509497506129249650505050505050565b348015610dcb57600080fd5b506104eb6004356024351515612973565b348015610de857600080fd5b5061026c600160a060020a0360043581169060243516612a3d565b348015610e0f57600080fd5b506104eb600160a060020a0360043516612a6b565b348015610e3057600080fd5b50610295612a8b565b348015610e4557600080fd5b506106de612ae1565b348015610e5a57600080fd5b50610387600435612ae7565b600160e060020a03191660009081526020819052604090205460ff1690565b60606012805480602002602001604051908101604052809291908181526020018280548015610ed357602002820191906000526020600020905b815481526020019060010190808311610ebf575b505050505090505b90565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ed35780601f10610f3f57610100808354040283529160200191610ed3565b820191906000526020600020905b815481529060010190602001808311610f4d57509395945050505050565b60156020908152600091825260409182902080546001808301546002808501805488516101009582161595909502600019011691909104601f8101879004870284018701909752868352600160a060020a039093169590949192918301828280156110175780601f10610fec57610100808354040283529160200191611017565b820191906000526020600020905b815481529060010190602001808311610ffa57829003601f168201915b5050505060038301805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529495949350908301828280156110a75780601f1061107c576101008083540402835291602001916110a7565b820191906000526020600020905b81548152906001019060200180831161108a57829003601f168201915b5050505050908060040154908060050154905086565b600090815260026020526040902054600160a060020a031690565b60006110e382612017565b9050600160a060020a0383811690821614156110fe57600080fd5b33600160a060020a038216148061111a575061111a8133612a3d565b151561112557600080fd5b6000828152600260205260408082208054600160a060020a031916600160a060020a0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6111eb82600d836040518082805190602001908083835b602083106111b75780518252601f199092019160209182019101611198565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922092915050612cae565b5050565b6011602090815260009182526040918290208054600180830180548651600261010094831615949094026000190190911692909204601f8101869004860283018601909652858252600160a060020a039092169492939092908301828280156112995780601f1061126e57610100808354040283529160200191611299565b820191906000526020600020905b81548152906001019060200180831161127c57829003601f168201915b50505060028085018054604080516020601f600019610100600187161502019094169590950492830185900485028101850190915281815295969594509092509083018282801561132b5780601f106113005761010080835404028352916020019161132b565b820191906000526020600020905b81548152906001019060200180831161130e57829003601f168201915b5050505060038301805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529495949350908301828280156113bb5780601f10611390576101008083540402835291602001916113bb565b820191906000526020600020905b81548152906001019060200180831161139e57829003601f168201915b5050505050905084565b60095490565b6040805180820190915260098152600080516020613972833981519152602082015281565b7f01ffc9a70000000000000000000000000000000000000000000000000000000081565b600060608060606114236137d9565b61142b613819565b61143487611e13565b151561143f57600080fd5b600087815260156020908152604091829020825160c0810184528154600160a060020a03168152600180830154828501526002808401805487516101009482161594909402600019011691909104601f810186900486028301860187528083529295939493860193919290918301828280156114fc5780601f106114d1576101008083540402835291602001916114fc565b820191906000526020600020905b8154815290600101906020018083116114df57829003601f168201915b505050918352505060038201805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529382019392918301828280156115905780601f1061156557610100808354040283529160200191611590565b820191906000526020600020905b81548152906001019060200180831161157357829003601f168201915b5050509183525050600482015460208083019190915260059092015460409182015260a083015160009081526011835281902081516080810183528154600160a060020a03168152600180830180548551600261010094831615949094026000190190911692909204601f810187900487028301870190955284825295975090949193858101939192919083018282801561166c5780601f106116415761010080835404028352916020019161166c565b820191906000526020600020905b81548152906001019060200180831161164f57829003601f168201915b5050509183525050600282810180546040805160206001841615610100026000190190931694909404601f810183900483028501830190915280845293810193908301828280156116fe5780601f106116d3576101008083540402835291602001916116fe565b820191906000526020600020905b8154815290600101906020018083116116e157829003601f168201915b505050918352505060038201805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529382019392918301828280156117925780601f1061176757610100808354040283529160200191611792565b820191906000526020600020905b81548152906001019060200180831161177557829003601f168201915b505050919092525050815160208301516040840151606090940151919b909a50929850965090945050505050565b600061182c83600d846040518082805190602001908083835b602083106117f85780518252601f1990920191602091820191016117d9565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922092915050612cc3565b9392505050565b61183d3382612ce2565b151561184857600080fd5b600160a060020a038316151561185d57600080fd5b600160a060020a038216151561187257600080fd5b61187c8382612d41565b6118868382612da3565b6118908282612eaa565b8082600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b600c54600090600160a060020a031633146118f057600080fd5b5060005b81518110156111eb5761191d828281518110151561190e57fe5b90602001906020020151611925565b6001016118f4565b600c54600160a060020a0316331461193c57600080fd5b61196981604080519081016040528060098152602001600080516020613972833981519152815250612ef3565b50565b600061197783612041565b821061198257600080fd5b600160a060020a03831660009081526007602052604090208054839081106119a657fe5b9060005260206000200154905092915050565b6000336119e981604080519081016040528060098152602001600080516020613972833981519152815250611181565b600160a060020a0386161515611a49576040805160e560020a62461bcd02815260206004820152600f60248201527f496e76616c696420616464726573730000000000000000000000000000000000604482015290519081900360640190fd5b84511515611aa1576040805160e560020a62461bcd02815260206004820152600c60248201527f496e76616c6964206e616d650000000000000000000000000000000000000000604482015290519081900360640190fd5b83511515611af9576040805160e560020a62461bcd02815260206004820152600c60248201527f496e76616c6964206e616d650000000000000000000000000000000000000000604482015290519081900360640190fd5b82511515611b51576040805160e560020a62461bcd02815260206004820152600c60248201527f496e76616c6964206e616d650000000000000000000000000000000000000000604482015290519081900360640190fd5b60408051608081018252600160a060020a03888116825260208083018981528385018990526060840188905260008c8152601183529490942083518154600160a060020a03191693169290921782559251805192939192611bb8926001850192019061384b565b5060408201518051611bd491600284019160209091019061384b565b5060608201518051611bf091600384019160209091019061384b565b50506012805460018101825560009182527fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec3444018990556040518992507f5f4aa3ef0a4bf82c0f10f704eb578f57422b27f40709f8a4aca4694b6bda8ab39190a25060019695505050505050565b600f5481565b611c7f83838360206040519081016040528060008152506127be565b505050565b6040805160e560020a62461bcd028152602060048201526024808201527f526164692e4361726473206172652063656e736f72736869702072657369737460448201527f616e742100000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b33611d2781604080519081016040528060098152602001600080516020613972833981519152815250611181565b60008211611d7f576040805160e560020a62461bcd02815260206004820152601c60248201527f496e76616c6964206d696e696d756d20636f6e747269627574696f6e00000000604482015290519081900360640190fd5b50601055565b600e805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015611e0b5780601f10611de057610100808354040283529160200191611e0b565b820191906000526020600020905b815481529060010190602001808311611dee57829003601f168201915b505050505081565b600090815260016020526040902054600160a060020a0316151590565b6000611e3a6113c5565b8210611e4557600080fd5b6009805483908110611e5357fe5b90600052602060002001549050919050565b600160a060020a038116600090815260076020908152604091829020805483518184028101840190945280845260609392830182828015611ec557602002820191906000526020600020905b815481526020019060010190808311611eb1575b50505050509050919050565b600033611f0181604080519081016040528060098152602001600080516020613972833981519152815250611181565b83511515611f59576040805160e560020a62461bcd02815260206004820152601160248201527f496e76616c696420746f6b656e20555249000000000000000000000000000000604482015290519081900360640190fd5b604080518082018252858152841515602080830191909152600088815260138252929092208151805192939192611f93928492019061384b565b50602091909101516001918201805460ff191691151591909117905560148054918201815560009081527fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec90910186905560405186917fee4df2a71cd5144f989eafc284d855a4cc517ca03f21c5270ed8e2e9dcc3d29c91a2506001949350505050565b600081815260016020526040812054600160a060020a031680151561203b57600080fd5b92915050565b6000600160a060020a038216151561205857600080fd5b50600160a060020a031660009081526003602052604090205490565b600c54600160a060020a0316331461208b57600080fd5b600c54604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a2600c8054600160a060020a0319169055565b600c54600160a060020a031633146120ec57600080fd5b61196981604080519081016040528060098152602001600080516020613972833981519152815250613004565b600080600160a060020a038716151561217c576040805160e560020a62461bcd02815260206004820152601760248201527f4d75737420626520612076616c69642061646472657373000000000000000000604482015290519081900360640190fd5b600086815260116020526040902054600160a060020a031615156121ea576040805160e560020a62461bcd02815260206004820181905260248201527f4d7573742073706563696679206578697374696e672062656e65666163746f72604482015290519081900360640190fd5b600085815260136020526040902054600260001961010060018416150201909116041515612262576040805160e560020a62461bcd02815260206004820152601a60248201527f4d7573742073706563696679206578697374696e672063617264000000000000604482015290519081900360640190fd5b60008581526013602052604090206001015460ff1615156122cd576040805160e560020a62461bcd02815260206004820152601660248201527f4d75737420626520616e20616374697665206361726400000000000000000000604482015290519081900360640190fd5b60105434101561234d576040805160e560020a62461bcd02815260206004820152602560248201527f4d7573742073656e64206174206c6561737420746865206d696e696d756d206160448201527f6d6f756e74000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6040805160c08101825233815234602080830191825282840188815260608401889052608084018a905260a084018b9052600f546000908152601583529490942083518154600160a060020a031916600160a060020a039091161781559151600183015592518051929391926123c9926002850192019061384b565b50606082015180516123e591600384019160209091019061384b565b506080820151600482015560a0909101516005909101556000858152601360209081526040918290208054835160026001831615610100026000190190921691909104601f810184900484028201840190945283815261249f938b939192918301828280156124955780601f1061246a57610100808354040283529160200191612495565b820191906000526020600020905b81548152906001019060200180831161247857829003601f168201915b50505050506130d6565b600087815260116020526040808220549051929350600160a060020a0316913480156108fc0292909190818181858888f193505050501580156124e6573d6000803e3d6000fd5b506016546124fa903463ffffffff61310e16565b6016556040805133815260208101839052815187928992600160a060020a038c16927f124b55414cfccfb944398950a61aa7eebe0c5ff470bca91354cf83ade92cfc72929181900390910190a45060019695505050505050565b600c54600160a060020a031681565b60136020908152600091825260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529092918391908301828280156125fa5780601f106125cf576101008083540402835291602001916125fa565b820191906000526020600020905b8154815290600101906020018083116125dd57829003601f168201915b5050506001909301549192505060ff1682565b3361263b81604080519081016040528060098152602001600080516020613972833981519152815250611181565b811515612692576040805160e560020a62461bcd02815260206004820152601060248201527f426173652055524920696e76616c696400000000000000000000000000000000604482015290519081900360640190fd5b61269e600e84846138c9565b50505050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ed35780601f10610f3f57610100808354040283529160200191610ed3565b600061203b826040805190810160405280600981526020016000805160206139728339815191528152506117c0565b600160a060020a03821633141561274a57600080fd5b336000818152600460209081526040808320600160a060020a03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b60105481565b6127c9848484611833565b6127d58484848461311b565b151561269e57600080fd5b60606127eb82611e13565b15156127f657600080fd5b600e8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815261203b93909290918301828280156128835780601f1061285857610100808354040283529160200191612883565b820191906000526020600020905b81548152906001019060200180831161286657829003601f168201915b5050506000868152600b60209081526040918290208054835160026001831615610100026000190190921691909104601f81018490048402820184019094528381529450925083018282801561291a5780601f106128ef5761010080835404028352916020019161291a565b820191906000526020600020905b8154815290600101906020018083116128fd57829003601f168201915b5050505050613288565b600c54600090600160a060020a0316331461293e57600080fd5b5060005b81518110156111eb5761296b828281518110151561295c57fe5b906020019060200201516120d5565b600101612942565b336129a181604080519081016040528060098152602001600080516020613972833981519152815250611181565b600083815260136020526040902054600260001961010060018416150201909116041515612a19576040805160e560020a62461bcd02815260206004820152601a60248201527f4d7573742073706563696679206578697374696e672063617264000000000000604482015290519081900360640190fd5b50600091825260136020526040909120600101805460ff1916911515919091179055565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205460ff1690565b600c54600160a060020a03163314612a8257600080fd5b611969816132bd565b60606014805480602002602001604051908101604052809291908181526020018280548015610ed35760200282019190600052602060002090815481526020019060010190808311610ebf575050505050905090565b60165481565b600080606080600080612af86137d9565b612b0188611e13565b1515612b0c57600080fd5b600088815260156020908152604091829020825160c0810184528154600160a060020a03168152600180830154828501526002808401805487516101009482161594909402600019011691909104601f81018690048602830186018752808352929593949386019391929091830182828015612bc95780601f10612b9e57610100808354040283529160200191612bc9565b820191906000526020600020905b815481529060010190602001808311612bac57829003601f168201915b505050918352505060038201805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152938201939291830182828015612c5d5780601f10612c3257610100808354040283529160200191612c5d565b820191906000526020600020905b815481529060010190602001808311612c4057829003601f168201915b50505091835250506004820154602080830191909152600590920154604091820152825191830151908301516060840151608085015160a090950151939d929c50909a509850919650945092505050565b612cb88282612cc3565b15156111eb57600080fd5b600160a060020a03166000908152602091909152604090205460ff1690565b600080612cee83612017565b905080600160a060020a031684600160a060020a03161480612d29575083600160a060020a0316612d1e846110bd565b600160a060020a0316145b80612d395750612d398185612a3d565b949350505050565b81600160a060020a0316612d5482612017565b600160a060020a031614612d6757600080fd5b600081815260026020526040902054600160a060020a0316156111eb5760009081526002602052604090208054600160a060020a031916905550565b6000806000612db2858561332e565b600084815260086020908152604080832054600160a060020a0389168452600790925290912054909350612ded90600163ffffffff6133b716565b600160a060020a038616600090815260076020526040902080549193509083908110612e1557fe5b90600052602060002001549050806007600087600160a060020a0316600160a060020a0316815260200190815260200160002084815481101515612e5557fe5b6000918252602080832090910192909255600160a060020a0387168152600790915260409020805490612e8c906000198301613937565b50600093845260086020526040808520859055908452909220555050565b6000612eb683836133c9565b50600160a060020a039091166000908152600760209081526040808320805460018101825590845282842081018590559383526008909152902055565b612f5d82600d836040518082805190602001908083835b60208310612f295780518252601f199092019160209182019101612f0a565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092209291505061344c565b81600160a060020a03167fd211483f91fc6eff862467f8de606587a30c8fc9981056f051b897a418df803a826040518080602001828103825283818151815260200191508051906020019080838360005b83811015612fc6578181015183820152602001612fae565b50505050905090810190601f168015612ff35780820380516001836020036101000a031916815260200191505b509250505060405180910390a25050565b61306e82600d836040518082805190602001908083835b6020831061303a5780518252601f19909201916020918201910161301b565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092209291505061346e565b81600160a060020a03167fbfec83d64eaa953f2708271a023ab9ee82057f8f3578d548c1a4ba0b5b7004898260405180806020018281038252838181518152602001915080519060200190808383600083811015612fc6578181015183820152602001612fae565b600f546000906130e68482613493565b6130f081846134e2565b600f5461310490600163ffffffff61310e16565b600f559392505050565b8181018281101561203b57fe5b60008061313085600160a060020a0316613515565b151561313f576001915061327f565b6040517f150b7a020000000000000000000000000000000000000000000000000000000081523360048201818152600160a060020a03898116602485015260448401889052608060648501908152875160848601528751918a169463150b7a0294938c938b938b93909160a490910190602085019080838360005b838110156131d25781810151838201526020016131ba565b50505050905090810190601f1680156131ff5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15801561322157600080fd5b505af1158015613235573d6000803e3d6000fd5b505050506040513d602081101561324b57600080fd5b5051600160e060020a031981167f150b7a020000000000000000000000000000000000000000000000000000000014925090505b50949350505050565b60408051602081810183526000808352835180830185528181528451928301909452815260609261182c92869286929061351d565b600160a060020a03811615156132d257600080fd5b600c54604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600c8054600160a060020a031916600160a060020a0392909216919091179055565b81600160a060020a031661334182612017565b600160a060020a03161461335457600080fd5b600160a060020a03821660009081526003602052604090205461337e90600163ffffffff6133b716565b600160a060020a039092166000908152600360209081526040808320949094559181526001909152208054600160a060020a0319169055565b6000828211156133c357fe5b50900390565b600081815260016020526040902054600160a060020a0316156133eb57600080fd5b60008181526001602081815260408084208054600160a060020a031916600160a060020a038816908117909155845260039091529091205461342c9161310e565b600160a060020a0390921660009081526003602052604090209190915550565b600160a060020a0316600090815260209190915260409020805460ff19169055565b600160a060020a0316600090815260209190915260409020805460ff19166001179055565b61349d828261377e565b600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af015550565b6134eb82611e13565b15156134f657600080fd5b6000828152600b602090815260409091208251611c7f9284019061384b565b6000903b1190565b6060806060806060806060806000808e98508d97508c96508b95508a94508451865188518a518c51010101016040519080825280601f01601f191660200182016040528015613576578160200160208202803883390190505b50935083925060009150600090505b88518110156135e357888181518110151561359c57fe5b90602001015160f860020a900460f860020a0283838060010194508151811015156135c357fe5b906020010190600160f860020a031916908160001a905350600101613585565b5060005b87518110156136455787818151811015156135fe57fe5b90602001015160f860020a900460f860020a02838380600101945081518110151561362557fe5b906020010190600160f860020a031916908160001a9053506001016135e7565b5060005b86518110156136a757868181518110151561366057fe5b90602001015160f860020a900460f860020a02838380600101945081518110151561368757fe5b906020010190600160f860020a031916908160001a905350600101613649565b5060005b85518110156137095785818151811015156136c257fe5b90602001015160f860020a900460f860020a0283838060010194508151811015156136e957fe5b906020010190600160f860020a031916908160001a9053506001016136ab565b5060005b845181101561376b57848181518110151561372457fe5b90602001015160f860020a900460f860020a02838380600101945081518110151561374b57fe5b906020010190600160f860020a031916908160001a90535060010161370d565b50909d9c50505050505050505050505050565b600160a060020a038216151561379357600080fd5b61379d8282612eaa565b6040518190600160a060020a038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60c0604051908101604052806000600160a060020a0316815260200160008152602001606081526020016060815260200160008152602001600081525090565b6080604051908101604052806000600160a060020a031681526020016060815260200160608152602001606081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061388c57805160ff19168380011785556138b9565b828001600101855582156138b9579182015b828111156138b957825182559160200191906001019061389e565b506138c5929150613957565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061390a5782800160ff198235161785556138b9565b828001600101855582156138b9579182015b828111156138b957823582559160200191906001019061391c565b815481835581811115611c7f57600083815260209020611c7f9181019083015b610edb91905b808211156138c5576000815560010161395d560077686974656c6973740000000000000000000000000000000000000000000000a165627a7a72305820669b05f4981e8f9d816c1ab634e869cba4a10755ce11737a6133b806262f1fa70029
Verified Source Code Partial Match
Compiler: v0.4.24+commit.e67f0147
EVM: byzantium
Optimization: Yes (200 runs)
RadiCards.sol 1385 lines
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @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 OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @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 relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @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 {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: openzeppelin-solidity/contracts/access/rbac/Roles.sol
/**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage _role, address _addr)
internal
{
_role.bearer[_addr] = true;
}
/**
* @dev remove an address' access to this role
*/
function remove(Role storage _role, address _addr)
internal
{
_role.bearer[_addr] = false;
}
/**
* @dev check if an address has this role
* // reverts
*/
function check(Role storage _role, address _addr)
internal
view
{
require(has(_role, _addr));
}
/**
* @dev check if an address has this role
* @return bool
*/
function has(Role storage _role, address _addr)
internal
view
returns (bool)
{
return _role.bearer[_addr];
}
}
// File: openzeppelin-solidity/contracts/access/rbac/RBAC.sol
/**
* @title RBAC (Role-Based Access Control)
* @author Matt Condon (@Shrugs)
* @dev Stores and provides setters and getters for roles and addresses.
* Supports unlimited numbers of roles and addresses.
* See //contracts/mocks/RBACMock.sol for an example of usage.
* This RBAC method uses strings to key roles. It may be beneficial
* for you to write your own implementation of this interface using Enums or similar.
*/
contract RBAC {
using Roles for Roles.Role;
mapping (string => Roles.Role) private roles;
event RoleAdded(address indexed operator, string role);
event RoleRemoved(address indexed operator, string role);
/**
* @dev reverts if addr does not have role
* @param _operator address
* @param _role the name of the role
* // reverts
*/
function checkRole(address _operator, string _role)
public
view
{
roles[_role].check(_operator);
}
/**
* @dev determine if addr has role
* @param _operator address
* @param _role the name of the role
* @return bool
*/
function hasRole(address _operator, string _role)
public
view
returns (bool)
{
return roles[_role].has(_operator);
}
/**
* @dev add a role to an address
* @param _operator address
* @param _role the name of the role
*/
function addRole(address _operator, string _role)
internal
{
roles[_role].add(_operator);
emit RoleAdded(_operator, _role);
}
/**
* @dev remove a role from an address
* @param _operator address
* @param _role the name of the role
*/
function removeRole(address _operator, string _role)
internal
{
roles[_role].remove(_operator);
emit RoleRemoved(_operator, _role);
}
/**
* @dev modifier to scope access to a single role (uses msg.sender as addr)
* @param _role the name of the role
* // reverts
*/
modifier onlyRole(string _role)
{
checkRole(msg.sender, _role);
_;
}
/**
* @dev modifier to scope access to a set of roles (uses msg.sender as addr)
* @param _roles the names of the roles to scope access to
* // reverts
*
* @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this
* see: https://github.com/ethereum/solidity/issues/2467
*/
// modifier onlyRoles(string[] _roles) {
// bool hasAnyRole = false;
// for (uint8 i = 0; i < _roles.length; i++) {
// if (hasRole(msg.sender, _roles[i])) {
// hasAnyRole = true;
// break;
// }
// }
// require(hasAnyRole);
// _;
// }
}
// File: openzeppelin-solidity/contracts/access/Whitelist.sol
/**
* @title Whitelist
* @dev The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions.
* This simplifies the implementation of "user permissions".
*/
contract Whitelist is Ownable, RBAC {
string public constant ROLE_WHITELISTED = "whitelist";
/**
* @dev Throws if operator is not whitelisted.
* @param _operator address
*/
modifier onlyIfWhitelisted(address _operator) {
checkRole(_operator, ROLE_WHITELISTED);
_;
}
/**
* @dev add an address to the whitelist
* @param _operator address
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/
function addAddressToWhitelist(address _operator)
public
onlyOwner
{
addRole(_operator, ROLE_WHITELISTED);
}
/**
* @dev getter to determine if address is in whitelist
*/
function whitelist(address _operator)
public
view
returns (bool)
{
return hasRole(_operator, ROLE_WHITELISTED);
}
/**
* @dev add addresses to the whitelist
* @param _operators addresses
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] _operators)
public
onlyOwner
{
for (uint256 i = 0; i < _operators.length; i++) {
addAddressToWhitelist(_operators[i]);
}
}
/**
* @dev remove an address from the whitelist
* @param _operator address
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/
function removeAddressFromWhitelist(address _operator)
public
onlyOwner
{
removeRole(_operator, ROLE_WHITELISTED);
}
/**
* @dev remove addresses from the whitelist
* @param _operators addresses
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/
function removeAddressesFromWhitelist(address[] _operators)
public
onlyOwner
{
for (uint256 i = 0; i < _operators.length; i++) {
removeAddressFromWhitelist(_operators[i]);
}
}
}
// File: openzeppelin-solidity/contracts/introspection/ERC165.sol
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
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.
*/
function supportsInterface(bytes4 _interfaceId)
external
view
returns (bool);
}
// File: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol
/**
* @title ERC721 Non-Fungible Token Standard basic interface
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Basic is ERC165 {
bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd;
/*
* 0x80ac58cd ===
* bytes4(keccak256('balanceOf(address)')) ^
* bytes4(keccak256('ownerOf(uint256)')) ^
* bytes4(keccak256('approve(address,uint256)')) ^
* bytes4(keccak256('getApproved(uint256)')) ^
* bytes4(keccak256('setApprovalForAll(address,bool)')) ^
* bytes4(keccak256('isApprovedForAll(address,address)')) ^
* bytes4(keccak256('transferFrom(address,address,uint256)')) ^
* bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))
*/
bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79;
/*
* 0x4f558e79 ===
* bytes4(keccak256('exists(uint256)'))
*/
bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63;
/**
* 0x780e9d63 ===
* bytes4(keccak256('totalSupply()')) ^
* bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
* bytes4(keccak256('tokenByIndex(uint256)'))
*/
bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f;
/**
* 0x5b5e139f ===
* bytes4(keccak256('name()')) ^
* bytes4(keccak256('symbol()')) ^
* bytes4(keccak256('tokenURI(uint256)'))
*/
event Transfer(
address indexed _from,
address indexed _to,
uint256 indexed _tokenId
);
event Approval(
address indexed _owner,
address indexed _approved,
uint256 indexed _tokenId
);
event ApprovalForAll(
address indexed _owner,
address indexed _operator,
bool _approved
);
function balanceOf(address _owner) public view returns (uint256 _balance);
function ownerOf(uint256 _tokenId) public view returns (address _owner);
function exists(uint256 _tokenId) public view returns (bool _exists);
function approve(address _to, uint256 _tokenId) public;
function getApproved(uint256 _tokenId)
public view returns (address _operator);
function setApprovalForAll(address _operator, bool _approved) public;
function isApprovedForAll(address _owner, address _operator)
public view returns (bool);
function transferFrom(address _from, address _to, uint256 _tokenId) public;
function safeTransferFrom(address _from, address _to, uint256 _tokenId)
public;
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes _data
)
public;
}
// File: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Enumerable is ERC721Basic {
function totalSupply() public view returns (uint256);
function tokenOfOwnerByIndex(
address _owner,
uint256 _index
)
public
view
returns (uint256 _tokenId);
function tokenByIndex(uint256 _index) public view returns (uint256);
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Metadata is ERC721Basic {
function name() external view returns (string _name);
function symbol() external view returns (string _symbol);
function tokenURI(uint256 _tokenId) public view returns (string);
}
/**
* @title ERC-721 Non-Fungible Token Standard, full implementation interface
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata {
}
// File: openzeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
contract ERC721Receiver {
/**
* @dev Magic value to be returned upon successful reception of an NFT
* Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`,
* which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
*/
bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;
/**
* @notice Handle the receipt of an NFT
* @dev The ERC721 smart contract calls this function on the recipient
* after a `safetransfer`. 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)"))`
*/
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes _data
)
public
returns(bytes4);
}
// File: openzeppelin-solidity/contracts/AddressUtils.sol
/**
* Utility library of inline functions on addresses
*/
library AddressUtils {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param _addr address to check
* @return whether the target address is a contract
*/
function isContract(address _addr) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solium-disable-next-line security/no-inline-assembly
assembly { size := extcodesize(_addr) }
return size > 0;
}
}
// File: openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol
/**
* @title SupportsInterfaceWithLookup
* @author Matt Condon (@shrugs)
* @dev Implements ERC165 using a lookup table.
*/
contract SupportsInterfaceWithLookup is ERC165 {
bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7;
/**
* 0x01ffc9a7 ===
* bytes4(keccak256('supportsInterface(bytes4)'))
*/
/**
* @dev a mapping of interface id to whether or not it's supported
*/
mapping(bytes4 => bool) internal supportedInterfaces;
/**
* @dev A contract implementing SupportsInterfaceWithLookup
* implement ERC165 itself
*/
constructor()
public
{
_registerInterface(InterfaceId_ERC165);
}
/**
* @dev implement supportsInterface(bytes4) using a lookup table
*/
function supportsInterface(bytes4 _interfaceId)
external
view
returns (bool)
{
return supportedInterfaces[_interfaceId];
}
/**
* @dev private method for registering an interface
*/
function _registerInterface(bytes4 _interfaceId)
internal
{
require(_interfaceId != 0xffffffff);
supportedInterfaces[_interfaceId] = true;
}
}
// File: openzeppelin-solidity/contracts/token/ERC721/ERC721BasicToken.sol
/**
* @title ERC721 Non-Fungible Token Standard basic implementation
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {
using SafeMath for uint256;
using AddressUtils for address;
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
// which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
bytes4 private constant ERC721_RECEIVED = 0x150b7a02;
// Mapping from token ID to owner
mapping (uint256 => address) internal tokenOwner;
// Mapping from token ID to approved address
mapping (uint256 => address) internal tokenApprovals;
// Mapping from owner to number of owned token
mapping (address => uint256) internal ownedTokensCount;
// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) internal operatorApprovals;
constructor()
public
{
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(InterfaceId_ERC721);
_registerInterface(InterfaceId_ERC721Exists);
}
/**
* @dev Gets the balance of the specified address
* @param _owner address to query the balance of
* @return uint256 representing the amount owned by the passed address
*/
function balanceOf(address _owner) public view returns (uint256) {
require(_owner != address(0));
return ownedTokensCount[_owner];
}
/**
* @dev Gets the owner of the specified token ID
* @param _tokenId uint256 ID of the token to query the owner of
* @return owner address currently marked as the owner of the given token ID
*/
function ownerOf(uint256 _tokenId) public view returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0));
return owner;
}
/**
* @dev Returns whether the specified token exists
* @param _tokenId uint256 ID of the token to query the existence of
* @return whether the token exists
*/
function exists(uint256 _tokenId) public view returns (bool) {
address owner = tokenOwner[_tokenId];
return owner != address(0);
}
/**
* @dev Approves another address to transfer the given token ID
* The zero address indicates there is no approved address.
* There can only be one approved address per token at a given time.
* Can only be called by the token owner or an approved operator.
* @param _to address to be approved for the given token ID
* @param _tokenId uint256 ID of the token to be approved
*/
function approve(address _to, uint256 _tokenId) public {
address owner = ownerOf(_tokenId);
require(_to != owner);
require(msg.sender == owner || isApprovedForAll(owner, msg.sender));
tokenApprovals[_tokenId] = _to;
emit Approval(owner, _to, _tokenId);
}
/**
* @dev Gets the approved address for a token ID, or zero if no address set
* @param _tokenId uint256 ID of the token to query the approval of
* @return address currently approved for the given token ID
*/
function getApproved(uint256 _tokenId) public view returns (address) {
return tokenApprovals[_tokenId];
}
/**
* @dev Sets or unsets the approval of a given operator
* An operator is allowed to transfer all tokens of the sender on their behalf
* @param _to operator address to set the approval
* @param _approved representing the status of the approval to be set
*/
function setApprovalForAll(address _to, bool _approved) public {
require(_to != msg.sender);
operatorApprovals[msg.sender][_to] = _approved;
emit ApprovalForAll(msg.sender, _to, _approved);
}
/**
* @dev Tells whether an operator is approved by a given owner
* @param _owner owner address which you want to query the approval of
* @param _operator operator address which you want to query the approval of
* @return bool whether the given operator is approved by the given owner
*/
function isApprovedForAll(
address _owner,
address _operator
)
public
view
returns (bool)
{
return operatorApprovals[_owner][_operator];
}
/**
* @dev Transfers the ownership of a given token ID to another address
* Usage of this method is discouraged, use `safeTransferFrom` whenever possible
* Requires the msg sender to be the owner, approved, or operator
* @param _from current owner of the token
* @param _to address to receive the ownership of the given token ID
* @param _tokenId uint256 ID of the token to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
{
require(isApprovedOrOwner(msg.sender, _tokenId));
require(_from != address(0));
require(_to != address(0));
clearApproval(_from, _tokenId);
removeTokenFrom(_from, _tokenId);
addTokenTo(_to, _tokenId);
emit Transfer(_from, _to, _tokenId);
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
*
* Requires the msg sender to be the owner, approved, or operator
* @param _from current owner of the token
* @param _to address to receive the ownership of the given token ID
* @param _tokenId uint256 ID of the token to be transferred
*/
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
{
// solium-disable-next-line arg-overflow
safeTransferFrom(_from, _to, _tokenId, "");
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the msg sender to be the owner, approved, or operator
* @param _from current owner of the token
* @param _to address to receive the ownership of the given token ID
* @param _tokenId uint256 ID of the token to be transferred
* @param _data bytes data to send along with a safe transfer check
*/
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes _data
)
public
{
transferFrom(_from, _to, _tokenId);
// solium-disable-next-line arg-overflow
require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data));
}
/**
* @dev Returns whether the given spender can transfer a given token ID
* @param _spender address of the spender to query
* @param _tokenId uint256 ID of the token to be transferred
* @return bool whether the msg.sender is approved for the given token ID,
* is an operator of the owner, or is the owner of the token
*/
function isApprovedOrOwner(
address _spender,
uint256 _tokenId
)
internal
view
returns (bool)
{
address owner = ownerOf(_tokenId);
// Disable solium check because of
// https://github.com/duaraghav8/Solium/issues/175
// solium-disable-next-line operator-whitespace
return (
_spender == owner ||
getApproved(_tokenId) == _spender ||
isApprovedForAll(owner, _spender)
);
}
/**
* @dev Internal function to mint a new token
* Reverts if the given token ID already exists
* @param _to The address that will own the minted token
* @param _tokenId uint256 ID of the token to be minted by the msg.sender
*/
function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addTokenTo(_to, _tokenId);
emit Transfer(address(0), _to, _tokenId);
}
/**
* @dev Internal function to burn a specific token
* Reverts if the token does not exist
* @param _tokenId uint256 ID of the token being burned by the msg.sender
*/
function _burn(address _owner, uint256 _tokenId) internal {
clearApproval(_owner, _tokenId);
removeTokenFrom(_owner, _tokenId);
emit Transfer(_owner, address(0), _tokenId);
}
/**
* @dev Internal function to clear current approval of a given token ID
* Reverts if the given address is not indeed the owner of the token
* @param _owner owner of the token
* @param _tokenId uint256 ID of the token to be transferred
*/
function clearApproval(address _owner, uint256 _tokenId) internal {
require(ownerOf(_tokenId) == _owner);
if (tokenApprovals[_tokenId] != address(0)) {
tokenApprovals[_tokenId] = address(0);
}
}
/**
* @dev Internal function to add a token ID to the list of a given address
* @param _to address representing the new owner of the given token ID
* @param _tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function addTokenTo(address _to, uint256 _tokenId) internal {
require(tokenOwner[_tokenId] == address(0));
tokenOwner[_tokenId] = _to;
ownedTokensCount[_to] = ownedTokensCount[_to].add(1);
}
/**
* @dev Internal function to remove a token ID from the list of a given address
* @param _from address representing the previous owner of the given token ID
* @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function removeTokenFrom(address _from, uint256 _tokenId) internal {
require(ownerOf(_tokenId) == _from);
ownedTokensCount[_from] = ownedTokensCount[_from].sub(1);
tokenOwner[_tokenId] = address(0);
}
/**
* @dev Internal function to invoke `onERC721Received` on a target address
* The call is not executed if the target address is not a contract
* @param _from address representing the previous owner of the given token ID
* @param _to target address that will receive the tokens
* @param _tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return whether the call correctly returned the expected magic value
*/
function checkAndCallSafeTransfer(
address _from,
address _to,
uint256 _tokenId,
bytes _data
)
internal
returns (bool)
{
if (!_to.isContract()) {
return true;
}
bytes4 retval = ERC721Receiver(_to).onERC721Received(
msg.sender, _from, _tokenId, _data);
return (retval == ERC721_RECEIVED);
}
}
// File: openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol
/**
* @title Full ERC721 Token
* This implementation includes all the required and some optional functionality of the ERC721 standard
* Moreover, it includes approve all functionality using operator terminology
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Token is SupportsInterfaceWithLookup, ERC721BasicToken, ERC721 {
// Token name
string internal name_;
// Token symbol
string internal symbol_;
// Mapping from owner to list of owned token IDs
mapping(address => uint256[]) internal ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) internal ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] internal allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) internal allTokensIndex;
// Optional mapping for token URIs
mapping(uint256 => string) internal tokenURIs;
/**
* @dev Constructor function
*/
constructor(string _name, string _symbol) public {
name_ = _name;
symbol_ = _symbol;
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(InterfaceId_ERC721Enumerable);
_registerInterface(InterfaceId_ERC721Metadata);
}
/**
* @dev Gets the token name
* @return string representing the token name
*/
function name() external view returns (string) {
return name_;
}
/**
* @dev Gets the token symbol
* @return string representing the token symbol
*/
function symbol() external view returns (string) {
return symbol_;
}
/**
* @dev Returns an URI for a given token ID
* Throws if the token ID does not exist. May return an empty string.
* @param _tokenId uint256 ID of the token to query
*/
function tokenURI(uint256 _tokenId) public view returns (string) {
require(exists(_tokenId));
return tokenURIs[_tokenId];
}
/**
* @dev Gets the token ID at a given index of the tokens list of the requested owner
* @param _owner address owning the tokens list to be accessed
* @param _index uint256 representing the index to be accessed of the requested tokens list
* @return uint256 token ID at the given index of the tokens list owned by the requested address
*/
function tokenOfOwnerByIndex(
address _owner,
uint256 _index
)
public
view
returns (uint256)
{
require(_index < balanceOf(_owner));
return ownedTokens[_owner][_index];
}
/**
* @dev Gets the total amount of tokens stored by the contract
* @return uint256 representing the total amount of tokens
*/
function totalSupply() public view returns (uint256) {
return allTokens.length;
}
/**
* @dev Gets the token ID at a given index of all the tokens in this contract
* Reverts if the index is greater or equal to the total number of tokens
* @param _index uint256 representing the index to be accessed of the tokens list
* @return uint256 token ID at the given index of the tokens list
*/
function tokenByIndex(uint256 _index) public view returns (uint256) {
require(_index < totalSupply());
return allTokens[_index];
}
/**
* @dev Internal function to set the token URI for a given token
* Reverts if the token ID does not exist
* @param _tokenId uint256 ID of the token to set its URI
* @param _uri string URI to assign
*/
function _setTokenURI(uint256 _tokenId, string _uri) internal {
require(exists(_tokenId));
tokenURIs[_tokenId] = _uri;
}
/**
* @dev Internal function to add a token ID to the list of a given address
* @param _to address representing the new owner of the given token ID
* @param _tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function addTokenTo(address _to, uint256 _tokenId) internal {
super.addTokenTo(_to, _tokenId);
uint256 length = ownedTokens[_to].length;
ownedTokens[_to].push(_tokenId);
ownedTokensIndex[_tokenId] = length;
}
/**
* @dev Internal function to remove a token ID from the list of a given address
* @param _from address representing the previous owner of the given token ID
* @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function removeTokenFrom(address _from, uint256 _tokenId) internal {
super.removeTokenFrom(_from, _tokenId);
// To prevent a gap in the array, we store the last token in the index of the token to delete, and
// then delete the last slot.
uint256 tokenIndex = ownedTokensIndex[_tokenId];
uint256 lastTokenIndex = ownedTokens[_from].length.sub(1);
uint256 lastToken = ownedTokens[_from][lastTokenIndex];
ownedTokens[_from][tokenIndex] = lastToken;
// This also deletes the contents at the last position of the array
ownedTokens[_from].length--;
// Note that this will handle single-element arrays. In that case, both tokenIndex and lastTokenIndex are going to
// be zero. Then we can make sure that we will remove _tokenId from the ownedTokens list since we are first swapping
// the lastToken to the first position, and then dropping the element placed in the last position of the list
ownedTokensIndex[_tokenId] = 0;
ownedTokensIndex[lastToken] = tokenIndex;
}
/**
* @dev Internal function to mint a new token
* Reverts if the given token ID already exists
* @param _to address the beneficiary that will own the minted token
* @param _tokenId uint256 ID of the token to be minted by the msg.sender
*/
function _mint(address _to, uint256 _tokenId) internal {
super._mint(_to, _tokenId);
allTokensIndex[_tokenId] = allTokens.length;
allTokens.push(_tokenId);
}
/**
* @dev Internal function to burn a specific token
* Reverts if the token does not exist
* @param _owner owner of the token to burn
* @param _tokenId uint256 ID of the token being burned by the msg.sender
*/
function _burn(address _owner, uint256 _tokenId) internal {
super._burn(_owner, _tokenId);
// Clear metadata (if any)
if (bytes(tokenURIs[_tokenId]).length != 0) {
delete tokenURIs[_tokenId];
}
// Reorg all tokens array
uint256 tokenIndex = allTokensIndex[_tokenId];
uint256 lastTokenIndex = allTokens.length.sub(1);
uint256 lastToken = allTokens[lastTokenIndex];
allTokens[tokenIndex] = lastToken;
allTokens[lastTokenIndex] = 0;
allTokens.length--;
allTokensIndex[_tokenId] = 0;
allTokensIndex[lastToken] = tokenIndex;
}
}
// File: contracts/Strings.sol
library Strings {
// via https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.5.sol
function strConcat(string _a, string _b, string _c, string _d, string _e) internal pure returns (string) {
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);
bytes memory _bd = bytes(_d);
bytes memory _be = bytes(_e);
string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
bytes memory babcde = bytes(abcde);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
for (i = 0; i < _be.length; i++) babcde[k++] = _be[i];
return string(babcde);
}
function strConcat(string _a, string _b) internal pure returns (string) {
return strConcat(_a, _b, "", "", "");
}
}
// File: contracts/RadiCards.sol
/**
* @title Radi.Cards
*
* @author blockrocket.tech (smart contracts)
* @author cryptodecks.co
* @author knownorigin.io
* @author pheme.app
* @author d1labs.com
* @author mbdoesthings.com
*/
contract RadiCards is ERC721Token, Whitelist {
using SafeMath for uint256;
string public tokenBaseURI = "https://ipfs.infura.io/ipfs/";
uint256 public tokenIdPointer = 0;
uint256 public minContribution = 0.01 ether;
struct Benefactor {
address ethAddress;
string name;
string website;
string logo;
}
struct CardDesign {
string tokenURI;
bool active;
}
struct RadiCard {
// Metadata
address gifter;
uint256 giftingAmount;
string message;
string extra;
// Lookups
uint256 cardIndex;
uint256 benefactorIndex;
}
event CardGifted(
address indexed _to,
uint256 indexed _benefactorIndex,
uint256 indexed _cardIndex,
address _from,
uint256 _tokenId
);
event BenefactorAdded(
uint256 indexed _benefactorIndex
);
event CardAdded(
uint256 indexed _cardIndex
);
mapping(uint256 => Benefactor) public benefactors;
uint256[] internal benefactorsIndex;
mapping(uint256 => CardDesign) public cards;
uint256[] internal cardsIndex;
mapping(uint256 => RadiCard) public tokenIdToRadiCardIndex;
uint256 public totalGiftedInWei;
constructor () public ERC721Token("RadiCards", "RADI") {
addAddressToWhitelist(msg.sender);
}
function gift(address to, uint256 _benefactorIndex, uint256 _cardIndex, string _message, string _extra) payable public returns (bool) {
require(to != address(0), "Must be a valid address");
require(benefactors[_benefactorIndex].ethAddress != address(0), "Must specify existing benefactor");
require(bytes(cards[_cardIndex].tokenURI).length != 0, "Must specify existing card");
require(cards[_cardIndex].active, "Must be an active card");
require(msg.value >= minContribution, "Must send at least the minimum amount");
tokenIdToRadiCardIndex[tokenIdPointer] = RadiCard({
gifter : msg.sender,
giftingAmount : msg.value,
message : _message,
extra : _extra,
benefactorIndex : _benefactorIndex,
cardIndex : _cardIndex
});
uint256 _tokenId = _mint(to, cards[_cardIndex].tokenURI);
// transfer the ETH to the benefactor
benefactors[_benefactorIndex].ethAddress.transfer(msg.value);
// tally up the total eth gifted
totalGiftedInWei = totalGiftedInWei.add(msg.value);
// Fire an event with all the import information in
emit CardGifted(to, _benefactorIndex, _cardIndex, msg.sender, _tokenId);
return true;
}
function _mint(address to, string tokenURI) internal returns (uint256 _tokenId) {
uint256 tokenId = tokenIdPointer;
super._mint(to, tokenId);
_setTokenURI(tokenId, tokenURI);
tokenIdPointer = tokenIdPointer.add(1);
return tokenId;
}
function burn(uint256 _tokenId) public {
revert("Radi.Cards are censorship resistant!");
}
function tokenURI(uint256 _tokenId) public view returns (string) {
require(exists(_tokenId));
return Strings.strConcat(tokenBaseURI, tokenURIs[_tokenId]);
}
function tokenDetails(uint256 _tokenId)
public view
returns (
address _gifter,
uint256 _giftingAmount,
string _message,
string _extra,
uint256 _cardIndex,
uint256 _benefactorIndex
) {
require(exists(_tokenId));
RadiCard memory _radiCard = tokenIdToRadiCardIndex[_tokenId];
return (
_radiCard.gifter,
_radiCard.giftingAmount,
_radiCard.message,
_radiCard.extra,
_radiCard.cardIndex,
_radiCard.benefactorIndex
);
}
function tokenBenefactor(uint256 _tokenId)
public view
returns (
address _ethAddress,
string _name,
string _website,
string _logo
) {
require(exists(_tokenId));
RadiCard memory _radiCard = tokenIdToRadiCardIndex[_tokenId];
Benefactor memory _benefactor = benefactors[_radiCard.benefactorIndex];
return (
_benefactor.ethAddress,
_benefactor.name,
_benefactor.website,
_benefactor.logo
);
}
function tokensOf(address _owner) public view returns (uint256[] _tokenIds) {
return ownedTokens[_owner];
}
function benefactorsKeys() public view returns (uint256[] _keys) {
return benefactorsIndex;
}
function cardsKeys() public view returns (uint256[] _keys) {
return cardsIndex;
}
function addBenefactor(uint256 _benefactorIndex, address _ethAddress, string _name, string _website, string _logo)
public onlyIfWhitelisted(msg.sender)
returns (bool) {
require(address(_ethAddress) != address(0), "Invalid address");
require(bytes(_name).length != 0, "Invalid name");
require(bytes(_website).length != 0, "Invalid name");
require(bytes(_logo).length != 0, "Invalid name");
benefactors[_benefactorIndex] = Benefactor(
_ethAddress,
_name,
_website,
_logo
);
benefactorsIndex.push(_benefactorIndex);
emit BenefactorAdded(_benefactorIndex);
return true;
}
function addCard(uint256 _cardIndex, string _tokenURI, bool _active)
public onlyIfWhitelisted(msg.sender)
returns (bool) {
require(bytes(_tokenURI).length != 0, "Invalid token URI");
cards[_cardIndex] = CardDesign(
_tokenURI,
_active
);
cardsIndex.push(_cardIndex);
emit CardAdded(_cardIndex);
return true;
}
function setTokenBaseURI(string _newBaseURI) external onlyIfWhitelisted(msg.sender) {
require(bytes(_newBaseURI).length != 0, "Base URI invalid");
tokenBaseURI = _newBaseURI;
}
function setMinContribution(uint256 _minContribution) external onlyIfWhitelisted(msg.sender) {
require(_minContribution > 0, "Invalid minimum contribution");
minContribution = _minContribution;
}
function setActive(uint256 _cardIndex, bool _active) external onlyIfWhitelisted(msg.sender) {
require(bytes(cards[_cardIndex].tokenURI).length != 0, "Must specify existing card");
cards[_cardIndex].active = _active;
}
}
Read Contract
InterfaceId_ERC165 0x19fa8f50 → bytes4
ROLE_WHITELISTED 0x18b919e9 → string
balanceOf 0x70a08231 → uint256
benefactors 0x128ee161 → address, string, string, string
benefactorsKeys 0x03cfe12d → uint256[]
cards 0x8dc10768 → string, bool
cardsKeys 0xf7ad51ce → uint256[]
checkRole 0x0988ca8c
exists 0x4f558e79 → bool
getApproved 0x081812fc → address
hasRole 0x217fe6c6 → bool
isApprovedForAll 0xe985e9c5 → bool
minContribution 0xaaffadf3 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenBaseURI 0x4e99b800 → string
tokenBenefactor 0x1db1b4fd → address, string, string, string
tokenByIndex 0x4f6ccce7 → uint256
tokenDetails 0xfc314e31 → address, uint256, string, string, uint256, uint256
tokenIdPointer 0x3b3a1a7a → uint256
tokenIdToRadiCardIndex 0x0701fd6b → address, uint256, string, string, uint256, uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
tokensOf 0x5a3f2672 → uint256[]
totalGiftedInWei 0xf9256de1 → uint256
totalSupply 0x18160ddd → uint256
whitelist 0x9b19251a → bool
Write Contract 18 functions
These functions modify contract state and require a wallet transaction to execute.
addAddressToWhitelist 0x7b9417c8
address _operator
addAddressesToWhitelist 0xe2ec6ec3
address[] _operators
addBenefactor 0x37073a87
uint256 _benefactorIndex
address _ethAddress
string _name
string _website
string _logo
returns: bool
addCard 0x5f75d62d
uint256 _cardIndex
string _tokenURI
bool _active
returns: bool
approve 0x095ea7b3
address _to
uint256 _tokenId
burn 0x42966c68
uint256 _tokenId
gift 0x8074dc59
address to
uint256 _benefactorIndex
uint256 _cardIndex
string _message
string _extra
returns: bool
removeAddressFromWhitelist 0x286dd3f5
address _operator
removeAddressesFromWhitelist 0x24953eaa
address[] _operators
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address _from
address _to
uint256 _tokenId
safeTransferFrom 0xb88d4fde
address _from
address _to
uint256 _tokenId
bytes _data
setActive 0xe60a955d
uint256 _cardIndex
bool _active
setApprovalForAll 0xa22cb465
address _to
bool _approved
setMinContribution 0x473b0d46
uint256 _minContribution
setTokenBaseURI 0x8ef79e91
string _newBaseURI
transferFrom 0x23b872dd
address _from
address _to
uint256 _tokenId
transferOwnership 0xf2fde38b
address _newOwner
Recent Transactions
No transactions found for this address