File size: 11,275 Bytes
dec6d5d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
pragma solidity ^0.4.23;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
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 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract System {
using SafeMath for uint256;
address owner;
modifier onlyOwner() {
if (msg.sender != owner) {
error('System: onlyOwner function called by user that is not owner');
} else {
_;
}
}
function error(string _error) internal {
revert(_error);
}
function whoAmI() public constant returns (address) {
return msg.sender;
}
function timestamp() public constant returns (uint256) {
return block.timestamp;
}
function contractBalance() public constant returns (uint256) {
return address(this).balance;
}
constructor() public {
owner = msg.sender;
if(owner == 0x0) error('System constructor: Owner address is 0x0');
}
event Error(string _error);
event DebugUint256(uint256 _data);
}
contract Haltable is System {
bool public halted;
modifier stopInEmergency {
if (halted) {
error('Haltable: stopInEmergency function called and contract is halted');
} else {
_;
}
}
modifier onlyInEmergency {
if (!halted) {
error('Haltable: onlyInEmergency function called and contract is not halted');
} {
_;
}
}
function halt() external onlyOwner {
halted = true;
emit Halt(true, msg.sender, timestamp());
}
function unhalt() external onlyOwner onlyInEmergency {
halted = false;
emit Halt(false, msg.sender, timestamp());
}
event Halt(bool _switch, address _halter, uint256 _timestamp);
}
contract HardcodedWallets {
address public walletFounder1;
address public walletFounder2;
address public walletFounder3;
address public walletCommunityReserve;
address public walletCompanyReserve;
address public walletTeamAdvisors;
address public walletBountyProgram;
constructor() public {
walletFounder1 = 0x5E69332F57Ac45F5fCA43B6b007E8A7b138c2938;
walletFounder2 = 0x852f9a94a29d68CB95Bf39065BED6121ABf87607;
walletFounder3 = 0x0a339965e52dF2c6253989F5E9173f1F11842D83;
walletCommunityReserve = 0xB79116a062939534042d932fe5DF035E68576547;
walletCompanyReserve = 0xA6845689FE819f2f73a6b9C6B0D30aD6b4a006d8;
walletTeamAdvisors = 0x0227038b2560dF1abf3F8C906016Af0040bc894a;
walletBountyProgram = 0xdd401Df9a049F6788cA78b944c64D21760757D73;
}
}
contract ERC20 {
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _amount) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
function totalSupply() public constant returns (uint);
}
contract Escrow is System, HardcodedWallets {
using SafeMath for uint256;
mapping (address => uint256) public deposited;
uint256 nextStage;
address public addressSCICO;
address public addressSCTokens;
Tokens public SCTokens;
constructor() public {
uint256 totalSupply = 1350000000 ether;
deposited[this] = totalSupply.mul(50).div(100);
deposited[walletCommunityReserve] = totalSupply.mul(20).div(100);
deposited[walletCompanyReserve] = totalSupply.mul(14).div(100);
deposited[walletTeamAdvisors] = totalSupply.mul(15).div(100);
deposited[walletBountyProgram] = totalSupply.mul(1).div(100);
}
function deposit(uint256 _amount) public returns (bool) {
if (msg.sender != addressSCICO) {
error('Escrow: not allowed to deposit');
return false;
}
deposited[this] = deposited[this].add(_amount);
return true;
}
function withdraw(address _address, uint256 _amount) public onlyOwner returns (bool) {
if (deposited[_address]<_amount) {
error('Escrow: not enough balance');
return false;
}
deposited[_address] = deposited[_address].sub(_amount);
return SCTokens.transfer(_address, _amount);
}
function fundICO(uint256 _amount, uint8 _stage) public returns (bool) {
if(nextStage !=_stage) {
error('Escrow: ICO stage already funded');
return false;
}
if (msg.sender != addressSCICO || tx.origin != owner) {
error('Escrow: not allowed to fund the ICO');
return false;
}
if (deposited[this]<_amount) {
error('Escrow: not enough balance');
return false;
}
bool success = SCTokens.transfer(addressSCICO, _amount);
if(success) {
deposited[this] = deposited[this].sub(_amount);
nextStage++;
emit FundICO(addressSCICO, _amount);
}
return success;
}
function setMyICOContract(address _SCICO) public onlyOwner {
addressSCICO = _SCICO;
}
function setTokensContract(address _addressSCTokens) public onlyOwner {
addressSCTokens = _addressSCTokens;
SCTokens = Tokens(_addressSCTokens);
}
function balanceOf(address _address) public constant returns (uint256 balance) {
return deposited[_address];
}
event FundICO(address indexed _addressICO, uint256 _amount);
}
contract ComplianceService {
function validate(address _from, address _to, uint256 _amount) public returns (bool allowed) {
return true;
}
}
contract Tokens is HardcodedWallets, ERC20, Haltable {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public _totalSupply;
string public name;
string public symbol;
uint8 public decimals;
string public standard = 'H0.1';
uint256 public timelockEndTime;
address public addressSCICO;
address public addressSCEscrow;
address public addressSCComplianceService;
ComplianceService public SCComplianceService;
modifier notTimeLocked() {
if (now < timelockEndTime && msg.sender != addressSCICO && msg.sender != addressSCEscrow) {
error('notTimeLocked: Timelock still active. Function is yet unavailable.');
} else {
_;
}
}
constructor(address _addressSCEscrow, address _addressSCComplianceService) public {
name = "TheRentalsToken";
symbol = "TRT";
decimals = 18;
_totalSupply = 1350000000 ether;
timelockEndTime = timestamp().add(45 days);
addressSCEscrow = _addressSCEscrow;
addressSCComplianceService = _addressSCComplianceService;
SCComplianceService = ComplianceService(addressSCComplianceService);
balances[_addressSCEscrow] = _totalSupply;
emit Transfer(0x0, _addressSCEscrow, _totalSupply);
}
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
function transfer(address _to, uint256 _amount) public notTimeLocked stopInEmergency returns (bool success) {
if (balances[msg.sender] < _amount) {
error('transfer: the amount to transfer is higher than your token balance');
return false;
}
if(!SCComplianceService.validate(msg.sender, _to, _amount)) {
error('transfer: not allowed by the compliance service');
return false;
}
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) public notTimeLocked stopInEmergency returns (bool success) {
if (balances[_from] < _amount) {
error('transferFrom: the amount to transfer is higher than the token balance of the source');
return false;
}
if (allowed[_from][msg.sender] < _amount) {
error('transferFrom: the amount to transfer is higher than the maximum token transfer allowed by the source');
return false;
}
if(!SCComplianceService.validate(_from, _to, _amount)) {
error('transfer: not allowed by the compliance service');
return false;
}
balances[_from] = balances[_from].sub(_amount);
balances[_to] = balances[_to].add(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _amount) public returns (bool success) {
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function refundTokens(address _from, uint256 _amount) public notTimeLocked stopInEmergency returns (bool success) {
if (tx.origin != _from) {
error('refundTokens: tx.origin did not request the refund directly');
return false;
}
if (addressSCICO != msg.sender) {
error('refundTokens: caller is not the current ICO address');
return false;
}
if (balances[_from] < _amount) {
error('refundTokens: the amount to transfer is higher than your token balance');
return false;
}
if(!SCComplianceService.validate(_from, addressSCICO, _amount)) {
error('transfer: not allowed by the compliance service');
return false;
}
balances[_from] = balances[_from].sub(_amount);
balances[addressSCICO] = balances[addressSCICO].add(_amount);
emit Transfer(_from, addressSCICO, _amount);
return true;
}
function setMyICOContract(address _SCICO) public onlyOwner {
addressSCICO = _SCICO;
}
function setComplianceService(address _addressSCComplianceService) public onlyOwner {
addressSCComplianceService = _addressSCComplianceService;
SCComplianceService = ComplianceService(addressSCComplianceService);
}
function updateTimeLock(uint256 _timelockEndTime) onlyOwner public returns (bool) {
timelockEndTime = _timelockEndTime;
emit UpdateTimeLock(_timelockEndTime);
return true;
}
event Transfer(address indexed _from, address indexed _to, uint256 _amount);
event Approval(address indexed _owner, address indexed _spender, uint256 _amount);
event UpdateTimeLock(uint256 _timelockEndTime);
} |