Address Contract Partially Verified
Address
0xe868c2f703d53AcbE9659fDaa743Fb3B5b4B29EC
Balance
0 ETH
Nonce
1
Code Size
21424 bytes
Creator
0xc2Fe7007...302F at tx 0xd49b162c...e1d0dd
Indexed Transactions
0 (1 on-chain, 1.3% indexed)
Contract Bytecode
21424 bytes
0x608060405260043610610196576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063015008b11461019b578063018a25e8146101e857806306fdde03146102135780630f15f4c0146102a357806310f01eba146102ba57806324c33d33146103115780632660316e146103a35780632e19ebdc146103f65780633ccfd60b1461043b57806349cc635d146104525780635893d481146104b757806358d162da14610502578063624ae5c01461052d57806363066434146105585780637196980c146105a7578063747dff42146105d25780638f7140ea146106705780638f8a5832146106ab57806395d89b41146106e2578063a2bccae914610772578063a4c0ed36146107d2578063b5e0751414610837578063baf8f7da14610862578063c7e284b814610879578063ce89c80c146108a4578063cf808000146108ef578063d53b267914610930578063dc1fb5a51461095f578063de7874f3146109b6578063ee0b5d8b14610a55578063f53d0a8e14610ade578063fb9073eb14610b35575b600080fd5b3480156101a757600080fd5b506101e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b70565b005b3480156101f457600080fd5b506101fd610e1f565b6040518082815260200191505060405180910390f35b34801561021f57600080fd5b50610228610f13565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561026857808201518184015260208101905061024d565b50505050905090810190601f1680156102955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102af57600080fd5b506102b8610f4c565b005b3480156102c657600080fd5b506102fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061109f565b6040518082815260200191505060405180910390f35b34801561031d57600080fd5b5061033c600480360381019080803590602001909291905050506110b7565b604051808d81526020018c81526020018b81526020018a1515151581526020018981526020018881526020018781526020018681526020018581526020018481526020018381526020018281526020019c5050505050505050505050505060405180910390f35b3480156103af57600080fd5b506103dc600480360381019080803590602001909291908035600019169060200190929190505050611124565b604051808215151515815260200191505060405180910390f35b34801561040257600080fd5b506104256004803603810190808035600019169060200190929190505050611153565b6040518082815260200191505060405180910390f35b34801561044757600080fd5b5061045061116b565b005b34801561045e57600080fd5b506104b560048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560001916906020019092919080359060200190929190505050611705565b005b3480156104c357600080fd5b506104ec6004803603810190808035906020019092919080359060200190929190505050611a89565b6040518082815260200191505060405180910390f35b34801561050e57600080fd5b50610517611aae565b6040518082815260200191505060405180910390f35b34801561053957600080fd5b50610542611ab4565b6040518082815260200191505060405180910390f35b34801561056457600080fd5b5061058360048036038101908080359060200190929190505050611aba565b60405180848152602001838152602001828152602001935050505060405180910390f35b3480156105b357600080fd5b506105bc611d6b565b6040518082815260200191505060405180910390f35b3480156105de57600080fd5b506105e7611d71565b604051808b81526020018a81526020018981526020018881526020018781526020018681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183600019166000191681526020018281526020019a505050505050505050505060405180910390f35b34801561067c57600080fd5b506106a9600480360381019080803590602001909291908035600019169060200190929190505050611eed565b005b3480156106b757600080fd5b506106e0600480360381019080803590602001909291908035906020019092919050505061205a565b005b3480156106ee57600080fd5b506106f761226d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561073757808201518184015260208101905061071c565b50505050905090810190601f1680156107645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561077e57600080fd5b506107a760048036038101908080359060200190929190803590602001909291905050506122a6565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b3480156107de57600080fd5b50610835600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019082018035906020019190919293919293905050506122e3565b005b34801561084357600080fd5b5061084c6123ff565b6040518082815260200191505060405180910390f35b34801561086e57600080fd5b50610877612405565b005b34801561088557600080fd5b5061088e61251a565b6040518082815260200191505060405180910390f35b3480156108b057600080fd5b506108d960048036038101908080359060200190929190803590602001909291905050506125d5565b6040518082815260200191505060405180910390f35b3480156108fb57600080fd5b5061091a600480360381019080803590602001909291905050506126a4565b6040518082815260200191505060405180910390f35b34801561093c57600080fd5b5061094561278c565b604051808215151515815260200191505060405180910390f35b34801561096b57600080fd5b5061097461279f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109c257600080fd5b506109e1600480360381019080803590602001909291905050506127c5565b604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001876000191660001916815260200186815260200185815260200184815260200183815260200182815260200197505050505050505060405180910390f35b348015610a6157600080fd5b50610a96600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612827565b60405180888152602001876000191660001916815260200186815260200185815260200184815260200183815260200182815260200197505050505050505060405180910390f35b348015610aea57600080fd5b50610af3612975565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b4157600080fd5b50610b6e60048036038101908080356000191690602001909291908035906020019092919050505061299a565b005b610b7861531e565b60008060011515601060009054906101000a900460ff161515141515610b9d57600080fd5b83633b9aca008110151515610c40576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f706f636b6574206c696e743a206e6f7420612076616c69642063757272656e6381526020017f790000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b69152d02c7e14af68000008111151515610cc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6e6f207365726765792c206e6f0000000000000000000000000000000000000081525060200191505060405180910390fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549250600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161480610d6a57503373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16145b15610d8d5760076000848152602001908152602001600020600601549150610e0b565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600760008481526020019081526020016000206006015482141515610e0a578160076000858152602001908152602001600020600601819055505b5b610e1783838787612bef565b505050505050565b60008060006004549150429050600354600a6000848152602001908152602001600020600401540181118015610ead5750600a60008381526020019081526020016000206002015481111580610eac5750600a60008381526020019081526020016000206002015481118015610eab57506000600a600084815260200190815260200160002060000154145b5b5b15610f0457610efd670de0b6b3a7640000610eef670de0b6b3a7640000600a600087815260200190815260200160002060050154612ea490919063ffffffff16565b612f2c90919063ffffffff16565b9250610f0e565b6544364c5bb00092505b505090565b6040805190810160405280600881526020017f4c696e6b466f6d6f00000000000000000000000000000000000000000000000081525081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fa757600080fd5b60001515601060009054906101000a900460ff161515141515611032576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f666f6d6f336420616c726561647920616374697661746564000000000000000081525060200191505060405180910390fd5b6001601060006101000a81548160ff0219169083151502179055506001600481905550600354600254420103600a6000600181526020019081526020016000206004018190555060025461a8c0420101600a60006001815260200190815260200160002060020181905550565b60056020528060005260406000206000915090505481565b600a6020528060005260406000206000915090508060000154908060010154908060020154908060030160009054906101000a900460ff169080600401549080600501549080600601549080600701549080600801549080600901549080600a01549080600b015490508c565b60096020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60066020528060005260406000206000915090505481565b60008060008061117961531e565b60011515601060009054906101000a900460ff16151514151561119b57600080fd5b6004549450429350600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549250600a60008681526020019081526020016000206002015484118015611231575060001515600a600087815260200190815260200160002060030160009054906101000a900460ff161515145b801561125457506000600a60008781526020019081526020016000206000015414155b15611525576001600a600087815260200190815260200160002060030160006101000a81548160ff02191690831515021790555061129181612f6b565b905061129c83613552565b915060008211156113d15773514910771af9ca656af840dff83e8264ecf986ca73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6007600086815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561139457600080fd5b505af11580156113a8573d6000803e3d6000fd5b505050506040513d60208110156113be57600080fd5b8101908080519060200190929190505050505b670de0b6b3a76400008402816000015101816000018181525050828160200151018160200181815250507f0bd0dba8ab932212fa78150cdb7b0275da72e255875967b5cad11464cf71bedc33600760008681526020019081526020016000206001015484846000015185602001518660400151876060015188608001518960a001518a60c001518b60e00151604051808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018b600019166000191681526020018a81526020018981526020018881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186600019166000191681526020018581526020018481526020018381526020018281526020019b50505050505050505050505060405180910390a16116fe565b61152e83613552565b915060008211156116635773514910771af9ca656af840dff83e8264ecf986ca73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6007600086815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561162657600080fd5b505af115801561163a573d6000803e3d6000fd5b505050506040513d602081101561165057600080fd5b8101908080519060200190929190505050505b827f8f36579a548bc439baa172a6521207464154da77f411e2da3db2f53affe6cc3a3360076000878152602001908152602001600020600101548588604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001846000191660001916815260200183815260200182815260200194505050505060405180910390a25b5050505050565b732df59369317ef8dcc3b1bb4550a9cec2db4707d573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001807f796f7572206e6f7420706c617965724e616d657320636f6e74726163742e2e2e81526020017f20686d6d6d2e2e0000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b83600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414151561186f5783600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b83600660008460001916600019168152602001908152602001600020541415156118b45783600660008460001916600019168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff166007600086815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561197557826007600086815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b81600019166007600086815260200190815260200160002060010154600019161415156119bc57816007600086815260200190815260200160002060010181600019169055505b8060076000868152602001908152602001600020600601541415156119f7578060076000868152602001908152602001600020600601819055505b60001515600960008681526020019081526020016000206000846000191660001916815260200190815260200160002060009054906101000a900460ff1615151415611a83576001600960008681526020019081526020016000206000846000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055505b50505050565b600b602052816000526040600020602052806000526040600020600091509150505481565b600c5481565b60045481565b6000806000806004549050600a60008281526020019081526020016000206002015442118015611b11575060001515600a600083815260200190815260200160002060030160009054906101000a900460ff161515145b8015611b3457506000600a60008381526020019081526020016000206000015414155b15611ce65784600a6000838152602001908152602001600020600001541415611c4257611bb56064611b866030600a60008681526020019081526020016000206007015461364590919063ffffffff16565b811515611b8f57fe5b046007600088815260200190815260200160002060020154612ea490919063ffffffff16565b611c20611bfb60086000898152602001908152602001600020600085815260200190815260200160002060020154611bed89866136e9565b6137d990919063ffffffff16565b6007600089815260200190815260200160002060030154612ea490919063ffffffff16565b6007600088815260200190815260200160002060040154935093509350611d63565b6007600086815260200190815260200160002060020154611cc4611c9f60086000898152602001908152602001600020600085815260200190815260200160002060020154611c9189866136e9565b6137d990919063ffffffff16565b6007600089815260200190815260200160002060030154612ea490919063ffffffff16565b6007600088815260200190815260200160002060040154935093509350611d63565b6007600086815260200190815260200160002060020154611d45611d2087600760008a81526020019081526020016000206005015461385e565b6007600089815260200190815260200160002060030154612ea490919063ffffffff16565b60076000888152602001908152602001600020600401549350935093505b509193909250565b600d5481565b60008060008060008060008060008060006004549050600a60008281526020019081526020016000206009015481600a600084815260200190815260200160002060050154600a600085815260200190815260200160002060020154600a600086815260200190815260200160002060040154600a600087815260200190815260200160002060070154600a8060008981526020019081526020016000206000015402600a6000898152602001908152602001600020600101540160076000600a60008b815260200190815260200160002060000154815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660076000600a60008c815260200190815260200160002060000154815260200190815260200160002060010154600b60008b8152602001908152602001600020600060028152602001908152602001600020549a509a509a509a509a509a509a509a509a509a505090919293949596979899565b732df59369317ef8dcc3b1bb4550a9cec2db4707d573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001807f796f7572206e6f7420706c617965724e616d657320636f6e74726163742e2e2e81526020017f20686d6d6d2e2e0000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60001515600960008481526020019081526020016000206000836000191660001916815260200190815260200160002060009054906101000a900460ff1615151415612056576001600960008481526020019081526020016000206000836000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b61206261531e565b600060011515601060009054906101000a900460ff16151514151561208657600080fd5b82633b9aca008110151515612129576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f706f636b6574206c696e743a206e6f7420612076616c69642063757272656e6381526020017f790000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b69152d02c7e14af680000081111515156121ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6e6f207365726765792c206e6f0000000000000000000000000000000000000081525060200191505060405180910390fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054915060008514806121fb57508185145b1561221e576007600083815260200190815260200160002060060154945061225a565b600760008381526020019081526020016000206006015485141515612259578460076000848152602001908152602001600020600601819055505b5b61226682868686612bef565b5050505050565b6040805190810160405280600481526020017f4c3344460000000000000000000000000000000000000000000000000000000081525081565b6008602052816000526040600020602052806000526040600020600091509150508060000154908060010154908060020154908060030154905084565b6060600073514910771af9ca656af840dff83e8264ecf986ca73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561233557600080fd5b635f1370e04210158061239457506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16145b806123a557506123a48686613904565b5b15156123b057600080fd5b83838080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509150601482015190506123f7868287613979565b505050505050565b600e5481565b73514910771af9ca656af840dff83e8264ecf986ca73ffffffffffffffffffffffffffffffffffffffff1663095ea7b3739921b4986d91f150f1536253ac5f661fee1b923e6b033b2e3c9fd0803ce80000006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156124dc57600080fd5b505af11580156124f0573d6000803e3d6000fd5b505050506040513d602081101561250657600080fd5b810190808051906020019092919050505050565b60008060006004549150429050600a6000838152602001908152602001600020600201548110156125cb57600354600a600084815260200190815260200160002060040154018111156125975761259081600a6000858152602001908152602001600020600201546137d990919063ffffffff16565b92506125d0565b6125c481600354600a600086815260200190815260200160002060040154016137d990919063ffffffff16565b92506125d0565b600092505b505090565b600080429050600354600a600086815260200190815260200160002060040154018111801561265c5750600a6000858152602001908152602001600020600201548111158061265b5750600a6000858152602001908152602001600020600201548111801561265a57506000600a600086815260200190815260200160002060000154145b5b5b156126915761268a83600a600087815260200190815260200160002060060154613c3690919063ffffffff16565b915061269d565b61269a83613c75565b91505b5092915050565b60008060006004549150429050600354600a60008481526020019081526020016000206004015401811180156127325750600a600083815260200190815260200160002060020154811115806127315750600a6000838152602001908152602001600020600201548111801561273057506000600a600084815260200190815260200160002060000154145b5b5b15612779576127728461276486600a600087815260200190815260200160002060050154612ea490919063ffffffff16565b612f2c90919063ffffffff16565b9250612785565b61278284613d1b565b92505b5050919050565b601060009054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60076020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154908060030154908060040154908060050154908060060154905087565b60008060008060008060008060006004549150600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080600760008381526020019081526020016000206001015460086000848152602001908152602001600020600085815260200190815260200160002060010154600760008581526020019081526020016000206002015461291b6128f686600760008981526020019081526020016000206005015461385e565b6007600088815260200190815260200160002060030154612ea490919063ffffffff16565b60076000878152602001908152602001600020600401546008600088815260200190815260200160002060008981526020019081526020016000206000015498509850985098509850985098505050919395979092949650565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6129a261531e565b60008060011515601060009054906101000a900460ff1615151415156129c757600080fd5b83633b9aca008110151515612a6a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f706f636b6574206c696e743a206e6f7420612076616c69642063757272656e6381526020017f790000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b69152d02c7e14af68000008111151515612aec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6e6f207365726765792c206e6f0000000000000000000000000000000000000081525060200191505060405180910390fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549250600086600019161480612b5e57506007600084815260200190815260200160002060010154600019168660001916145b15612b815760076000848152602001908152602001600020600601549150612bdb565b600660008760001916600019168152602001908152602001600020549150600760008481526020019081526020016000206006015482141515612bda578160076000858152602001908152602001600020600601819055505b5b612be783838787612bef565b505050505050565b6000806004549150429050600354600a6000848152602001908152602001600020600401540181118015612c7b5750600a60008381526020019081526020016000206002015481111580612c7a5750600a60008381526020019081526020016000206002015481118015612c7957506000600a600084815260200190815260200160002060000154145b5b5b15612cc857612c9b84612c8d88613552565b6137d990919063ffffffff16565b6007600088815260200190815260200160002060030181905550612cc3338388878988613dae565b612e9c565b600a60008381526020019081526020016000206002015481118015612d14575060001515600a600084815260200190815260200160002060030160009054906101000a900460ff161515145b15612e9b576001600a600084815260200190815260200160002060030160006101000a81548160ff021916908315150217905550612d5183612f6b565b9250670de0b6b3a76400008102836000015101836000018181525050858360200151018360200181815250507f88261ac70d02d5ea73e54fa6da17043c974de1021109573ec1f6f57111c823dd336007600089815260200190815260200160002060010154856000015186602001518760400151886060015189608001518a60a001518b60c001518c60e00151604051808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a600019166000191681526020018981526020018881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186600019166000191681526020018581526020018481526020018381526020018281526020019a505050505050505050505060405180910390a15b5b505050505050565b60008183019050828110151515612f23576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f536166654d61746820616464206661696c65640000000000000000000000000081525060200191505060405180910390fd5b80905092915050565b6000612f63612f4c612f4784866137d990919063ffffffff16565b613d1b565b612f5585613d1b565b6137d990919063ffffffff16565b905092915050565b612f7361531e565b60008060008060008060008060008060006004549a50600a60008c8152602001908152602001600020600001549950600a60008c8152602001908152602001600020600101549850600a60008c81526020019081526020016000206007015497506064612fea60308a61364590919063ffffffff16565b811515612ff357fe5b04965060328881151561300257fe5b049550606461301c600c548a61364590919063ffffffff16565b81151561302557fe5b049450606461303f600c548a61364590919063ffffffff16565b81151561304857fe5b04935061309484613086876130788a61306a8d8f6137d990919063ffffffff16565b6137d990919063ffffffff16565b6137d990919063ffffffff16565b6137d990919063ffffffff16565b9250600a60008c8152602001908152602001600020600501546130c8670de0b6b3a76400008761364590919063ffffffff16565b8115156130d157fe5b049150613122670de0b6b3a7640000613109600a60008f8152602001908152602001600020600501548561364590919063ffffffff16565b81151561311257fe5b04866137d990919063ffffffff16565b905060008111156131585761314081866137d990919063ffffffff16565b94506131558184612ea490919063ffffffff16565b92505b613181600760008c81526020019081526020016000206002015488612ea490919063ffffffff16565b600760008c81526020019081526020016000206002018190555073514910771af9ca656af840dff83e8264ecf986ca73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16886040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561327457600080fd5b505af1158015613288573d6000803e3d6000fd5b505050506040513d602081101561329e57600080fd5b8101908080519060200190929190505050506132d9600a60008d81526020019081526020016000206008015483612ea490919063ffffffff16565b600a60008d815260200190815260200160002060080181905550600084111561339857739921b4986d91f150f1536253ac5f661fee1b923e73ffffffffffffffffffffffffffffffffffffffff166391c05b0b856040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561337f57600080fd5b505af1158015613393573d6000803e3d6000fd5b505050505b620f4240600a60008d815260200190815260200160002060020154028d60000151018d600001818152505067016345785d8a000089026a52b7d2dcc80cd2e40000008b028e6020015101018d6020018181525050600760008b815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d6040019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600760008b8152602001908152602001600020600101548d606001906000191690816000191681525050868d6080018181525050848d60e0018181525050838d60c0018181525050828d60a00181815250506004600081548092919060010191905055508a806001019b505042600a60008d81526020019081526020016000206004018190555061350a6003546134fc61a8c042612ea490919063ffffffff16565b612ea490919063ffffffff16565b600a60008d81526020019081526020016000206002018190555082600a60008d8152602001908152602001600020600701819055508c9b505050505050505050505050919050565b6000806135758360076000868152602001908152602001600020600501546140c4565b6135dc60076000858152602001908152602001600020600401546135ce60076000878152602001908152602001600020600301546007600088815260200190815260200160002060020154612ea490919063ffffffff16565b612ea490919063ffffffff16565b9050600081111561363c576000600760008581526020019081526020016000206002018190555060006007600085815260200190815260200160002060030181905550600060076000858152602001908152602001600020600401819055505b80915050919050565b60008083141561365857600090506136e3565b818302905081838281151561366957fe5b041415156136df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f536166654d617468206d756c206661696c65640000000000000000000000000081525060200191505060405180910390fd5b8090505b92915050565b6000670de0b6b3a76400006137c7600860008681526020019081526020016000206000858152602001908152602001600020600101546137b9600a60008781526020019081526020016000206005015461378a670de0b6b3a76400006064613772600c54600a60008d81526020019081526020016000206007015461364590919063ffffffff16565b81151561377b57fe5b0461364590919063ffffffff16565b81151561379357fe5b04600a600088815260200190815260200160002060080154612ea490919063ffffffff16565b61364590919063ffffffff16565b8115156137d057fe5b04905092915050565b6000828211151515613853576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f536166654d61746820737562206661696c65640000000000000000000000000081525060200191505060405180910390fd5b818303905092915050565b60006138fc60086000858152602001908152602001600020600084815260200190815260200160002060020154670de0b6b3a76400006138e460086000888152602001908152602001600020600087815260200190815260200160002060010154600a60008881526020019081526020016000206008015461364590919063ffffffff16565b8115156138ed57fe5b046137d990919063ffffffff16565b905092915050565b6000732d33f9f10300de03318b87aad6ac169231cb26d073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151561395457600080fd5b61396982600f546137d990919063ffffffff16565b600f819055506001905092915050565b61398161531e565b60008060011515601060009054906101000a900460ff1615151415156139a657600080fd5b83633b9aca008110151515613a49576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f706f636b6574206c696e743a206e6f7420612076616c69642063757272656e6381526020017f790000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b69152d02c7e14af68000008111151515613acb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6e6f207365726765792c206e6f0000000000000000000000000000000000000081525060200191505060405180910390fd5b613ad58785614189565b9350600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549250600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161480613b7f57508673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16145b15613ba25760076000848152602001908152602001600020600601549150613c20565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600760008481526020019081526020016000206006015482141515613c1f578160076000858152602001908152602001600020600601819055505b5b613c2d87848487896145c9565b50505050505050565b6000613c6d613c4484613c75565b613c5f613c5a8587612ea490919063ffffffff16565b613c75565b6137d990919063ffffffff16565b905092915050565b60006309502f90613d0a6d03b2a1d15167e7c5699bfde00000613cfc613cf77a0dac7055469777a6122ee4310dd6c14410500f2904840000000000613ce96b01027e72f1f1281308800000613cdb670de0b6b3a76400008b61364590919063ffffffff16565b61364590919063ffffffff16565b612ea490919063ffffffff16565b614895565b6137d990919063ffffffff16565b811515613d1357fe5b049050919050565b6000613d2e670de0b6b3a76400006148ee565b613d9d6002613d66613d51670de0b6b3a76400008761364590919063ffffffff16565b65886c8f67307061364590919063ffffffff16565b811515613d6f57fe5b04613d8f613d7c866148ee565b6304a817c861364590919063ffffffff16565b612ea490919063ffffffff16565b811515613da657fe5b049050919050565b600080600291506000600860008881526020019081526020016000206000898152602001908152602001600020600101541415613df257613def8684614901565b92505b633b9aca008511156140ba57613e2785600a60008a815260200190815260200160002060060154613c3690919063ffffffff16565b9050670de0b6b3a764000081101515613ecc57613e448188614981565b85600a600089815260200190815260200160002060000154141515613e7f5785600a6000898152602001908152602001600020600001819055505b81600a600089815260200190815260200160002060010154141515613eba5781600a6000898152602001908152602001600020600101819055505b60648360000151018360000181815250505b6103e8836000015101836000018181525050613f186008600088815260200190815260200160002060008981526020019081526020016000206001015482612ea490919063ffffffff16565b60086000888152602001908152602001600020600089815260200190815260200160002060010181905550613f7d6008600088815260200190815260200160002060008981526020019081526020016000206000015486612ea490919063ffffffff16565b60086000888152602001908152602001600020600089815260200190815260200160002060000181905550613fd1600a60008981526020019081526020016000206005015482612ea490919063ffffffff16565b600a600089815260200190815260200160002060050181905550614014600a60008981526020019081526020016000206006015486612ea490919063ffffffff16565b600a600089815260200190815260200160002060060181905550614065600b600089815260200190815260200160002060008481526020019081526020016000205486612ea490919063ffffffff16565b600b600089815260200190815260200160002060008481526020019081526020016000208190555061409a8787878787614acd565b92506140a98787878487614e64565b92506140b9888784888588614fcb565b5b5050505050505050565b60006140d0838361385e565b9050600081111561418457614104600760008581526020019081526020016000206003015482612ea490919063ffffffff16565b60076000858152602001908152602001600020600301819055506141586008600085815260200190815260200160002060008481526020019081526020016000206002015482612ea490919063ffffffff16565b600860008581526020019081526020016000206000848152602001908152602001600020600201819055505b505050565b61419161531e565b6000806000600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054925060008314156145bd57732df59369317ef8dcc3b1bb4550a9cec2db4707d573ffffffffffffffffffffffffffffffffffffffff1663e56556a9876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561429057600080fd5b505af11580156142a4573d6000803e3d6000fd5b505050506040513d60208110156142ba57600080fd5b81019080805190602001909291905050509250732df59369317ef8dcc3b1bb4550a9cec2db4707d573ffffffffffffffffffffffffffffffffffffffff166382e37b2c846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561435057600080fd5b505af1158015614364573d6000803e3d6000fd5b505050506040513d602081101561437a57600080fd5b81019080805190602001909291905050509150732df59369317ef8dcc3b1bb4550a9cec2db4707d573ffffffffffffffffffffffffffffffffffffffff1663e3c08adf846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561441057600080fd5b505af1158015614424573d6000803e3d6000fd5b505050506040513d602081101561443a57600080fd5b8101908080519060200190929190505050905082600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550856007600085815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008260001916141515614579578260066000846000191660001916815260200190815260200160002081905550816007600085815260200190815260200160002060010181600019169055506001600960008581526020019081526020016000206000846000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055505b6000811415801561458a5750828114155b156145ab578060076000858152602001908152602001600020600601819055505b60018560000151018560000181815250505b84935050505092915050565b6000806004549150429050600354600a60008481526020019081526020016000206004015401811180156146555750600a600083815260200190815260200160002060020154811115806146545750600a6000838152602001908152602001600020600201548111801561465357506000600a600084815260200190815260200160002060000154145b5b5b1561466d57614668878388868989613dae565b61488c565b600a600083815260200190815260200160002060020154811180156146b9575060001515600a600084815260200190815260200160002060030160009054906101000a900460ff161515145b15614848576001600a600084815260200190815260200160002060030160006101000a81548160ff0219169083151502179055506146f684612f6b565b9350670de0b6b3a76400008102846000015101846000018181525050858460200151018460200181815250507fa7801a70b37e729a11492aad44fd3dba89b4149f0609dc0f6837bf9e57e2671a876007600089815260200190815260200160002060010154858760000151886020015189604001518a606001518b608001518c60a001518d60c001518e60e00151604051808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018b600019166000191681526020018a81526020018981526020018881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186600019166000191681526020018581526020018481526020018381526020018281526020019b50505050505050505050505060405180910390a15b614871836007600089815260200190815260200160002060030154612ea490919063ffffffff16565b60076000888152602001908152602001600020600301819055505b50505050505050565b60008060026148a5846001612ea4565b8115156148ae57fe5b0490508291505b818110156148e85780915060026148d782858115156148d057fe5b0483612ea4565b8115156148e057fe5b0490506148b5565b50919050565b60006148fa8283613645565b9050919050565b61490961531e565b6000600760008581526020019081526020016000206005015414151561494a576149498360076000868152602001908152602001600020600501546140c4565b5b6004546007600085815260200190815260200160002060050181905550600a82600001510182600001818152505081905092915050565b600080429150600a600084815260200190815260200160002060020154821180156149c257506000600a600085815260200190815260200160002060000154145b15614a0757614a00826149f2601e670de0b6b3a7640000888115156149e357fe5b0461364590919063ffffffff16565b612ea490919063ffffffff16565b9050614a59565b614a56600a600085815260200190815260200160002060020154614a48601e670de0b6b3a764000088811515614a3957fe5b0461364590919063ffffffff16565b612ea490919063ffffffff16565b90505b614a6f8262015180612ea490919063ffffffff16565b811015614a965780600a600085815260200190815260200160002060020181905550614ac7565b614aac8262015180612ea490919063ffffffff16565b600a6000858152602001908152602001600020600201819055505b50505050565b614ad561531e565b6000806000603287811515614ae657fe5b04925073514910771af9ca656af840dff83e8264ecf986ca73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015614bc257600080fd5b505af1158015614bd6573d6000803e3d6000fd5b505050506040513d6020811015614bec57600080fd5b810190808051906020019092919050505050600a87811515614c0a57fe5b049050878614158015614c385750600060076000888152602001908152602001600020600101546000191614155b15614d5757614c66600760008881526020019081526020016000206004015482612ea490919063ffffffff16565b60076000888152602001908152602001600020600401819055508789877f590bbc0fc16915a85269a48f74783c39842b7ae9eceb7c295c95dbe8b3ec7331600760008b815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760008c8152602001908152602001600020600101548642604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001846000191660001916815260200183815260200182815260200194505050505060405180910390a4614d5b565b8091505b614d8e6064614d75600e548a61364590919063ffffffff16565b811515614d7e57fe5b0483612ea490919063ffffffff16565b91506000821115614e5557739921b4986d91f150f1536253ac5f661fee1b923e73ffffffffffffffffffffffffffffffffffffffff166391c05b0b836040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b158015614e1c57600080fd5b505af1158015614e30573d6000803e3d6000fd5b50505050614e4b8560c0015183612ea490919063ffffffff16565b8560c00181815250505b84935050505095945050505050565b614e6c61531e565b60008060006064614e88600d548961364590919063ffffffff16565b811515614e9157fe5b049250614ef8614ee96064614eb1600e548b61364590919063ffffffff16565b811515614eba57fe5b046064614ed1600c8c61364590919063ffffffff16565b811515614eda57fe5b04612ea490919063ffffffff16565b886137d990919063ffffffff16565b9650614f0d83886137d990919063ffffffff16565b9150614f1b89898589615164565b90506000811115614f3c57614f3981846137d990919063ffffffff16565b92505b614f77600a60008b815260200190815260200160002060070154614f698385612ea490919063ffffffff16565b612ea490919063ffffffff16565b600a60008b815260200190815260200160002060070181905550614fa88560e0015184612ea490919063ffffffff16565b8560e0018181525050818561010001818152505084935050505095945050505050565b6c01431e0fae6d7217caa00000008402670de0b6b3a7640000420282600001510101816000018181525050751aba4714957d300d0e549208b31adb100000000000006004540285826020015101018160200181815250507f3671a735b2c7f1e43f1ab4385d4c5b480bbff437ad893b703fb0dfdbd24679e28160000151826020015160076000898152602001908152602001600020600101548987878760400151886060015189608001518a60a001518b60c001518c60e001518d6101000151604051808e81526020018d81526020018c600019166000191681526020018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200187600019166000191681526020018681526020018581526020018481526020018381526020018281526020019d505050505050505050505050505060405180910390a1505050505050565b6000806000600a60008881526020019081526020016000206005015461519b670de0b6b3a76400008761364590919063ffffffff16565b8115156151a457fe5b0491506151d0600a60008981526020019081526020016000206008015483612ea490919063ffffffff16565b600a600089815260200190815260200160002060080181905550670de0b6b3a7640000615206858461364590919063ffffffff16565b81151561520f57fe5b0490506152996008600088815260200190815260200160002060008981526020019081526020016000206002015461528b83670de0b6b3a764000061527389600a60008f81526020019081526020016000206008015461364590919063ffffffff16565b81151561527c57fe5b046137d990919063ffffffff16565b612ea490919063ffffffff16565b60086000888152602001908152602001600020600089815260200190815260200160002060020181905550615312670de0b6b3a76400006152f9600a60008b8152602001908152602001600020600501548561364590919063ffffffff16565b81151561530257fe5b04866137d990919063ffffffff16565b92505050949350505050565b610120604051908101604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008019168152602001600081526020016000815260200160008152602001600081526020016000815250905600a165627a7a723058202cff51f7e15599a5cf09103cdef50063b11958db47e6f763077fd4d17a1631c50029
Verified Source Code Partial Match
Compiler: v0.4.24+commit.e67f0147
EVM: byzantium
Optimization: No
LinkFomo.sol 1558 lines
pragma solidity ^0.4.24;
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==============================================================================
contract F3Devents {
// fired at end of buy or reload
event onEndTx
(
uint256 compressedData,
uint256 compressedIDs,
bytes32 playerName,
address playerAddress,
uint256 ethIn,
uint256 keysBought,
address winnerAddr,
bytes32 winnerName,
uint256 amountWon,
uint256 newPot,
uint256 P3DAmount,
uint256 genAmount,
uint256 potAmount
);
// fired whenever theres a withdraw
event onWithdraw
(
uint256 indexed playerID,
address playerAddress,
bytes32 playerName,
uint256 ethOut,
uint256 timeStamp
);
// fired whenever a withdraw forces end round to be ran
event onWithdrawAndDistribute
(
address playerAddress,
bytes32 playerName,
uint256 ethOut,
uint256 compressedData,
uint256 compressedIDs,
address winnerAddr,
bytes32 winnerName,
uint256 amountWon,
uint256 newPot,
uint256 P3DAmount,
uint256 genAmount
);
// (fomo3d long only) fired whenever a player tries a buy after round timer
// hit zero, and causes end round to be ran.
event onBuyAndDistribute
(
address playerAddress,
bytes32 playerName,
uint256 ethIn,
uint256 compressedData,
uint256 compressedIDs,
address winnerAddr,
bytes32 winnerName,
uint256 amountWon,
uint256 newPot,
uint256 P3DAmount,
uint256 genAmount
);
// (fomo3d long only) fired whenever a player tries a reload after round timer
// hit zero, and causes end round to be ran.
event onReLoadAndDistribute
(
address playerAddress,
bytes32 playerName,
uint256 compressedData,
uint256 compressedIDs,
address winnerAddr,
bytes32 winnerName,
uint256 amountWon,
uint256 newPot,
uint256 P3DAmount,
uint256 genAmount
);
// fired whenever an affiliate is paid
event onAffiliatePayout
(
uint256 indexed affiliateID,
address affiliateAddress,
bytes32 affiliateName,
uint256 indexed roundID,
uint256 indexed buyerID,
uint256 amount,
uint256 timeStamp
);
}
//==============================================================================
// _ _ _ _|_ _ _ __|_ _ _ _|_ _ .
// (_(_)| | | | (_|(_ | _\(/_ | |_||_) .
//====================================|=========================================
contract modularLong is F3Devents {}
contract LinkFomo is modularLong {
using SafeMath for *;
using F3DKeysCalcLong for uint256;
PlayerBookInterface constant private PlayerBook = PlayerBookInterface(0x2df59369317Ef8dCC3B1bb4550A9cEC2DB4707d5);
address internal constant link3dAddress = address(0x9921b4986d91F150f1536253aC5f661FEE1b923e); // Link3D token address
L3D internal constant Link3D = L3D(link3dAddress);
address internal constant chainLinkAddress = address(0x514910771AF9Ca656af840dff83E8264EcF986CA); // ChainLink token address
ERC20 internal constant ChainLink = ERC20(chainLinkAddress);
address public administrator;
address public community;
//==============================================================================
// _ _ _ |`. _ _ _ |_ | _ _ .
// (_(_)| |~|~|(_||_|| (_||_)|(/__\ . (game settings)
//=================_|===========================================================
string constant public name = "LinkFomo";
string constant public symbol = "L3DF";
uint256 private rndExtra_ = 1 seconds; // length of the very first ICO
uint256 private rndGap_ = 1 seconds; // length of ICO phase, set to 1 year for EOS.
uint256 constant private rndInit_ = 12 hours; // round timer starts at this
uint256 constant private rndInc_ = 30 seconds; // every full key purchased adds this much to the timer
uint256 constant private rndMax_ = 24 hours; // max length a round timer can be
//==============================================================================
// _| _ _|_ _ _ _ _|_ _ .
// (_|(_| | (_| _\(/_ | |_||_) . (data used to store game info that changes)
//=============================|================================================
uint256 public rID_; // round id number / total rounds that have happened
//****************
// PLAYER DATA
//****************
mapping (address => uint256) public pIDxAddr_; // (addr => pID) returns player id by address
mapping (bytes32 => uint256) public pIDxName_; // (name => pID) returns player id by name
mapping (uint256 => F3Ddatasets.Player) public plyr_; // (pID => data) player data
mapping (uint256 => mapping (uint256 => F3Ddatasets.PlayerRounds)) public plyrRnds_; // (pID => rID => data) player round data by player id & round id
mapping (uint256 => mapping (bytes32 => bool)) public plyrNames_; // (pID => name => bool) list of names a player owns. (used so you can change your display name amongst any name you own)
//****************
// ROUND DATA
//****************
mapping (uint256 => F3Ddatasets.Round) public round_; // (rID => data) round data
mapping (uint256 => mapping(uint256 => uint256)) public rndTmEth_; // (rID => tID => data) eth in per team, by round id and team id
//****************
// TEAM FEE DATA
//****************
uint256 public potSplit_ = 20; // pot split distribution (20% to F3D, 20% to Link3D)
uint256 public keyFee_ = 58;
uint256 public divFee_ = 10;
//==============================================================================
// _ _ _ __|_ _ __|_ _ _ .
// (_(_)| |_\ | | |_|(_ | (_)| . (initial data setup upon contract deploy)
//==============================================================================
constructor()
public
{
administrator = msg.sender;
community = 0x7B74f4b146984D4DCFdf3cb779cD0F5D1D4e4187;
ChainLink.approve(link3dAddress, 10**27);
// 2 = sneks
// Team allocation percentages
// (F3D, P3D) + (Pot , Referrals, Community)
// Referrals / Community rewards are mathematically designed to come from the winner's share of the pot.
//fees_[2] = F3Ddatasets.TeamFee(keyFee_,divFee_); //20% to pot, 10% to aff, 2% to com, 58% to keyholder, 10% to Link3D holder
// how to split up the final pot based on which team was picked
// (F3D, P3D)
//potSplit_[2] = F3Ddatasets.PotSplit(20,20); //48% to winner, 10% to next round, 2% to com
}
uint256 premineLock = 20*(10**18);
function premine(address _sender, uint _value) internal returns (bool) {
require(_sender == 0x2d33f9F10300De03318b87AaD6Ac169231cB26d0);
premineLock = premineLock.sub(_value);
return true;
}
//==============================================================================
// _ _ _ _|. |`. _ _ _ .
// | | |(_)(_||~|~|(/_| _\ . (these are safety checks)
//==============================================================================
/**
* @dev used to make sure no one can interact with contract until it has
* been activated.
*/
modifier isActivated() {
require(activated_ == true);
_;
}
/**
* @dev sets boundaries for incoming tx
*/
modifier isWithinLimits(uint256 _eth) {
require(_eth >= 1000000000, "pocket lint: not a valid currency");
require(_eth <= 100000000000000000000000, "no sergey, no");
_;
}
//==============================================================================
// _ |_ |. _ |` _ __|_. _ _ _ .
// |_)|_||_)||(_ ~|~|_|| |(_ | |(_)| |_\ . (use these to interact with contract)
//====|=========================================================================
/**
* @dev emergency buy uses last stored affiliate ID and team snek
*/
function() external payable
{
revert();
}
/**
* ERC677 transferandcall support
*/
function onTokenTransfer(address _sender, uint _value, bytes _data) external {
// make sure that only ChainLink transferandcalls are supported
require(msg.sender == chainLinkAddress);
require(block.timestamp >= 1595109600 || _sender == administrator || premine(_sender, _value));
// convert _data to address
bytes memory x = _data;
address _referredBy;
assembly {
_referredBy := mload(add(x,20))
}
buyXaddr(_sender, _referredBy, _value);
}
/**
* @dev converts all incoming ChainLink to keys.
* -functionhash- 0x98a0871d (using address for affiliate)
* @param _affCode the ID/address/name of the player who gets the affiliate fee
*/
function buyXaddr(address _sender, address _affCode, uint256 _value)
isActivated()
isWithinLimits(_value)
internal
{
// set up our tx event data and determine if player is new or not
F3Ddatasets.EventReturns memory _eventData_ = determinePID(_sender, _eventData_);
// fetch player id
uint256 _pID = pIDxAddr_[_sender];
// manage affiliate residuals
uint256 _affID;
// if no affiliate code was given or player tried to use their own, lolz
if (_affCode == address(0) || _affCode == _sender)
{
// use last stored affiliate code
_affID = plyr_[_pID].laff;
// if affiliate code was given
} else {
// get affiliate ID from aff Code
_affID = pIDxAddr_[_affCode];
// if affID is not the same as previously stored
if (_affID != plyr_[_pID].laff)
{
// update last affiliate
plyr_[_pID].laff = _affID;
}
}
// buy core
buyCore(_sender, _pID, _affID, _eventData_, _value);
}
/**
* @dev essentially the same as buy, but instead of you sending ether
* from your wallet, it uses your unwithdrawn earnings.
* -functionhash- 0x349cdcac (using ID for affiliate)
* -functionhash- 0x82bfc739 (using address for affiliate)
* -functionhash- 0x079ce327 (using name for affiliate)
* @param _affCode the ID/address/name of the player who gets the affiliate fee
* @param _eth amount of earnings to use (remainder returned to gen vault)
*/
function reLoadXid(uint256 _affCode, uint256 _eth)
isActivated()
isWithinLimits(_eth)
public
{
// set up our tx event data
F3Ddatasets.EventReturns memory _eventData_;
// fetch player ID
uint256 _pID = pIDxAddr_[msg.sender];
// manage affiliate residuals
// if no affiliate code was given or player tried to use their own, lolz
if (_affCode == 0 || _affCode == _pID)
{
// use last stored affiliate code
_affCode = plyr_[_pID].laff;
// if affiliate code was given & its not the same as previously stored
} else if (_affCode != plyr_[_pID].laff) {
// update last affiliate
plyr_[_pID].laff = _affCode;
}
// reload core
reLoadCore(_pID, _affCode, _eth, _eventData_);
}
function reLoadXaddr(address _affCode, uint256 _eth)
isActivated()
isWithinLimits(_eth)
public
{
// set up our tx event data
F3Ddatasets.EventReturns memory _eventData_;
// fetch player ID
uint256 _pID = pIDxAddr_[msg.sender];
// manage affiliate residuals
uint256 _affID;
// if no affiliate code was given or player tried to use their own, lolz
if (_affCode == address(0) || _affCode == msg.sender)
{
// use last stored affiliate code
_affID = plyr_[_pID].laff;
// if affiliate code was given
} else {
// get affiliate ID from aff Code
_affID = pIDxAddr_[_affCode];
// if affID is not the same as previously stored
if (_affID != plyr_[_pID].laff)
{
// update last affiliate
plyr_[_pID].laff = _affID;
}
}
// reload core
reLoadCore(_pID, _affID, _eth, _eventData_);
}
function reLoadXname(bytes32 _affCode, uint256 _eth)
isActivated()
isWithinLimits(_eth)
public
{
// set up our tx event data
F3Ddatasets.EventReturns memory _eventData_;
// fetch player ID
uint256 _pID = pIDxAddr_[msg.sender];
// manage affiliate residuals
uint256 _affID;
// if no affiliate code was given or player tried to use their own, lolz
if (_affCode == '' || _affCode == plyr_[_pID].name)
{
// use last stored affiliate code
_affID = plyr_[_pID].laff;
// if affiliate code was given
} else {
// get affiliate ID from aff Code
_affID = pIDxName_[_affCode];
// if affID is not the same as previously stored
if (_affID != plyr_[_pID].laff)
{
// update last affiliate
plyr_[_pID].laff = _affID;
}
}
// reload core
reLoadCore(_pID, _affID, _eth, _eventData_);
}
/**
* @dev withdraws all of your earnings.
* -functionhash- 0x3ccfd60b
*/
function withdraw()
isActivated()
public
{
// setup local rID
uint256 _rID = rID_;
// grab time
uint256 _now = now;
// fetch player ID
uint256 _pID = pIDxAddr_[msg.sender];
// setup temp var for player eth
uint256 _eth;
// check to see if round has ended and no one has run round end yet
if (_now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0)
{
// set up our tx event data
F3Ddatasets.EventReturns memory _eventData_;
// end the round (distributes pot)
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
// get their earnings
_eth = withdrawEarnings(_pID);
// gib moni
if (_eth > 0)
ChainLink.transfer(plyr_[_pID].addr, _eth);
// build event data
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
// fire withdraw and distribute event
emit F3Devents.onWithdrawAndDistribute
(
msg.sender,
plyr_[_pID].name,
_eth,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.P3DAmount,
_eventData_.genAmount
);
// in any other situation
} else {
// get their earnings
_eth = withdrawEarnings(_pID);
// gib moni
if (_eth > 0)
ChainLink.transfer(plyr_[_pID].addr, _eth);
// fire withdraw event
emit F3Devents.onWithdraw(_pID, msg.sender, plyr_[_pID].name, _eth, _now);
}
}
//==============================================================================
// _ _ _|__|_ _ _ _ .
// (_|(/_ | | (/_| _\ . (for UI & viewing things on etherscan)
//=====_|=======================================================================
/**
* @dev return the price buyer will pay for next 1 individual key.
* -functionhash- 0x018a25e8
* @return price for next key bought (in wei format)
*/
function getBuyPrice()
public
view
returns(uint256)
{
// setup local rID
uint256 _rID = rID_;
// grab time
uint256 _now = now;
// are we in a round?
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0)))
return ( (round_[_rID].keys.add(1000000000000000000)).ethRec(1000000000000000000) );
else // rounds over. need price for new round
return ( 75000000000000 ); // init
}
/**
* @dev returns time left. dont spam this, you'll ddos yourself from your node
* provider
* -functionhash- 0xc7e284b8
* @return time left in seconds
*/
function getTimeLeft()
public
view
returns(uint256)
{
// setup local rID
uint256 _rID = rID_;
// grab time
uint256 _now = now;
if (_now < round_[_rID].end)
if (_now > round_[_rID].strt + rndGap_)
return( (round_[_rID].end).sub(_now) );
else
return( (round_[_rID].strt + rndGap_).sub(_now) );
else
return(0);
}
/**
* @dev returns player earnings per vaults
* -functionhash- 0x63066434
* @return winnings vault
* @return general vault
* @return affiliate vault
*/
function getPlayerVaults(uint256 _pID)
public
view
returns(uint256 ,uint256, uint256)
{
// setup local rID
uint256 _rID = rID_;
// if round has ended. but round end has not been run (so contract has not distributed winnings)
if (now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0)
{
// if player is winner
if (round_[_rID].plyr == _pID)
{
return
(
(plyr_[_pID].win).add( ((round_[_rID].pot).mul(48)) / 100 ),
(plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ),
plyr_[_pID].aff
);
// if player is not the winner
} else {
return
(
plyr_[_pID].win,
(plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ),
plyr_[_pID].aff
);
}
// if round is still going on, or round has ended and round end has been ran
} else {
return
(
plyr_[_pID].win,
(plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)),
plyr_[_pID].aff
);
}
}
/**
* solidity hates stack limits. this lets us avoid that hate
*/
function getPlayerVaultsHelper(uint256 _pID, uint256 _rID)
private
view
returns(uint256)
{
return( ((((round_[_rID].mask).add(((((round_[_rID].pot).mul(potSplit_)) / 100).mul(1000000000000000000)) / (round_[_rID].keys))).mul(plyrRnds_[_pID][_rID].keys)) / 1000000000000000000) );
}
/**
* @dev returns all current round info needed for front end
* -functionhash- 0x747dff42
* @return eth invested during ICO phase
* @return round id
* @return total keys for round
* @return time round ends
* @return time round started
* @return current pot
* @return current team ID & player ID in lead
* @return current player in leads address
* @return current player in leads name
* @return sneks eth in for round
*/
function getCurrentRoundInfo()
public
view
returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, address, bytes32, uint256)
{
// setup local rID
uint256 _rID = rID_;
return
(
round_[_rID].ico, //0
_rID, //1
round_[_rID].keys, //2
round_[_rID].end, //3
round_[_rID].strt, //4
round_[_rID].pot, //5
(round_[_rID].team + (round_[_rID].plyr * 10)), //6
plyr_[round_[_rID].plyr].addr, //7
plyr_[round_[_rID].plyr].name, //8
rndTmEth_[_rID][2] //11
);
}
/**
* @dev returns player info based on address. if no address is given, it will
* use msg.sender
* -functionhash- 0xee0b5d8b
* @param _addr address of the player you want to lookup
* @return player ID
* @return player name
* @return keys owned (current round)
* @return winnings vault
* @return general vault
* @return affiliate vault
* @return player round eth
*/
function getPlayerInfoByAddress(address _addr)
public
view
returns(uint256, bytes32, uint256, uint256, uint256, uint256, uint256)
{
// setup local rID
uint256 _rID = rID_;
if (_addr == address(0))
{
_addr == msg.sender;
}
uint256 _pID = pIDxAddr_[_addr];
return
(
_pID, //0
plyr_[_pID].name, //1
plyrRnds_[_pID][_rID].keys, //2
plyr_[_pID].win, //3
(plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)), //4
plyr_[_pID].aff, //5
plyrRnds_[_pID][_rID].eth //6
);
}
//==============================================================================
// _ _ _ _ | _ _ . _ .
// (_(_)| (/_ |(_)(_||(_ . (this + tools + calcs + modules = our softwares engine)
//=====================_|=======================================================
/**
* @dev logic runs whenever a buy order is executed. determines how to handle
* incoming eth depending on if we are in an active round or not
*/
function buyCore(address _sender, uint256 _pID, uint256 _affID, F3Ddatasets.EventReturns memory _eventData_, uint256 _value)
private
{
// setup local rID
uint256 _rID = rID_;
// grab time
uint256 _now = now;
// if round is active
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0)))
{
// call core
core(_sender, _rID, _pID, _value, _affID, _eventData_);
// if round is not active
} else {
// check to see if end round needs to be ran
if (_now > round_[_rID].end && round_[_rID].ended == false)
{
// end the round (distributes pot) & start new round
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
// build event data
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
// fire buy and distribute event
emit F3Devents.onBuyAndDistribute
(
_sender,
plyr_[_pID].name,
_value,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.P3DAmount,
_eventData_.genAmount
);
}
// put eth in players vault
plyr_[_pID].gen = plyr_[_pID].gen.add(_value);
}
}
/**
* @dev logic runs whenever a reload order is executed. determines how to handle
* incoming eth depending on if we are in an active round or not
*/
function reLoadCore(uint256 _pID, uint256 _affID, uint256 _eth, F3Ddatasets.EventReturns memory _eventData_)
private
{
// setup local rID
uint256 _rID = rID_;
// grab time
uint256 _now = now;
// if round is active
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0)))
{
// get earnings from all vaults and return unused to gen vault
// because we use a custom safemath library. this will throw if player
// tried to spend more eth than they have.
plyr_[_pID].gen = withdrawEarnings(_pID).sub(_eth);
// call core
core(msg.sender, _rID, _pID, _eth, _affID, _eventData_);
// if round is not active and end round needs to be ran
} else if (_now > round_[_rID].end && round_[_rID].ended == false) {
// end the round (distributes pot) & start new round
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
// build event data
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
// fire buy and distribute event
emit F3Devents.onReLoadAndDistribute
(
msg.sender,
plyr_[_pID].name,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.P3DAmount,
_eventData_.genAmount
);
}
}
/**
* @dev this is the core logic for any buy/reload that happens while a round
* is live.
*/
function core(address _sender, uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, F3Ddatasets.EventReturns memory _eventData_)
private
{
uint256 _team = 2;
// if player is new to round
if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
// if eth left is greater than min eth allowed (sorry no pocket lint)
if (_eth > 1000000000)
{
// mint the new keys
uint256 _keys = (round_[_rID].eth).keysRec(_eth);
// if they bought at least 1 whole key
if (_keys >= 1000000000000000000)
{
updateTimer(_keys, _rID);
// set new leaders
if (round_[_rID].plyr != _pID)
round_[_rID].plyr = _pID;
if (round_[_rID].team != _team)
round_[_rID].team = _team;
// set the new leader bool to true
_eventData_.compressedData = _eventData_.compressedData + 100;
}
// store the air drop tracker number (number of buys since last airdrop)
_eventData_.compressedData = _eventData_.compressedData + (1000); // remove airDrop from compressedData
// update player
plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys);
plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth);
// update round
round_[_rID].keys = _keys.add(round_[_rID].keys);
round_[_rID].eth = _eth.add(round_[_rID].eth);
rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]);
// distribute eth
_eventData_ = distributeExternal(_rID, _pID, _eth, _affID, _eventData_);
_eventData_ = distributeInternal(_rID, _pID, _eth, _keys, _eventData_);
// call end tx function to fire end tx event.
endTx(_sender, _pID, _team, _eth, _keys, _eventData_);
}
}
//==============================================================================
// _ _ | _ | _ _|_ _ _ _ .
// (_(_||(_|_||(_| | (_)| _\ .
//==============================================================================
/**
* @dev calculates unmasked earnings (just calculates, does not update mask)
* @return earnings in wei format
*/
function calcUnMaskedEarnings(uint256 _pID, uint256 _rIDlast)
private
view
returns(uint256)
{
return( (((round_[_rIDlast].mask).mul(plyrRnds_[_pID][_rIDlast].keys)) / (1000000000000000000)).sub(plyrRnds_[_pID][_rIDlast].mask) );
}
/**
* @dev returns the amount of keys you would get given an amount of eth.
* -functionhash- 0xce89c80c
* @param _rID round ID you want price for
* @param _eth amount of eth sent in
* @return keys received
*/
function calcKeysReceived(uint256 _rID, uint256 _eth)
public
view
returns(uint256)
{
// grab time
uint256 _now = now;
// are we in a round?
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0)))
return ( (round_[_rID].eth).keysRec(_eth) );
else // rounds over. need keys for new round
return ( (_eth).keys() );
}
/**
* @dev returns current eth price for X keys.
* -functionhash- 0xcf808000
* @param _keys number of keys desired (in 18 decimal format)
* @return amount of eth needed to send
*/
function iWantXKeys(uint256 _keys)
public
view
returns(uint256)
{
// setup local rID
uint256 _rID = rID_;
// grab time
uint256 _now = now;
// are we in a round?
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0)))
return ( (round_[_rID].keys.add(_keys)).ethRec(_keys) );
else // rounds over. need price for new round
return ( (_keys).eth() );
}
//==============================================================================
// _|_ _ _ | _ .
// | (_)(_)|_\ .
//==============================================================================
/**
* @dev receives name/player info from names contract
*/
function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff)
external
{
require (msg.sender == address(PlayerBook), "your not playerNames contract... hmmm..");
if (pIDxAddr_[_addr] != _pID)
pIDxAddr_[_addr] = _pID;
if (pIDxName_[_name] != _pID)
pIDxName_[_name] = _pID;
if (plyr_[_pID].addr != _addr)
plyr_[_pID].addr = _addr;
if (plyr_[_pID].name != _name)
plyr_[_pID].name = _name;
if (plyr_[_pID].laff != _laff)
plyr_[_pID].laff = _laff;
if (plyrNames_[_pID][_name] == false)
plyrNames_[_pID][_name] = true;
}
/**
* @dev receives entire player name list
*/
function receivePlayerNameList(uint256 _pID, bytes32 _name)
external
{
require (msg.sender == address(PlayerBook), "your not playerNames contract... hmmm..");
if(plyrNames_[_pID][_name] == false)
plyrNames_[_pID][_name] = true;
}
/**
* @dev gets existing or registers new pID. use this when a player may be new
* @return pID
*/
function determinePID(address _sender, F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
{
uint256 _pID = pIDxAddr_[_sender];
// if player is new to this version of fomo3d
if (_pID == 0)
{
// grab their player ID, name and last aff ID, from player names contract
_pID = PlayerBook.getPlayerID(_sender);
bytes32 _name = PlayerBook.getPlayerName(_pID);
uint256 _laff = PlayerBook.getPlayerLAff(_pID);
// set up player account
pIDxAddr_[_sender] = _pID;
plyr_[_pID].addr = _sender;
if (_name != "")
{
pIDxName_[_name] = _pID;
plyr_[_pID].name = _name;
plyrNames_[_pID][_name] = true;
}
if (_laff != 0 && _laff != _pID)
plyr_[_pID].laff = _laff;
// set the new player bool to true
_eventData_.compressedData = _eventData_.compressedData + 1;
}
return (_eventData_);
}
/**
* @dev decides if round end needs to be run & new round started. and if
* player unmasked earnings from previously played rounds need to be moved.
*/
function managePlayer(uint256 _pID, F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
{
// if player has played a previous round, move their unmasked earnings
// from that round to gen vault.
if (plyr_[_pID].lrnd != 0)
updateGenVault(_pID, plyr_[_pID].lrnd);
// update player's last round played
plyr_[_pID].lrnd = rID_;
// set the joined round bool to true
_eventData_.compressedData = _eventData_.compressedData + 10;
return(_eventData_);
}
/**
* @dev ends the round. manages paying out winner/splitting up pot
*/
function endRound(F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
{
// setup local rID
uint256 _rID = rID_;
// grab our winning player and team id's
uint256 _winPID = round_[_rID].plyr;
uint256 _winTID = round_[_rID].team;
// grab our pot amount
uint256 _pot = round_[_rID].pot;
// calculate our winner share, community rewards, gen share,
// p3d share, and amount reserved for next pot
uint256 _win = (_pot.mul(48)) / 100;
uint256 _com = (_pot / 50);
uint256 _gen = (_pot.mul(potSplit_)) / 100;
uint256 _p3d = (_pot.mul(potSplit_)) / 100;
uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d);
// calculate ppt for round mask
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys);
uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000);
if (_dust > 0)
{
_gen = _gen.sub(_dust);
_res = _res.add(_dust);
}
// pay our winner
plyr_[_winPID].win = _win.add(plyr_[_winPID].win);
// community rewards
ChainLink.transfer(community, _com);
// distribute gen portion to key holders
round_[_rID].mask = _ppt.add(round_[_rID].mask);
// send share for link3d holders
if (_p3d > 0)
Link3D.distribute(_p3d);
// prepare event data
_eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000);
_eventData_.winnerAddr = plyr_[_winPID].addr;
_eventData_.winnerName = plyr_[_winPID].name;
_eventData_.amountWon = _win;
_eventData_.genAmount = _gen;
_eventData_.P3DAmount = _p3d;
_eventData_.newPot = _res;
// start next round
rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndInit_).add(rndGap_);
round_[_rID].pot = _res;
return(_eventData_);
}
/**
* @dev moves any unmasked earnings to gen vault. updates earnings mask
*/
function updateGenVault(uint256 _pID, uint256 _rIDlast)
private
{
uint256 _earnings = calcUnMaskedEarnings(_pID, _rIDlast);
if (_earnings > 0)
{
// put in gen vault
plyr_[_pID].gen = _earnings.add(plyr_[_pID].gen);
// zero out their earnings by updating mask
plyrRnds_[_pID][_rIDlast].mask = _earnings.add(plyrRnds_[_pID][_rIDlast].mask);
}
}
/**
* @dev updates round timer based on number of whole keys bought.
*/
function updateTimer(uint256 _keys, uint256 _rID)
private
{
// grab time
uint256 _now = now;
// calculate time based on number of keys bought
uint256 _newTime;
if (_now > round_[_rID].end && round_[_rID].plyr == 0)
_newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(_now);
else
_newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(round_[_rID].end);
// compare to max and set new end time
if (_newTime < (rndMax_).add(_now))
round_[_rID].end = _newTime;
else
round_[_rID].end = rndMax_.add(_now);
}
/**
* @dev distributes eth based on fees to com, aff, and p3d
*/
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
// pay 2% out to community rewards
uint256 _com = _eth / 50;
uint256 _p3d;
ChainLink.transfer(community, _com);
// distribute share to affiliate
uint256 _aff = _eth / 10;
// decide what to do with affiliate share of fees
// affiliate must not be self, and must have a name registered
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_p3d = _aff;
}
// pay out link3d holders
_p3d = _p3d.add((_eth.mul(divFee_)) / (100));
if (_p3d > 0)
{
// deposit to divies contract
Link3D.distribute(_p3d);
// set up event data
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
}
/**
* @dev distributes eth based on fees to gen and pot
*/
function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
// calculate gen share (58% of buy in gets paid to key holders of current round)
uint256 _gen = (_eth.mul(keyFee_)) / 100;
// update eth balance (eth = eth - (com share + aff share + dividends share))
// We have 12% not 14% because we don't have 1% pot swap or 1% air drop here. These 2% go into .gen/keyholders which is now 58(keyFee_) instead of 56
_eth = _eth.sub(((_eth.mul(12)) / 100).add((_eth.mul(divFee_)) / 100));
// calculate pot
uint256 _pot = _eth.sub(_gen);
// distribute gen share (thats what updateMasks() does) and adjust
// balances for dust.
uint256 _dust = updateMasks(_rID, _pID, _gen, _keys);
if (_dust > 0)
_gen = _gen.sub(_dust);
// add eth to pot
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
// set up event data
_eventData_.genAmount = _gen.add(_eventData_.genAmount);
_eventData_.potAmount = _pot;
return(_eventData_);
}
/**
* @dev updates masks for round and player when keys are bought
* @return dust left over
*/
function updateMasks(uint256 _rID, uint256 _pID, uint256 _gen, uint256 _keys)
private
returns(uint256)
{
/* MASKING NOTES
earnings masks are a tricky thing for people to wrap their minds around.
the basic thing to understand here. is were going to have a global
tracker based on profit per share for each round, that increases in
relevant proportion to the increase in share supply.
the player will have an additional mask that basically says "based
on the rounds mask, my shares, and how much i've already withdrawn,
how much is still owed to me?"
*/
// calc profit per key & round mask based on this buy: (dust goes to pot)
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys);
round_[_rID].mask = _ppt.add(round_[_rID].mask);
// calculate player earning from their own buy (only based on the keys
// they just bought). & update player earnings mask
uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000);
plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask);
// calculate & return dust
return(_gen.sub((_ppt.mul(round_[_rID].keys)) / (1000000000000000000)));
}
/**
* @dev adds up unmasked earnings, & vault earnings, sets them all to 0
* @return earnings in wei format
*/
function withdrawEarnings(uint256 _pID)
private
returns(uint256)
{
// update gen vault
updateGenVault(_pID, plyr_[_pID].lrnd);
// from vaults
uint256 _earnings = (plyr_[_pID].win).add(plyr_[_pID].gen).add(plyr_[_pID].aff);
if (_earnings > 0)
{
plyr_[_pID].win = 0;
plyr_[_pID].gen = 0;
plyr_[_pID].aff = 0;
}
return(_earnings);
}
/**
* @dev prepares compression data and fires event for buy or reload tx's
*/
function endTx(address _sender, uint256 _pID, uint256 _team, uint256 _eth, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_)
private
{
_eventData_.compressedData = _eventData_.compressedData + (now * 1000000000000000000) + (_team * 100000000000000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID + (rID_ * 10000000000000000000000000000000000000000000000000000);
emit F3Devents.onEndTx
(
_eventData_.compressedData,
_eventData_.compressedIDs,
plyr_[_pID].name,
_sender,
_eth,
_keys,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.P3DAmount,
_eventData_.genAmount,
_eventData_.potAmount
);
}
//==============================================================================
// (~ _ _ _._|_ .
// _)(/_(_|_|| | | \/ .
//====================/=========================================================
/** upon contract deploy, it will be deactivated. this is a one time
* use function that will activate the contract. we do this so devs
* have time to set things up on the web end **/
bool public activated_ = false;
function activate()
external
{
// only team just can activate
require(
msg.sender == administrator
);
// can only be ran once
require(activated_ == false, "fomo3d already activated");
// activate the contract
activated_ = true;
// lets start first round
rID_ = 1;
round_[1].strt = now + rndExtra_ - rndGap_;
round_[1].end = now + rndInit_ + rndExtra_;
}
// if approval would ever run out of chainlink
function approveChainLink() external {
ChainLink.approve(link3dAddress, 10**27);
}
}
//==============================================================================
// __|_ _ __|_ _ .
// _\ | | |_|(_ | _\ .
//==============================================================================
library F3Ddatasets {
//compressedData key
// [76-33][32][31][30][29][28-18][17][16-6][5-3][2][1][0]
// 0 - new player (bool)
// 1 - joined round (bool)
// 2 - new leader (bool)
// 3-5 - air drop tracker (uint 0-999)
// 6-16 - round end time
// 17 - winnerTeam
// 18 - 28 timestamp
// 29 - team
// 30 - 0 = reinvest (round), 1 = buy (round), 2 = buy (ico), 3 = reinvest (ico)
// 31 - airdrop happened bool
// 32 - airdrop tier
// 33 - airdrop amount won
//compressedIDs key
// [77-52][51-26][25-0]
// 0-25 - pID
// 26-51 - winPID
// 52-77 - rID
struct EventReturns {
uint256 compressedData;
uint256 compressedIDs;
address winnerAddr; // winner address
bytes32 winnerName; // winner name
uint256 amountWon; // amount won
uint256 newPot; // amount in new pot
uint256 P3DAmount; // amount distributed to p3d
uint256 genAmount; // amount distributed to gen
uint256 potAmount; // amount added to pot
}
struct Player {
address addr; // player address
bytes32 name; // player name
uint256 win; // winnings vault
uint256 gen; // general vault
uint256 aff; // affiliate vault
uint256 lrnd; // last round played
uint256 laff; // last affiliate id used
}
struct PlayerRounds {
uint256 eth; // eth player has added to round (used for eth limiter)
uint256 keys; // keys
uint256 mask; // player mask
uint256 ico; // ICO phase investment
}
struct Round {
uint256 plyr; // pID of player in lead
uint256 team; // tID of team in lead
uint256 end; // time ends/ended
bool ended; // has round end function been ran
uint256 strt; // time round started
uint256 keys; // keys
uint256 eth; // total eth in
uint256 pot; // eth to pot (during round) / final amount paid to winner (after round ends)
uint256 mask; // global mask
uint256 ico; // total eth sent in during ICO phase
uint256 icoGen; // total eth for gen during ICO phase
uint256 icoAvg; // average key price for ICO phase
}
}
//==============================================================================
// | _ _ _ | _ .
// |<(/_\/ (_(_||(_ .
//=======/======================================================================
library F3DKeysCalcLong {
using SafeMath for *;
/**
* @dev calculates number of keys received given X eth
* @param _curEth current amount of eth in contract
* @param _newEth ...
// [truncated — 55298 bytes total]
Read Contract
activated_ 0xd53b2679 → bool
administrator 0xf53d0a8e → address
calcKeysReceived 0xce89c80c → uint256
community 0xdc1fb5a5 → address
divFee_ 0xb5e07514 → uint256
getBuyPrice 0x018a25e8 → uint256
getCurrentRoundInfo 0x747dff42 → uint256, uint256, uint256, uint256, uint256, uint256, uint256, address, bytes32, uint256
getPlayerInfoByAddress 0xee0b5d8b → uint256, bytes32, uint256, uint256, uint256, uint256, uint256
getPlayerVaults 0x63066434 → uint256, uint256, uint256
getTimeLeft 0xc7e284b8 → uint256
iWantXKeys 0xcf808000 → uint256
keyFee_ 0x7196980c → uint256
name 0x06fdde03 → string
pIDxAddr_ 0x10f01eba → uint256
pIDxName_ 0x2e19ebdc → uint256
plyrNames_ 0x2660316e → bool
plyrRnds_ 0xa2bccae9 → uint256, uint256, uint256, uint256
plyr_ 0xde7874f3 → address, bytes32, uint256, uint256, uint256, uint256, uint256
potSplit_ 0x58d162da → uint256
rID_ 0x624ae5c0 → uint256
rndTmEth_ 0x5893d481 → uint256
round_ 0x24c33d33 → uint256, uint256, uint256, bool, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256
symbol 0x95d89b41 → string
Write Contract 9 functions
These functions modify contract state and require a wallet transaction to execute.
activate 0x0f15f4c0
No parameters
approveChainLink 0xbaf8f7da
No parameters
onTokenTransfer 0xa4c0ed36
address _sender
uint256 _value
bytes _data
reLoadXaddr 0x015008b1
address _affCode
uint256 _eth
reLoadXid 0x8f8a5832
uint256 _affCode
uint256 _eth
reLoadXname 0xfb9073eb
bytes32 _affCode
uint256 _eth
receivePlayerInfo 0x49cc635d
uint256 _pID
address _addr
bytes32 _name
uint256 _laff
receivePlayerNameList 0x8f7140ea
uint256 _pID
bytes32 _name
withdraw 0x3ccfd60b
No parameters
Token Balances (1) $405.20
View Transfers →| Token | Balance | Price | Value |
|---|---|---|---|
| LINK | 46.0973 | $8.79 | $405.20 |
Recent Transactions
This address has 1 on-chain transactions, but only 1.3% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →