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 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
}
interface IERC721 {
function ownerOf(uint256 tokenId) external view returns (address);
}
contract OraclyxClaim {
IERC20 public immutable orx;
IERC721 public immutable nft;
address public owner;
uint256 public constant AMOUNT_PER_NFT = 1000000000; // 10,000 * 10^8 (8 decimais)
mapping(uint256 => bool) public claimed;
event Claimed(address indexed claimer, uint256 indexed tokenId, uint256 amount);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
constructor(address _orx, address _nft) {
require(_orx != address(0) && _nft != address(0), "zero addr");
orx = IERC20(_orx);
nft = IERC721(_nft);
owner = msg.sender;
}
function claim(uint256 tokenId) external {
require(!claimed[tokenId], "Already claimed");
require(nft.ownerOf(tokenId) == msg.sender, "Not NFT owner");
claimed[tokenId] = true;
require(orx.transfer(msg.sender, AMOUNT_PER_NFT), "Transfer failed");
emit Claimed(msg.sender, tokenId, AMOUNT_PER_NFT);
}
// Caso sobre saldo após o período de claim
function withdrawRemaining(address to) external onlyOwner {
require(to != address(0), "zero");
uint256 bal = orx.balanceOf(address(this));
require(orx.transfer(to, bal), "Withdraw failed");
}
}
Submitted on: 2025-11-04 19:54:48
Comments
Log in to comment.
No comments yet.