ETH Price: $2,328.96 (-6.22%)

Contract

0xC0d3A72eDC15B4DF241A49C374DD9ecD062655B0
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw58627382018-06-27 10:29:362436 days ago1530095376IN
0xC0d3A72e...D062655B0
0 ETH0.00004372
Prepurchase58622952018-06-27 8:36:452436 days ago1530088605IN
0xC0d3A72e...D062655B0
0.99 ETH0.000258481.2
Prepurchase58564442018-06-26 8:17:052437 days ago1530001025IN
0xC0d3A72e...D062655B0
0.99 ETH0.000981614
Prepurchase58510362018-06-25 9:28:112438 days ago1529918891IN
0xC0d3A72e...D062655B0
0.99 ETH0.0049080820
Set Game Config ...58293572018-06-21 16:20:102442 days ago1529598010IN
0xC0d3A72e...D062655B0
0 ETH0.000057142
Set Captain Toke...58286032018-06-21 13:23:362442 days ago1529587416IN
0xC0d3A72e...D062655B0
0 ETH0.000174374
Set Game Config ...58285992018-06-21 13:21:372442 days ago1529587297IN
0xC0d3A72e...D062655B0
0 ETH0.000174284

Latest 3 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
58622952018-06-27 8:36:452436 days ago1530088605
0xC0d3A72e...D062655B0
0.99 ETH
58564442018-06-26 8:17:052437 days ago1530001025
0xC0d3A72e...D062655B0
0.99 ETH
58510362018-06-25 9:28:112438 days ago1529918891
0xC0d3A72e...D062655B0
0.99 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CaptainSell

Compiler Version
v0.4.21+commit.dfe3193c

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2018-06-21
*/

pragma solidity ^0.4.18;
/* ==================================================================== */
/* Copyright (c) 2018 The Priate Conquest Project.  All rights reserved.
/* 
/* https://www.pirateconquest.com One of the world's slg games of blockchain 
/*  
/* authors [email protected]/[email protected]
/*                 
/* ==================================================================== */
interface CaptainTokenInterface {
  function CreateCaptainToken(address _owner,uint256 _price, uint32 _captainId, uint32 _color,uint32 _atk, uint32 _defense,uint32 _level,uint256 _exp) public;
}

interface CaptainGameConfigInterface {
  function getCardInfo(uint32 cardId) external constant returns (uint32,uint32,uint32, uint32,uint32,uint256,uint256);
  function getSellable(uint32 _captainId) external returns (bool);
}
contract CaptainSell {

  address devAddress;
  function CaptainSell() public {
    devAddress = msg.sender;
  }

  CaptainTokenInterface public captains;
  CaptainGameConfigInterface public config; 
  /// @dev The BuyToken event is fired whenever a token is sold.
  event BuyToken(uint256 tokenId, uint256 oldPrice, address prevOwner, address winner);
  
  //mapping
  mapping(uint32 => uint256) captainToCount; 
  /// @notice No tipping!
  /// @dev Reject all Ether from being sent here, unless it's from one of the
  ///  two auction contracts. (Hopefully, we can prevent user accidents.)
  function() external payable {
  }

  modifier onlyOwner() {
    require(msg.sender == devAddress);
    _;
  }

  //setting configuration
  function setGameConfigContract(address _address) external onlyOwner {
    config = CaptainGameConfigInterface(_address);
  }

  //setting configuration
  function setCaptainTokenContract(address _address) external onlyOwner {
    captains = CaptainTokenInterface(_address);
  }


  function prepurchase(uint32 _captainId) external payable {
    uint32 color;
    uint32 atk;
    uint32 defense;
    uint256 price;
    uint256 captainCount;
    uint256 SellCount = captainToCount[_captainId];
    (color,atk,,,defense,price,captainCount) = config.getCardInfo(_captainId);
    require(config.getSellable(_captainId) == true);
    SellCount += 1;
    require(SellCount<=captainCount);

    // Safety check to prevent against an unexpected 0x0 default.
    require(msg.sender != address(0));
    
    // Making sure sent amount is greater than or equal to the sellingPrice
    require(msg.value >= price);
    captains.CreateCaptainToken(msg.sender,price,_captainId,color,atk, defense,1,0);
    captainToCount[_captainId] = SellCount;

    //transfer
    devAddress.transfer(msg.value);
    //event 
    BuyToken(_captainId, price,address(this),msg.sender);
  }

  function getCaptainCount(uint32 _captainId) external constant returns (uint256) {
    return captainToCount[_captainId];
  }

  //@notice withraw all by dev
  function withdraw() external onlyOwner {
    require(this.balance>0);
    msg.sender.transfer(this.balance);
  }

}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"setGameConfigContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"setCaptainTokenContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_captainId","type":"uint32"}],"name":"prepurchase","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"captains","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"config","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_captainId","type":"uint32"}],"name":"getCaptainCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"oldPrice","type":"uint256"},{"indexed":false,"name":"prevOwner","type":"address"},{"indexed":false,"name":"winner","type":"address"}],"name":"BuyToken","type":"event"}]

