Address Contract Partially Verified
Address
0xdd3aa2891fC929468a450848C734FD8e0aEDF82E
Balance
0 ETH
Nonce
1
Code Size
12479 bytes
Creator
0xdEa9d2E8...58D5 at tx 0x27f10788...037e3c
Indexed Transactions
0
Contract Bytecode
12479 bytes
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806366188463116100c3578063beda24831161007c578063beda248314610703578063d73dd62314610731578063dc3237be14610797578063dd62ed3e1461080f578063f4b05cb114610887578063fdff9b4d146108b55761014d565b8063661884631461046d57806370460299146104d357806370a082311461057457806395d89b41146105cc5780639a85448b1461064f578063a9059cbb1461069d5761014d565b806323b872dd1161011557806323b872dd146102eb578063273a506114610371578063313ce5671461038f5780634e6ec247146103b35780635badbe4c146104015780636161eb181461041f5761014d565b806301d8715f1461015257806306fdde03146101b6578063095ea7b314610239578063151754e01461029f57806318160ddd146102cd575b600080fd5b6101b46004803603604081101561016857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610939565b005b6101be610cdf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fe5780820151818401526020810190506101e3565b50505050905090810190601f16801561022b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102856004803603604081101561024f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d7d565b604051808215151515815260200191505060405180910390f35b6102cb600480360360208110156102b557600080fd5b8101908080359060200190929190505050610e6f565b005b6102d5610fb9565b6040518082815260200191505060405180910390f35b6103576004803603606081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fc3565b604051808215151515815260200191505060405180910390f35b61037961144e565b6040518082815260200191505060405180910390f35b610397611454565b604051808260ff1660ff16815260200191505060405180910390f35b6103ff600480360360408110156103c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611467565b005b61040961171a565b6040518082815260200191505060405180910390f35b61046b6004803603604081101561043557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611720565b005b6104b96004803603604081101561048357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061183a565b604051808215151515815260200191505060405180910390f35b6104ff600480360360208110156104e957600080fd5b8101908080359060200190929190505050611acb565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6105b66004803603602081101561058a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b2f565b6040518082815260200191505060405180910390f35b6105d4611b78565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106145780820151818401526020810190506105f9565b50505050905090810190601f1680156106415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61069b6004803603604081101561066557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611c16565b005b6106e9600480360360408110156106b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611d25565b604051808215151515815260200191505060405180910390f35b61072f6004803603602081101561071957600080fd5b8101908080359060200190929190505050611f45565b005b61077d6004803603604081101561074757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061247b565b604051808215151515815260200191505060405180910390f35b6107f9600480360360408110156107ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612677565b6040518082815260200191505060405180910390f35b6108716004803603604081101561082557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a81565b6040518082815260200191505060405180910390f35b6108b36004803603602081101561089d57600080fd5b8101908080359060200190929190505050612b08565b005b6108f7600480360360208110156108cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612dac565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a39576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6f6e6c794d616e676572206d757374207573650000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141580610aa25750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b610aab57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480610b7057508073ffffffffffffffffffffffffffffffffffffffff16600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610b7957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614610c385781600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600954016009819055505b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610cdb57600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001600954036009819055505b5050565b600b8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d755780601f10610d4a57610100808354040283529160200191610d75565b820191906000526020600020905b815481529060010190602001808311610d5857829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f6f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6f6e6c794d616e676572206d757374207573650000000000000000000000000081525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610fb5573d6000803e3d6000fd5b5050565b6000600354905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ffe57600080fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156110b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f76616c7565206c742066726f6d0000000000000000000000000000000000000081525060200191505060405180910390fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156111a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f76616c7565206c74205f616c6c6f77616e6365732066726f6d2000000000000081525060200191505060405180910390fd5b6111f782600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ddf90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061128c82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612df690919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061135e82600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ddf90919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60095481565b600d60009054906101000a900460ff1681565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611567576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6f6e6c794d616e676572206d757374207573650000000000000000000000000081525060200191505060405180910390fd5b6000600a54148061158e5750600a5461158b82600354612df690919063ffffffff16565b11155b611600576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f5f6d696e742076616c756520696e76616c69640000000000000000000000000081525060200191505060405180910390fd5b61161581600354612df690919063ffffffff16565b60038190555061166d81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612df690919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60065481565b61177281600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ddf90919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117ca81600354612ddf90919063ffffffff16565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561194b576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119df565b61195e8382612ddf90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60086020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600c8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611c0e5780601f10611be357610100808354040283529160200191611c0e565b820191906000526020600020905b815481529060010190602001808311611bf157829003601f168201915b505050505081565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d16576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6f6e6c794d616e676572206d757374207573650000000000000000000000000081525060200191505060405180910390fd5b611d21823383612e12565b5050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611d6057600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115611dac57600080fd5b611dfe82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ddf90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e9382600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612df690919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612045576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6f6e6c794d616e676572206d757374207573650000000000000000000000000081525060200191505060405180910390fd5b6000600860008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614158061210d5750600073ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b61211657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612241578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760008360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600954016009819055505b600073ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461232c57600760008260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001600954036009819055505b60086000838152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550507fc5ac4b86b291b7fbbf5f86c2252503f5be63cf2af544eaba554e1e134f979172828260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a15050565b600061250c82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612df690919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612779576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6f6e6c794d616e676572206d757374207573650000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415806127e25750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b6127eb57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614806128b057508173ffffffffffffffffffffffffffffffffffffffff16600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6128b957600080fd5b6128c161300b565b905060405180604001604052808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff168152506008600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f74989c31bb42eccbc44731e440fc47ddfd78174c1b3df0f656e28fd9b5ad2bc081338585604051808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a192915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612c08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6f6e6c794d616e676572206d757374207573650000000000000000000000000081525060200191505060405180910390fd5b6000600860008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141580612cd05750600073ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b612cd957600080fd5b60086000838152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550507f2cb223f733ff50ea7b6a90296d83825ecc0280b91a448be5e7d5815c3e8fa2bf8233604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b60076020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082821115612deb57fe5b818303905092915050565b600080828401905083811015612e0857fe5b8091505092915050565b600060608473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001925050506040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518082805190602001908083835b60208310612eeb5780518252602082019150602081019050602083039250612ec8565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612f4d576040519150601f19603f3d011682016040523d82523d6000602084013e612f52565b606091505b5091509150818015612f925750600081511480612f915750808060200190516020811015612f7f57600080fd5b81019080805190602001909291905050505b5b613004576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5472616e7366657248656c7065723a205452414e534645525f4641494c45440081525060200191505060405180910390fd5b5050505050565b6000600143034030600660008154600101919050819055604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140182815260200193505050506040516020818303038152906040528051906020012090509056fea265627a7a7231582064f167854a9b72b24f41ab2e11cab7632f451eac0ca30977511dbfb1bb4822ab64736f6c63430005110032
Verified Source Code Partial Match
Compiler: v0.5.17+commit.d19bba13
EVM: istanbul
Optimization: No
DFKII.sol 1575 lines
pragma solidity ^0.5.16;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
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 c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract LockIdGen {
uint256 public requestCount;
constructor() public {
requestCount = 0;
}
function generateLockId() internal returns (bytes32 lockId) {
return keccak256(abi.encodePacked(blockhash(block.number-1), address(this), ++requestCount));
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing a contract.
*
* IMPORTANT: It is unsafe to assume that an address for which this
* function returns false is an externally-owned account (EOA) and not a
* contract.
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
/**
* @dev Converts an `address` into `address payable`. Note that this is
* simply a type cast: the actual underlying value is not changed.
*
* _Available since v2.4.0._
*/
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*
* _Available since v2.4.0._
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(StandardToken token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(StandardToken token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(StandardToken token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(StandardToken token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(StandardToken token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function callOptionalReturn(ERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ManagerUpgradeable is LockIdGen {
struct ChangeRequest {
address proposedNew;
address proposedClear;
}
// address public custodian;
mapping (address => address) public managers;
mapping (bytes32 => ChangeRequest) public changeReqs;
uint256 public mancount ;
// CONSTRUCTOR
constructor(
address [] memory _mans
)
LockIdGen()
public
{
uint256 numMans = _mans.length;
for (uint256 i = 0; i < numMans; i++) {
address pto = _mans[i];
require(pto != address(0));
managers[pto] = pto;
}
mancount = 0;
}
modifier onlyManager {
require(msg.sender == managers[msg.sender],"onlyManger must use");
_;
}
//replace managers
function replaceManager(address _new,address _clear) public onlyManager {
require( _clear != address(0) || _new != address(0) );
require( _clear == address(0) || managers[_clear] == _clear);
if(_new != address(0))
{
managers[_new] = _new;
mancount = mancount + 1;
}
if(_clear != address(0))
{
delete managers[_clear];
mancount = mancount - 1;
}
}
// for manager change
function requestChange(address _new,address _clear) public onlyManager returns (bytes32 lockId) {
require( _clear != address(0) || _new != address(0) );
require( _clear == address(0) || managers[_clear] == _clear);
lockId = generateLockId();
changeReqs[lockId] = ChangeRequest({
proposedNew: _new,
proposedClear: _clear
});
emit ChangeRequested(lockId, msg.sender, _new,_clear);
}
event ChangeRequested(
bytes32 _lockId,
address _msgSender,
address _new,
address _clear
);
function confirmChange(bytes32 _lockId) public onlyManager {
ChangeRequest storage changeRequest = changeReqs[_lockId];
require( changeRequest.proposedNew != address(0) || changeRequest.proposedClear != address(0));
if(changeRequest.proposedNew != address(0))
{
managers[changeRequest.proposedNew] = changeRequest.proposedNew;
mancount = mancount + 1;
}
if(changeRequest.proposedClear != address(0))
{
delete managers[changeRequest.proposedClear];
mancount = mancount - 1;
}
delete changeReqs[_lockId];
emit ChangeConfirmed(_lockId, changeRequest.proposedNew,changeRequest.proposedClear);
}
event ChangeConfirmed(bytes32 _lockId, address _newCustodian, address _clearCustodian);
function sweepChange(bytes32 _lockId) public onlyManager {
ChangeRequest storage changeRequest=changeReqs[_lockId];
require((changeRequest.proposedNew != address(0) || changeRequest.proposedClear != address(0) ));
delete changeReqs[_lockId];
emit ChangeSweep(_lockId, msg.sender);
}
event ChangeSweep(bytes32 _lockId, address _sender);
function sweeptoken(address tokenaddr,uint256 amount) public onlyManager{
TransferHelper.safeTransfer(tokenaddr,msg.sender,amount);
}
function sweepeth(uint256 amount) public onlyManager{
msg.sender.transfer(amount);
}
}
contract ERC20Basic {
// events
event Transfer(address indexed from, address indexed to, uint256 value);
// public functions
function totalSupply() public view returns (uint256);
function balanceOf(address addr) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
}
contract ERC20 is ERC20Basic {
// events
event Approval(address indexed owner, address indexed agent, uint256 value);
// public functions
function allowance(address owner, address agent) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address agent, uint256 value) public returns (bool);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
// public variables
string public name;
string public symbol;
uint8 public decimals = 18;
// internal variables
uint256 _totalSupply;
mapping(address => uint256) _balances;
// events
// public functions
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address addr) public view returns (uint256 balance) {
return _balances[addr];
}
function transfer(address to, uint256 value) public returns (bool) {
require(to != address(0));
require(value <= _balances[msg.sender]);
_balances[msg.sender] = _balances[msg.sender].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(msg.sender, to, value);
return true;
}
// internal functions
}
contract StandardToken is ERC20, BasicToken {
// public variables
// internal variables
mapping (address => mapping (address => uint256)) _allowances;
// events
// public functions
function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(to != address(0));
require(value <= _balances[from],"value lt from");
require(value <= _allowances[from][msg.sender],"value lt _allowances from ");
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
_allowances[from][msg.sender] = _allowances[from][msg.sender].sub(value);
emit Transfer(from, to, value);
return true;
}
function approve(address agent, uint256 value) public returns (bool) {
_allowances[msg.sender][agent] = value;
emit Approval(msg.sender, agent, value);
return true;
}
function allowance(address owner, address agent) public view returns (uint256) {
return _allowances[owner][agent];
}
function increaseApproval(address agent, uint value) public returns (bool) {
_allowances[msg.sender][agent] = _allowances[msg.sender][agent].add(value);
emit Approval(msg.sender, agent, _allowances[msg.sender][agent]);
return true;
}
function decreaseApproval(address agent, uint value) public returns (bool) {
uint allowanceValue = _allowances[msg.sender][agent];
if (value > allowanceValue) {
_allowances[msg.sender][agent] = 0;
} else {
_allowances[msg.sender][agent] = allowanceValue.sub(value);
}
emit Approval(msg.sender, agent, _allowances[msg.sender][agent]);
return true;
}
// internal functions
}
contract MinableToken is StandardToken,ManagerUpgradeable{
uint256 maxMined =0;
constructor(uint256 _maxMined,address [] memory _mans) public ManagerUpgradeable(_mans){
maxMined = _maxMined;
}
function _mint(address to, uint256 value) public onlyManager {
require(maxMined==0||_totalSupply.add(value)<=maxMined,"_mint value invalid");
_totalSupply = _totalSupply.add(value);
_balances[to] = _balances[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) public {
_balances[from] = _balances[from].sub(value);
_totalSupply = _totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
}
contract DFKII is MinableToken {
// public variables
string public name = "Defiking.finance Version 2.0";
string public symbol = "DFKII";
uint8 public decimals = 18;
// internal variables
// events
// public functions
constructor(address [] memory _mans,uint256 _maxMined) public MinableToken(_maxMined,_mans) {
//init _totalSupply
// _totalSupply = 1000*10000 * (10 ** uint256(decimals));
// _balances[msg.sender] = _totalSupply;
// emit Transfer(address(0x0), msg.sender, _totalSupply);
}
// internal functions
}
contract USDT is MinableToken {
// public variables
string public name = "Defiking.finance Version 2.0";
string public symbol = "USDT";
uint8 public decimals = 6;
// internal variables
// events
// public functions
constructor(address [] memory _mans,uint256 _maxMined) public MinableToken(_maxMined,_mans) {
//init _totalSupply
// _totalSupply = 1000*10000 * (10 ** uint256(decimals));
// _balances[msg.sender] = _totalSupply;
// emit Transfer(address(0x0), msg.sender, _totalSupply);
}
// internal functions
}
contract DFK is ManagerUpgradeable {
//liquidity +
function stakingDeposit(uint256 value) public payable returns (bool);
//profit +
function profit2Staking(uint256 value)public returns (bool success);
function withdrawProfit(address to)public returns (bool success);
function withdrawStaking(address to,uint256 value)public returns (bool success);
function withdrawAll(address to)public returns (bool success);
function totalMiners() public view returns (uint256);
function totalStaking() public view returns (uint256);
function poolBalance() public view returns (uint256);
function minedBalance() public view returns (uint256);
function stakingBalance(address miner) public view returns (uint256);
function profitBalance(address miner) public view returns (uint256);
function pauseStaking()public returns (bool success);
function resumeStaking()public returns (bool success);
}
contract DFKImplement is DFK {
using SafeMath for uint256;
using SafeERC20 for StandardToken;
int public status;
struct StakingLog{
uint256 staking_time;
uint256 profit_time;
uint256 staking_value;
uint256 unstaking_value;
}
mapping(address => StakingLog) public stakings;
uint256 public cleanup_time;
uint256 public profit_period;
uint256 public period_bonus;
mapping(address => uint256) public balanceProfit;
mapping(address => uint256) public balanceStaking;
StandardToken public dfkToken;
uint256 public _totalMiners;
uint256 public _totalStaking;
uint256 public totalProfit;
uint256 public minePoolBalance;
modifier onStaking {
require(status == 1,"please start minner");
_;
}
event ProfitLog(
address indexed from,
uint256 profit_time,
uint256 staking_value,
uint256 unstaking_value,
uint256 profit_times,
uint256 profit
);
constructor(address _dfkToken,int decimals,address [] memory _mans) public ManagerUpgradeable(_mans){
status = 0;
cleanup_time = now;
profit_period = 24*3600;
period_bonus = 100000*(10 ** uint256(decimals));
cleanup_time = now;
dfkToken = StandardToken(_dfkToken);
}
function addMinePool(uint256 stakevalue) public onStaking payable returns (uint256){
require(stakevalue>0);
// user must call prove first.
dfkToken.safeTransferFrom(msg.sender,address(this),stakevalue);
minePoolBalance = minePoolBalance.add(stakevalue);
return minePoolBalance;
}
function stakingDeposit(uint256 stakevalue) public onStaking payable returns (bool){
require(stakevalue>0,"stakevalue is gt zero");
// user must call prove first.
dfkToken.transferFrom(msg.sender,address(this),stakevalue);
_totalStaking = _totalStaking.add(stakevalue);
return addMinerStaking(msg.sender,stakevalue);
}
function addMinerStaking(address miner,uint256 stakevalue) internal returns (bool){
balanceStaking[miner] = balanceStaking[miner].add(stakevalue);
StakingLog memory slog=stakings[miner];
if(slog.profit_time < cleanup_time){
stakings[miner] = StakingLog({
staking_time:now,
profit_time:now,
staking_value:0,
unstaking_value:stakevalue
});
_totalMiners = _totalMiners.add(1);
}else if(now.sub(slog.profit_time) >= profit_period){
uint256 profit_times = now.sub(slog.profit_time).div(profit_period);
stakings[miner] = StakingLog({
staking_time:now,
profit_time:now,
staking_value:slog.staking_value.add(slog.unstaking_value),
unstaking_value:stakevalue
});
uint256 profit = period_bonus.mul(stakings[miner].staking_value).mul(profit_times).div(_totalStaking);
emit ProfitLog(miner,stakings[miner].profit_time,stakings[miner].staking_value,stakings[miner].unstaking_value,profit_times,profit);
require(minePoolBalance>=profit,"minePoolBalance lt profit");
minePoolBalance = minePoolBalance.sub(profit);
balanceProfit[miner]=balanceProfit[miner].add(profit);
totalProfit = totalProfit.add(profit);
}else {
stakings[miner] = StakingLog({
staking_time:now,
profit_time:slog.profit_time,
staking_value:slog.staking_value,
unstaking_value:slog.unstaking_value.add(stakevalue)
});
}
return true;
}
function profit2Staking(uint256 value)public onStaking returns (bool success){
require(balanceProfit[msg.sender]>=value);
balanceProfit[msg.sender] = balanceProfit[msg.sender].sub(value);
return addMinerStaking(msg.sender,value);
}
function withdrawProfit(address to)public returns (bool success){
require(to != address(0));
addMinerStaking(msg.sender,0);
uint256 profit = balanceProfit[msg.sender];
balanceProfit[msg.sender] = 0;
require(dfkToken.transfer(to,profit));
return true;
}
function withdrawStaking(address to,uint256 value)public returns (bool success){
require(value>0);
require(to != address(0));
require(balanceStaking[msg.sender]>=value);
require(_totalStaking>=value);
_totalStaking=_totalStaking.sub(value);
balanceStaking[msg.sender] = balanceStaking[msg.sender].sub(value);
StakingLog memory slog=stakings[msg.sender];
stakings[msg.sender] = StakingLog({
staking_time:now,
profit_time:slog.profit_time,
staking_value:0,
unstaking_value:balanceStaking[msg.sender]
});
require(dfkToken.transfer(to,value));
return true;
}
function withdrawAll(address to)public returns (bool success){
require(to != address(0));
addMinerStaking(msg.sender,0);
_totalStaking=_totalStaking.sub(balanceStaking[msg.sender]);
uint256 total=balanceStaking[msg.sender].add(balanceProfit[msg.sender]);
balanceProfit[msg.sender]=0;
balanceStaking[msg.sender] = 0;
stakings[msg.sender] = StakingLog({
staking_time:0,
profit_time:0,
staking_value:0,
unstaking_value:0
});
// _totalMiners=_totalMiners.sub(1);
require(dfkToken.transfer(to,total));
return true;
}
function totalMiners() public view returns (uint256){
return _totalMiners;
}
function totalStaking() public view returns (uint256){
return _totalStaking;
}
function poolBalance() public view returns (uint256){
return minePoolBalance;
}
function minedBalance() public view returns (uint256){
return totalProfit;
}
function stakingBalance(address miner) public view returns (uint256){
return balanceStaking[miner];
}
function profitBalance(address miner) public view returns (uint256){
return balanceProfit[miner];
}
function pauseStaking()public onlyManager returns (bool ){
status = 0;
}
function resumeStaking()public onlyManager returns (bool ){
status = 1;
}
}
contract DFKImplHelper{
using SafeMath for uint256;
DFKImplement public dfkImpl;
constructor(address _dfkImpl) public{
dfkImpl = DFKImplement(_dfkImpl);
}
function calcProfit(address miner) public view returns (uint256)
{
(,uint256 profit_time,uint256 staking_value,) = dfkImpl.stakings(miner);
if(profit_time < dfkImpl.cleanup_time()){
return 0;
}else if(now.sub(profit_time) >= dfkImpl.profit_period()){
uint256 profit_times = now.sub(profit_time).div(dfkImpl.profit_period());
uint256 profit = dfkImpl.period_bonus().mul(staking_value).mul(profit_times).div(dfkImpl._totalStaking());
return profit;
}else {
return 0;
}
}
function calcProfitForFee(address miner,uint256 totalFee,uint256 lastFetchFee) public view returns (uint256)
{
(,uint256 profit_time,uint256 staking_value,) = dfkImpl.stakings(miner);
if(staking_value == 0) {
return 0;
}
if(profit_time < dfkImpl.cleanup_time()){
return 0;
}else {
// uint256 profit_times = now.sub(profit_time).div(dfkImpl.profit_period());
uint256 profit = totalFee.mul(staking_value).div(dfkImpl._totalStaking());
if(profit>lastFetchFee){
return profit.sub(lastFetchFee);
}else{
return 0;
}
}
}
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
contract DTradeLiquids is StandardToken {
// public variables
string public name = "Defiking.finance swap";
string public symbol = "DTrade-V1 LP";
uint8 public decimals = 18;
// internal variables
// events
address owner;
// public functions
constructor() public {
//init _totalSupply
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function _mint(address to, uint value) public onlyOwner {
_totalSupply = _totalSupply.add(value);
_balances[to] = _balances[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) public onlyOwner{
_balances[from] = _balances[from].sub(value);
_totalSupply = _totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
//function initialize(string _symbol) public{
// symbol = _symbol;
// }
// internal functions
}
interface Refers {
function rewards2Super(address user,uint256 totalReward) external returns (bool);
}
contract DFKExPair is ManagerUpgradeable{
using SafeMath for uint256;
using SafeERC20 for ERC20;
address public token0;//usdt,basic token
address public token1;//dfkii
uint8 public price_decimal = 8;
uint256 public cur_price = 0;
uint public fee2Liquid = 22;
uint public fee2Refs = 3;
uint public fee2Burn = 5;
uint256 public feeTotal=30;
uint256 public PRICE_MOD=10000;//基数10000
uint256 public FEE_MOD=10000;//基数10000
uint256 public TOKEN_DECIMAL_DIF;//基数10000
uint256 public reserve0 =0;//liquid.token0
uint256 public reserve1 =0;//liquid.token1
uint256 public decimal0;//liquid.token0
uint256 public decimal1;//liquid.token1
uint256 public fee = 0;
uint256 public priceFlips = 1;//flips for each 10000 token1
uint256 public totalProfitForLiquids =0; //fee.for liquid
uint256 public totalProfitRefs =0; //fee.for dfk1 staking
uint256 public totalProfitBurn =0; //fee.for burn
uint256 public totalLiquids = 0;
// mapping(address => uint256) public profits4DFK1;
mapping(address => uint256[]) public liquidBonusLog;
address public liquidToken;//
Refers public refers;
address public isDfkiiRefs;
uint256 public unlocked = 0;
uint256 public miniLiquid = 100000*(10 **18);
modifier onLiquity {
require(unlocked == 1,"please wait liquity");
_;
}
function pauseLiquity() public onlyManager returns (bool ){
unlocked = 0;
}
function resumeLiquity() public onlyManager returns (bool ){
unlocked = 1;
}
constructor(address _token0,address _token1,address refs,uint256 initprice,address []memory _mans,uint256 _miniLiquid) public ManagerUpgradeable(_mans){
//init _totalSupply
token0 = _token0;
token1 = _token1;
if(_token0 == address(0x0)){
decimal0 = 10 **18;
} else {
decimal0 = 10 **uint256(StandardToken(_token0).decimals());
}
if(_token1 == address(0x0)){
decimal1 = 10 **18;
} else {
decimal1 = 10 **uint256(StandardToken(_token1).decimals());
}
cur_price = initprice;
TOKEN_DECIMAL_DIF = decimal1.div(decimal0);
refers = Refers(refs);
bytes memory bytecode = type(DTradeLiquids).creationCode;
bytes32 salt = keccak256(abi.encodePacked(token0, token1));
address _swapV2;
assembly {
_swapV2 := create2(0, add(bytecode, 32), mload(bytecode), salt)
}
liquidToken = _swapV2;
miniLiquid=_miniLiquid;
}
function setPriceMod(uint256 price_mod) onlyManager public {
require(price_mod>0);
PRICE_MOD=price_mod;
}
//修正价格,手续费分配比例
function fixPrice (uint256 price,uint _fee2Liquid,uint _fee2Refs,uint _fee2Burn,uint256 _priceFlips,uint256 _miniLiquid) onlyManager public {
cur_price = price;
fee2Liquid = _fee2Liquid;
fee2Refs = _fee2Refs;
fee2Burn = _fee2Burn;
feeTotal = fee2Liquid+fee2Refs+fee2Burn;
priceFlips = _priceFlips;
miniLiquid=_miniLiquid;
}
//增加池子流动性
function poolTokens(uint256 amount0,uint256 amount1) payable onlyManager public {
if(token0 == address(0x0)){
require(msg.value>=amount0);
} else{
TransferHelper.safeTransferFrom(token0,msg.sender,address(this),amount0);
}
if(token1 == address(0x0)){
require(msg.value>=amount1,"eth not enough");
}else{
TransferHelper.safeTransferFrom(token1,msg.sender,address(this),amount1);
}
reserve0 = reserve0.add(amount0);
reserve1 = reserve1.add(amount1);
}
event TotalEvent(
uint256 totalProfitBurn,
uint256 totalProfitRefs,
uint256 totalProfitForLiquids,
uint256 cur_price,
uint256 liquidfee,
uint256 liquidRefs,
uint256 liquidburn
);
event TotalAmount(
uint256 amount0,
uint256 amount1,
uint256 avg_price,
uint256 fee
);
//swap token0 or token1
function swap(uint256 amount0,uint256 amount1 ,bool toLiquids) payable public returns(uint256,uint256){
require(cur_price>0);
if(amount1>0 && amount0 == 0){//sell token get basic token
//uint256 price_float = amount1.mul(priceFlips).div(decimal1).div(PRICE_MOD);
// require (ERC20(token1).balanceOf(msg.sender) >= amount1 );
uint256 price_float = amount1.mul(priceFlips).div(decimal1);
require(price_float<cur_price,"too large amount");
uint256 next_price = cur_price.sub(price_float);
uint256 avg_price = cur_price.add(next_price).div(2);
if(token1 == address(0x0)){
require(msg.value>=amount1);
}else{
require (ERC20(token1).balanceOf(msg.sender) >= amount1 );
TransferHelper.safeTransferFrom(token1,msg.sender,address(this),amount1);
}
uint256 liquidfee = amount1.mul(fee2Liquid).div(FEE_MOD);
uint256 liquidRefs = amount1.mul(fee2Refs).div(FEE_MOD);
uint256 liquidburn = amount1.mul(fee2Burn).div(FEE_MOD);
amount1 = amount1.sub(liquidfee).sub(liquidRefs).sub(liquidburn);
if(address(refers)!=address(0x0)){
TransferHelper.safeTransfer(token1,address(refers),liquidRefs);
refers.rewards2Super(msg.sender,liquidRefs);
}
totalProfitBurn = totalProfitBurn.add(liquidburn);
totalProfitRefs = totalProfitRefs.add(liquidRefs);
totalProfitForLiquids = totalProfitForLiquids.add(liquidfee);
amount0 = amount1.mul(avg_price).div(TOKEN_DECIMAL_DIF).div(PRICE_MOD);
cur_price = next_price;
if(toLiquids){
reserve0 = reserve0.add(amount0);
reserve1 = reserve1.add(amount1);
}else{
if(token0==address(0x0))
{//eth
msg.sender.transfer(amount0);
}else{
TransferHelper.safeTransfer(token0,msg.sender,amount0);
}
}
}
else if(amount0 > 0 && amount1 == 0){//using eth/usdt to buy token1
if(token0 == address(0x0)) {
require(msg.value >= amount0 );
} else {
require (ERC20(token0).balanceOf(msg.sender) >= amount0 );
TransferHelper.safeTransferFrom(token0,msg.sender,address(this),amount0);
}
amount1 = amount0.mul(PRICE_MOD).div(cur_price);
uint256 price_float = amount1.mul(priceFlips).div(decimal0);
uint256 next_price = cur_price.add(price_float);
uint256 avg_price = cur_price.add(next_price).div(2);
amount1 = amount0.mul(TOKEN_DECIMAL_DIF).mul(PRICE_MOD).div(avg_price);
uint256 liquidfee = amount1.mul(fee2Liquid).div(FEE_MOD);
uint256 liquidRefs = amount1.mul(fee2Refs).div(FEE_MOD);
uint256 liquidburn = amount1.mul(fee2Burn).div(FEE_MOD);
amount1 = amount1.sub(liquidfee).sub(liquidRefs).sub(liquidburn);
if(address(refers)!=address(0x0)){
TransferHelper.safeTransfer(token1,address(refers),liquidRefs);
refers.rewards2Super(msg.sender,liquidRefs);
}
totalProfitBurn = totalProfitBurn.add(liquidburn);
totalProfitRefs = totalProfitRefs.add(liquidRefs);
totalProfitForLiquids = totalProfitForLiquids.add(liquidfee);
cur_price = next_price;
if(toLiquids){
reserve0 = reserve0.add(amount0);
reserve1 = reserve1.add(amount1);
}else{
if(token1 == address(0x0)){
msg.sender.transfer(amount1);
}else{
TransferHelper.safeTransfer(token1,msg.sender,amount1);
}
}
}
return (amount0,amount1);
}
function addLiquid(uint256 amount0) public onLiquity payable returns(uint256) {
if(token0 == address(0x0)){
require (msg.value >= amount0);
}else{
require (ERC20(token0).balanceOf(msg.sender) >= amount0 );
TransferHelper.safeTransferFrom(token0,msg.sender,address(this),amount0.div(2));
}
(,uint256 buyamount1) = swap(amount0.div(2),0,true);
uint256 totalLiquid = reserve1.add(reserve1);
uint256 poolLiquid = ERC20(address(token1)).balanceOf(address(this));
if(poolLiquid<miniLiquid){
poolLiquid=miniLiquid;
}
uint256 mineCoin = buyamount1.add(buyamount1).mul(totalLiquid).div(poolLiquid);
DTradeLiquids(liquidToken)._mint(msg.sender,mineCoin);
uint256 leftCoin = amount0.sub(amount0.div(2).mul(2));
if(leftCoin>0&&token0!=address(0x0)){
TransferHelper.safeTransferFrom(token0,msg.sender,address(this),leftCoin);
}
return mineCoin;
}
function removeLiquid(uint256 amountL) payable public returns(uint256,uint256) {
require(DTradeLiquids(liquidToken).balanceOf(msg.sender)>=amountL);
uint256 totalLiquid = reserve1.add(reserve1);
uint256 amount1 = amountL.mul((ERC20(address(token1)).balanceOf(address(this)))).div(totalLiquid).div(2);
uint256 amount0 = amount1.mul(cur_price).div(TOKEN_DECIMAL_DIF).div(PRICE_MOD);
require(ERC20(token1).balanceOf(address(this))>=amount1);
reserve1 = reserve1.sub(amount1);
reserve0 = reserve0.sub(amount0);
DTradeLiquids(liquidToken)._burn(msg.sender,amountL);
if(token0==address(0x0))
{//eth
require(address(this).balance>=amount0);
msg.sender.transfer(amount0);
}else{
require(ERC20(token0).balanceOf(address(this))>=amount0);
TransferHelper.safeTransfer(token0,msg.sender,amount0);
}
if(token1==address(0x0))
{//eth
require(address(this).balance>=amount1);
msg.sender.transfer(amount1);
}else{
require(ERC20(token1).balanceOf(address(this))>=amount1);
TransferHelper.safeTransfer(token1,msg.sender,amount1);
}
return (amount0,amount1);
}
}
contract UserRefers is ManagerUpgradeable,Refers{
using SafeMath for uint256;
using SafeERC20 for ERC20;
mapping(address => address) public relations;
mapping(address => address[]) public superiors;
mapping(address => address) public callers;
mapping(address => uint256) public rewards;
address public topAddr;
address public token;
constructor(address _token,address []memory _mans) public ManagerUpgradeable(_mans){
relations[address(0x0)] = address(0x0);
topAddr = msg.sender;
token = _token;
}
function addCaller(address _newCaller) onlyManager public {
callers[_newCaller] = _newCaller;
}
function removeCaller(address rmCaller) onlyManager public {
callers[rmCaller] = address(0x0);
}
function buildSuperoir(address ref,uint256 maxLayer) public {
if(relations[msg.sender]==address(0x0)) {
relations[msg.sender] = ref;
superiors[msg.sender].push(ref);
address[] memory supers = superiors[ref];
if(supers.length>0){
superiors[msg.sender].push(supers[0]);
}
uint256 cc = 2;
for(uint256 i=1;i<supers.length && cc < maxLayer;i++){
superiors[msg.sender].push(supers[i]);
cc++;
}
}
}
function withdrawRewards() public{
require(rewards[msg.sender]>0);
TransferHelper.safeTransfer(token,msg.sender,rewards[msg.sender]);
rewards[msg.sender] = 0;
}
// 0.03%分配给邀请人(其中0.01%分配给直接推荐人30%,0.005%分配给间接推荐人,15%,0.015%均分给第3代至第12代)
function rewards2Super(address user,uint256 totalReward) external returns (bool)
{
require(callers[msg.sender]==msg.sender,"caller is empty") ;
// rewards[user] = rewards[user].add(totalReward);
address[] memory supers = superiors[user];
uint256 leftReward = totalReward;
uint256 bonus0;
uint256 bonus1;
uint256 bonus2;
if(supers.length>0){
uint256 bonus = totalReward.mul(30).div(100);
rewards[supers[0]] = bonus;
// TransferHelper.safeTransfer(token,supers[0],bonus);
leftReward = leftReward.sub(bonus);
bonus0=bonus;
}
if(supers.length>1){
uint256 bonus = totalReward.mul(15).div(100);
rewards[supers[1]] = bonus;
// TransferHelper.safeTransfer(token,supers[1],bonus);
leftReward = leftReward.sub(bonus);
bonus1=bonus;
}
if(supers.length>2){
uint256 preReward = leftReward.div(supers.length.sub(2));
for(uint256 i=2;i<supers.length ;i++){
// TransferHelper.safeTransfer(token,supers[i],preReward);
rewards[supers[i]] = preReward;
leftReward = leftReward.sub(preReward);
}
bonus2=preReward;
}
if(leftReward>0){
// TransferHelper.safeTransfer(token,topAddr,leftReward);
rewards[topAddr] = leftReward;
}
return true;
}
}
contract TestRefs {
Refers public refs;
constructor(address _ref) public {
refs = Refers(_ref);
}
function testReward(uint256 amount) public {
refs.rewards2Super(msg.sender,amount);
}
}
contract DTrade is ManagerUpgradeable{
using SafeMath for uint256;
using SafeERC20 for ERC20;
mapping(address => mapping(address =>uint256 )) public uniswapLiquids;//(liquid.addr=>(user.address=>amount)
mapping(address => address) public liquidsMap;
mapping(address => uint256)public liquidPools;
mapping(address => uint256) public profits4DFK1;
mapping(address => uint256) public bonusWithdraw;
mapping(address => uint256) public checkpointHistory;
mapping(address => uint256) public joinTime;
address [] public liquidPairs;
uint256 public peroid_total_bonus = 90000*(10 **18);
uint256 public peroid_left_bonus = 0;
uint256 public bonus_per_block = 9*(10 **18);
uint256 public bonus_percent_LP = 10;
uint256 public checkpoint_number = 0;
// uint256 totalProfitDFK1 = 0;
uint256 public totalLiquids;
uint256 public totalMint;
DFKImplHelper public dfk1Helper;
uint256 public peroid_mined_coin = 0;
address public token1;
uint256 public totalFactor = 0;
address public liquidToken;
DFKII public dfkii;
constructor(address _token1,address []memory _mans) public ManagerUpgradeable(_mans){
token1 = _token1;
checkpoint_number = block.number+5*60;
bytes memory bytecode = type(DTradeLiquids).creationCode;
bytes32 salt = keccak256(abi.encodePacked(msg.sender, token1));
address _swapV2;
assembly {
_swapV2 := create2(0, add(bytecode, 32), mload(bytecode), salt)
}
liquidToken = _swapV2;
}
function setDFKII(address _dfkii) public onlyManager {
dfkii = DFKII(_dfkii);
}
function setDfk1Helper(address _dfk1Helper) public onlyManager {
dfk1Helper = DFKImplHelper(_dfk1Helper);
}
function nextPeroid(uint256 total,uint256 perblock,uint256 percentLP) public onlyManager {
totalMint = totalMint.add(peroid_total_bonus);
peroid_total_bonus = total;
bonus_per_block = perblock;
bonus_percent_LP = percentLP;
peroid_left_bonus = total;
peroid_mined_coin = 0;
checkpoint_number = block.number;
joinTime[address(0x0)] = block.number;
}
function addUniswapPair(address uniAddr,uint256 factor) public onlyManager {
if(liquidsMap[uniAddr]==address(0x0)){
uniswapLiquids[uniAddr][address(0x0)]=factor;
totalFactor = totalFactor.add(factor);
// uniswapLiquids[address(0x0)][address(0x0)] = uniswapLiquids[address(0x0)][address(0x0)].add(factor);
liquidsMap[uniAddr] = uniAddr;
liquidPairs.push(uniAddr);
}
}
function removeUniswapPair(address uniAddr) public onlyManager {
totalFactor = totalFactor.sub(uniswapLiquids[uniAddr][address(0x0)]);
uniswapLiquids[uniAddr][address(0x0)]=0;
}
function addDfkPair(address uniAddr,uint256 factor) public onlyManager {
if(liquidsMap[uniAddr]==address(0x0)){
uniswapLiquids[uniAddr][address(0x0)]=factor;
totalFactor = totalFactor.add(factor);
liquidsMap[uniAddr] = uniAddr;
liquidPairs.push(uniAddr);
}
}
function removeDfkPair(address uniAddr) public onlyManager {
totalFactor = totalFactor.sub(uniswapLiquids[uniAddr][address(0x0)]);
uniswapLiquids[uniAddr][address(0x0)]=0;
}
function addLiquid(address uniAddr,uint256 amountUL) public {
require(uniswapLiquids[uniAddr][address(0x0)]>0);//factor must large than zero
uint256 realBonus=calcBonus(msg.sender);
if(realBonus>0)
{
dfkii._mint(msg.sender,realBonus);
}
TransferHelper.safeTransferFrom(uniAddr,msg.sender,address(this),amountUL);
liquidPools[uniAddr] = liquidPools[uniAddr].add(amountUL);
uniswapLiquids[uniAddr][msg.sender]=uniswapLiquids[uniAddr][msg.sender].add(amountUL);
uint256 mine_liquid=amountUL.mul(uniswapLiquids[uniAddr][address(0x0)]);
// totalLiquids = totalLiquids.add(mine_liquid);
DTradeLiquids(liquidToken)._mint(msg.sender,mine_liquid);
joinTime[msg.sender] = block.number;
bonusWithdraw[msg.sender] = 0;
}
function removeLiquid(address uniAddr,uint256 amountUL) public {
require(uniswapLiquids[uniAddr][msg.sender]>=amountUL,'amountUL is not enough');
uint256 realBonus=calcBonus(msg.sender);
if(realBonus>0)
{
dfkii._mint(msg.sender,realBonus);
}
TransferHelper.safeTransfer(address(uniAddr),msg.sender,amountUL);
uint256 mine_liquid=amountUL.mul(uniswapLiquids[uniAddr][address(0x0)]);
DTradeLiquids(liquidToken)._burn(msg.sender,mine_liquid);
uniswapLiquids[uniAddr][msg.sender]=uniswapLiquids[un...
// [truncated — 54061 bytes total]
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
changeReqs 0x70460299 → address, address
decimals 0x313ce567 → uint8
managers 0xfdff9b4d → address
mancount 0x273a5061 → uint256
name 0x06fdde03 → string
requestCount 0x5badbe4c → uint256
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 13 functions
These functions modify contract state and require a wallet transaction to execute.
_burn 0x6161eb18
address from
uint256 value
_mint 0x4e6ec247
address to
uint256 value
approve 0x095ea7b3
address agent
uint256 value
returns: bool
confirmChange 0xbeda2483
bytes32 _lockId
decreaseApproval 0x66188463
address agent
uint256 value
returns: bool
increaseApproval 0xd73dd623
address agent
uint256 value
returns: bool
replaceManager 0x01d8715f
address _new
address _clear
requestChange 0xdc3237be
address _new
address _clear
returns: bytes32
sweepChange 0xf4b05cb1
bytes32 _lockId
sweepeth 0x151754e0
uint256 amount
sweeptoken 0x9a85448b
address tokenaddr
uint256 amount
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
Recent Transactions
No transactions found for this address