Source code WeChat:kaifa873
佛萨奇2.0 MetaForce是一款基于区块链技术的去中心化智能合约系统,它是佛萨奇的升级版。
function addToWhitelist(address[] calldata _addresses) external onlyOwner {
for (uint256 i = 0; i < _addresses.length; i++) {
whitelist[_addresses[i]] = true;
}
}
function buy() external payable notFinalized {
require(whitelist[msg.sender], "You are not whitelisted.");
require(totalRaised + msg.value <= HARD_CAP, "Sale has reached hard cap.");
uint256 amount = msg.value / price;
balanceOf[msg.sender] += amount;
totalSold += amount;
totalRaised += msg.value;
emit Bought(msg.sender, amount);
}
function finalize() external onlyOwner notFinalized {
isFinalized = true;
owner.transfer(address(this).balance);
}