Skip to content
Verified contractPartial

BRPerSellControl

Address0x3612d93f91c8fdb5f158a7c35dd7f87c63ad3f9b
Balance

2.2176 ETH

 

Transactions

16

 

Compiler

solc 0.4.24

 

Same code

Only this contract

 

Details

Compiler
solc 0.4.24+commit.e67f0147
Language
solidity
Optimization
Yes, 200 runs
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
6,239,383
Creation transaction
0xddf99a91d9…2cc9110ef4

BRPerSellControl.sol

pragma solidity ^0.4.7;
contract MobaBase {
    address public owner = 0x0;
    bool public isLock = false;
    constructor ()  public  {
        owner = msg.sender;
    }
    
    event transferToOwnerEvent(uint256 price);
    
    modifier onlyOwner {
        require(msg.sender == owner,"only owner can call this function");
        _;
    }
    
    modifier notLock {
        require(isLock == false,"contract current is lock status");
        _;
    }
    
    modifier msgSendFilter() {
        address addr = msg.sender;
        uint size;
        assembly { size := extcodesize(addr) }
        require(size <= 0,"address must is not contract");
        require(msg.sender == tx.origin, "msg.sender must equipt tx.origin");
        _;
    }
    
    function transferOwnership(address newOwner) onlyOwner public {
        if (newOwner != address(0)) {
            owner = newOwner;
        }
    }
    
    function transferToOwner()    
    onlyOwner 
    msgSendFilter 
    public {
        uint256 totalBalace = address(this).balance;
        owner.transfer(totalBalace);
        emit transferToOwnerEvent(totalBalace);
    }
    
    function updateLock(bool b) onlyOwner public {
        
        require(isLock != b," updateLock new status == old status");
        isLock = b;
    }
    
   
}

contract IBRInviteData {
    function GetAddressByName(bytes32 name) public view returns (address);
}
contract IBRPerSellData {
   function GetPerSellInfo(uint16 id) public view returns (uint16,uint256 price,bool isOver);
}

contract BRPerSellControl is MobaBase {
    
    IBRInviteData public mInviteAddr;
    IBRPerSellData public mPerSellData;
    mapping (address => uint16[]) public mBuyList;

    event updateIntefaceEvent();
    event transferToOwnerEvent(uint256 price);
    event buyPerSellEvent(uint16 perSellId,bytes32 name,uint256 price);
    constructor(address inviteData, address perSellData) public {
        mInviteAddr  = IBRInviteData(inviteData);
        mPerSellData = IBRPerSellData(perSellData);
    }
    
    function updateInteface(address inviteData, address perSellData) 
    onlyOwner 
    msgSendFilter 
    public {
        mInviteAddr  = IBRInviteData(inviteData);
        mPerSellData = IBRPerSellData(perSellData);
        emit updateIntefaceEvent();
    }
    
    function GetPerSellInfo(uint16 id) public view returns (uint16 pesellId,uint256 price,bool isOver) {
        return mPerSellData.GetPerSellInfo(id);
    }
    
    function buyPerSell(uint16 perSellId,bytes32 name) 
    notLock
    msgSendFilter 
    payable public {
        uint16 id; uint256 price; bool isOver;
        (id,price,isOver) = mPerSellData.GetPerSellInfo(perSellId);
        require(id == perSellId && id > 0,"perSell.Id is error"  );
        require(msg.value == price,"msg.value is error");
        require(isOver == false,"persell is over status");
        
        address inviteAddr = mInviteAddr.GetAddressByName(name);
        if(inviteAddr != address(0)) {
           uint giveToEth   = msg.value * 10 / 100;
           inviteAddr.transfer(giveToEth);
        }
        mBuyList[msg.sender].push(id);
        emit buyPerSellEvent(perSellId,name,price);
    }
    
    function getBuyInfo(address addr) public view returns (uint16[]){
        return mBuyList[addr];
    }
    

}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.