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.22;
interface ILayerZeroEndpointV2 {
struct Origin {
uint32 srcEid;
bytes32 sender;
uint64 nonce;
}
}
contract TestPresaleETH {
address public lzEndpoint;
address public owner;
mapping(address => uint) public allocations;
event TokensAllocated(address buyer, uint amount);
constructor() {
lzEndpoint = 0x1a44076050125825900e736c501f859c50fE728c;
owner = msg.sender;
}
// LayerZero callback
function lzReceive(
ILayerZeroEndpointV2.Origin calldata _origin,
bytes32 _guid,
bytes calldata _message,
address _executor,
bytes calldata _extraData
) external payable {
require(msg.sender == lzEndpoint, "Only endpoint");
(address buyer, uint amount) = abi.decode(_message, (address, uint));
allocations[buyer] += amount;
emit TokensAllocated(buyer, amount);
}
function checkAllocation(address user) external view returns (uint) {
return allocations[user];
}
}
Submitted on: 2025-10-12 18:45:58
Comments
Log in to comment.
No comments yet.