Description:
Smart contract deployed on Ethereum.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function balanceOf(address account) external view returns (uint256);
}
contract ArgentPulsePresale {
IERC20 public token;
address public owner;
uint256 public rate = 100000; // 1 ETH = 100,000 ARGP
uint256 public tokensSold;
uint256 public maxTokens = 10_000_000 * 1e18; // максимум 10 млн ARGP
uint256 public endTime; // дедлайн
event TokensPurchased(address indexed buyer, uint256 amountETH, uint256 amountTokens);
event Withdraw(address indexed to, uint256 amountETH);
constructor(address _token, uint256 _endTime) {
token = IERC20(_token);
owner = msg.sender;
endTime = _endTime;
}
function buyTokens() public payable {
require(block.timestamp < endTime, "Presale ended");
require(msg.value > 0, "Send ETH to buy tokens");
uint256 tokens = msg.value * rate;
require(tokensSold + tokens <= maxTokens, "Presale sold out");
tokensSold += tokens;
require(token.transfer(msg.sender, tokens), "Transfer failed");
emit TokensPurchased(msg.sender, msg.value, tokens);
}
function withdrawETH(address payable _to) public {
require(msg.sender == owner, "Not owner");
_to.transfer(address(this).balance);
}
}
Submitted on: 2025-10-03 09:21:52
Comments
Log in to comment.
No comments yet.