AdilScan
Blocks
Blocks
Uncles
Forked Blocks (Reorgs)
Transactions
Validated
Pending
Cancel transaction
Tokens
All
ADIL Addresses
APIs
GraphQL
RPC
Eth RPC
Apps
Faucet Testnet
Adil chain
Mainnets
Testnets
Other Networks
Validators
Validators
Punished Validators
Proposal
/
Search
/
Search
Connection Lost
New Vyper Smart Contract Verification
Contract Address
The 0x address supplied on contract creation.
Contract Name
Must match the name specified in the code.
Compiler
latest
v0.4.3rc1
v0.4.2rc1
v0.4.1rc3
v0.4.1rc2
v0.4.1rc1
v0.4.1b4
v0.4.1b3
v0.4.1b2
v0.4.1b1
v0.4.0rc6
v0.4.0rc5
v0.4.0rc4
v0.4.0rc3
v0.4.0rc2
v0.4.0rc1
v0.4.0b6
v0.4.0b5
v0.4.0b4
v0.4.0b3
v0.4.0b2
v0.4.0b1
v0.3.10rc5
v0.3.10rc4
v0.3.10rc3
v0.3.10rc2
v0.3.10
v0.4.3
v0.4.2
v0.4.1
v0.4.0
Enter the Vyper Contract Code
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IERC20Token.sol"; import "./libraries/OwnableUpgradeable.sol"; import "./libraries/TransferHelper.sol"; import "./libraries/VerifySignature.sol"; contract DHPBonusClaimPool is OwnerOperator, VerifySignature { address public tokenAddress; address public signerAddress; string public MESSAGE_HASH; mapping(uint8 => uint256) public totalClaimedAmount; mapping(uint8 => mapping(string => uint256)) public userClaimedAmount; event ClaimedBonus( address indexed sender, uint8 typeId, string id, uint256 maxAmount, uint256 amount, uint256 timestamp, bytes signature, uint256 userClaimed ); function init(address _tokenAddress, address _signerAddress, string memory _messageHash) public initializer { super.initialize(); tokenAddress = _tokenAddress; signerAddress = _signerAddress; MESSAGE_HASH = _messageHash; } function claimBonus( uint8 _typeId, string memory _id, uint256 _maxAmount, uint256 _amount, uint256 _timestamp, bytes memory _signature ) external { address sender = msg.sender; bytes memory encodedData = abi.encodePacked(sender, _typeId, _id, _maxAmount, _amount, _timestamp, MESSAGE_HASH); bool isValid = verify(signerAddress, encodedData, _signature); require(_amount > 0, "DHPBonusClaimPool: Invalid amount"); require(isValid, "DHPBonusClaimPool: Invalid signature"); require((userClaimedAmount[_typeId][_id] + _amount) <= _maxAmount, "DHPBonusClaimPool: Amount exceeded limit"); uint256 poolBalance = IERC20Token(tokenAddress).balanceOf(address(this)); require(poolBalance >= _amount, "DHPBonusClaimPool: Insufficient pool balance"); userClaimedAmount[_typeId][_id] += _amount; totalClaimedAmount[_typeId]+= _amount; uint256 userClaimed = userClaimedAmount[_typeId][_id]; TransferHelper.safeTransfer(tokenAddress, sender, _amount); emit ClaimedBonus(sender, _typeId, _id, _maxAmount, _amount, _timestamp, _signature, userClaimed); } function withdraw(uint256 _amount) external operatorOrOwner { require(IERC20Token(tokenAddress).balanceOf(address(this)) >= _amount, "DHPBonusClaimPool: Insufficient balance"); TransferHelper.safeTransfer(tokenAddress, msg.sender, _amount); } function setTokenAddress(address _tokenAddress) external operatorOrOwner { tokenAddress = _tokenAddress; } function setUserClaimedAmount(uint8 _typeId, string memory _id, uint256 _amount) external operatorOrOwner { userClaimedAmount[_typeId][_id] = _amount; } function setTotalClaimedAmount(uint8 _typeId, uint256 _amount) external operatorOrOwner { totalClaimedAmount[_typeId] = _amount; } function setSignerAddress(address _signerAddress) external operatorOrOwner { signerAddress = _signerAddress; } }
ABI-encoded Constructor Arguments (if required by the contract)
Add arguments in
ABI hex encoded form
. Constructor arguments are written right to left, and will be found at the end of the input created bytecode. They may also be
parsed here.
Loading...
Verify & publish
Cancel
Ok
Ok
Ok
No
Yes