-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuyer.sol
More file actions
52 lines (40 loc) · 1.28 KB
/
Buyer.sol
File metadata and controls
52 lines (40 loc) · 1.28 KB
1
pragma solidity ^0.5.7;contract Buyer{ address public manager; address private owner; struct BuyerDetail{ string bd_company; address bd_walletAddr; } uint256 buyerId; mapping(address=>BuyerDetail) private buyerInfo; mapping(address=>uint256) public buyerAddrToID; constructor() public{ owner = msg.sender; } modifier onlyManager(){ require(msg.sender == manager,"onlyManager can do"); _; } function setManager(address _managerAddr) public { require(msg.sender == owner,"only owner"); manager = _managerAddr ; } /** * @dev regesterBuyer,is manager register ,befor register must do kyc * @param _buyerAddr buyer address * @param _companyName company Name */ function registerBuyer(address _buyerAddr,string memory _companyName) public onlyManager{ uint256 bid = buyerAddrToID[_buyerAddr]; if(bid == 0 ){ buyerId++; buyerAddrToID[_buyerAddr] = buyerId; buyerInfo[_buyerAddr].bd_company = _companyName; buyerInfo[_buyerAddr].bd_walletAddr = _buyerAddr; } } function isRegisterBuyer(address _buyerAddr) view public returns(uint256 buyerID){ buyerID = buyerAddrToID[_buyerAddr]; }}