6060604052341561000f57600080fd5b60008054600160a060020a033316600160a060020a031990911617905561055f8061003b6000396000f3006060604052600436106100695763ffffffff60e060020a60003504166308227acb811461006b5780631bbec9871461008a5780632e7db440146100a95780633c6b9d8c146100ba5780633ccfd60b146100e957806379502c55146100fc578063aebad3a41461010f575b005b341561007657600080fd5b610069600160a060020a036004351661013d565b341561009557600080fd5b610069600160a060020a0360043516610187565b61006963ffffffff600435166101d1565b34156100c557600080fd5b6100cd61048c565b604051600160a060020a03909116815260200160405180910390f35b34156100f457600080fd5b61006961049b565b341561010757600080fd5b6100cd61050c565b341561011a57600080fd5b61012b63ffffffff6004351661051b565b60405190815260200160405180910390f35b60005433600160a060020a0390811691161461015857600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a039081169116146101a257600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b63ffffffff8116600090815260036020526040808220546002548392839283928392600160a060020a0390911690631b8bd57c9089905163ffffffff83811660e060020a02825291909116600482015260240160e060405180830381600087803b151561023d57600080fd5b5af1151561024a57600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051906020018051600254979d50959b50919950975092955050600160a060020a03909216915063732519d590508860405163ffffffff83811660e060020a028252919091166004820152602401602060405180830381600087803b15156102d557600080fd5b5af115156102e257600080fd5b5050506040518051151560011490506102fa57600080fd5b6001018181111561030a57600080fd5b33600160a060020a0316151561031f57600080fd5b348390101561032d57600080fd5b60018054600160a060020a031690636aaacb3f90339086908b908b908b908b90600060405163ffffffff8a811660e060020a028252600160a060020a039990991660048201526024810197909752948716604487015292861660648601529085166084850152841660a484015290921660c482015260e481019190915261010401600060405180830381600087803b15156103c757600080fd5b5af115156103d457600080fd5b50505063ffffffff87166000908152600360205260408082208390559054600160a060020a0316903480156108fc029151600060405180830381858888f19350505050151561042257600080fd5b7f4141150ed7d16fb9ef7d804930ab30a68ccbd8e90eb05c54f3c0f36d1f2107898784303360405163ffffffff90941684526020840192909252600160a060020a03908116604080850191909152911660608301526080909101905180910390a150505050505050565b600154600160a060020a031681565b60005433600160a060020a039081169116146104b657600080fd5b6000600160a060020a03301631116104cd57600080fd5b33600160a060020a03166108fc30600160a060020a0316319081150290604051600060405180830381858888f19350505050151561050a57600080fd5b565b600254600160a060020a031681565b63ffffffff16600090815260036020526040902054905600a165627a7a72305820ead8210ab49852c2ed9d7ff091b5a047f7a015dab2bc950a7a4897bcd407a6860029

Deployed Bytecode

0x6060604052600436106100695763ffffffff60e060020a60003504166308227acb811461006b5780631bbec9871461008a5780632e7db440146100a95780633c6b9d8c146100ba5780633ccfd60b146100e957806379502c55146100fc578063aebad3a41461010f575b005b341561007657600080fd5b610069600160a060020a036004351661013d565b341561009557600080fd5b610069600160a060020a0360043516610187565b61006963ffffffff600435166101d1565b34156100c557600080fd5b6100cd61048c565b604051600160a060020a03909116815260200160405180910390f35b34156100f457600080fd5b61006961049b565b341561010757600080fd5b6100cd61050c565b341561011a57600080fd5b61012b63ffffffff6004351661051b565b60405190815260200160405180910390f35b60005433600160a060020a0390811691161461015857600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a039081169116146101a257600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b63ffffffff8116600090815260036020526040808220546002548392839283928392600160a060020a0390911690631b8bd57c9089905163ffffffff83811660e060020a02825291909116600482015260240160e060405180830381600087803b151561023d57600080fd5b5af1151561024a57600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051906020018051600254979d50959b50919950975092955050600160a060020a03909216915063732519d590508860405163ffffffff83811660e060020a028252919091166004820152602401602060405180830381600087803b15156102d557600080fd5b5af115156102e257600080fd5b5050506040518051151560011490506102fa57600080fd5b6001018181111561030a57600080fd5b33600160a060020a0316151561031f57600080fd5b348390101561032d57600080fd5b60018054600160a060020a031690636aaacb3f90339086908b908b908b908b90600060405163ffffffff8a811660e060020a028252600160a060020a039990991660048201526024810197909752948716604487015292861660648601529085166084850152841660a484015290921660c482015260e481019190915261010401600060405180830381600087803b15156103c757600080fd5b5af115156103d457600080fd5b50505063ffffffff87166000908152600360205260408082208390559054600160a060020a0316903480156108fc029151600060405180830381858888f19350505050151561042257600080fd5b7f4141150ed7d16fb9ef7d804930ab30a68ccbd8e90eb05c54f3c0f36d1f2107898784303360405163ffffffff90941684526020840192909252600160a060020a03908116604080850191909152911660608301526080909101905180910390a150505050505050565b600154600160a060020a031681565b60005433600160a060020a039081169116146104b657600080fd5b6000600160a060020a03301631116104cd57600080fd5b33600160a060020a03166108fc30600160a060020a0316319081150290604051600060405180830381858888f19350505050151561050a57600080fd5b565b600254600160a060020a031681565b63ffffffff16600090815260036020526040902054905600a165627a7a72305820ead8210ab49852c2ed9d7ff091b5a047f7a015dab2bc950a7a4897bcd407a6860029

Swarm Source

bzzr://ead8210ab49852c2ed9d7ff091b5a047f7a015dab2bc950a7a4897bcd407a686

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.