Airdropper Docs
Search…
πŸ“„
Airdropper Contract

Contract roles:

Role
Description
DEPLOYER_ROLE (onlyDeployer)
Deployer is the address used to deploy the airdrop contract with a specified ERC20 token
OWNER_ROLE (onlyOwner)
Deployer is the hot wallet address of airdropper.xyz

Owner

0xtodo
Hot wallet address controlled by airdropper.xyz multisignature contract

Variables

token - ERC20

1
ERC20 public token;
Copied!
The ERC20 token linked to the contract in order to be dropped.

dropAmount - uint256

1
uint256 public dropAmount;
Copied!
The total amount of tokens that can be claimed.

dropCount - uint

1
uint public dropCount;
Copied!
The number of addresses that claimed the airdrop.

active - bool

1
bool public active;
Copied!
Boolean that represents the state of the airdrop.

Public Functions

getAirdrop() - Public

1
function getAirdrop() public {
2
// requirements
3
require(active, "Airdrop is not activated.");
4
require(hasClaimed[msg.sender] == false, "Only one airdrop is authorized.");
5
​
6
// Change contract stats
7
hasClaimed[msg.sender] = true;
8
dropCount += 1;
9
droppedAddresses.push(msg.sender);
10
​
11
// Get the airdrop
12
token.transfer(msg.sender, dropAmount);
13
}
Copied!
Everyone can call this function to claim the airdrop and receive the specified amount of tokens.
​
⚠
Note:
  • The function is available only if the DEPLOYER_ROLE activated the airdrop.
  • You can only call it once with your address! Any futher attempts will result in a failed transaction.
​

getAddresses() - Public

1
function getAddresses() public view returns (address[] memory){
2
return droppedAddresses;
3
}
Copied!
Everyone can call this function to see who benefited from the airdrop.
​

tokenAmountLeft() - Public

1
function tokenAmountLeft() public view returns (uint256){
2
return token.balanceOf(address(this));
3
}
Copied!
Everyone can call this function to see the amount of tokens left in the contract.
​

Owner Functions

setDropAmount() - onlyDeployer or onlyOwner

1
function setDropAmount(uint256 _dropAmount){
2
require(isAuthorized(msg.sender), "DOES_NOT_HAVE_PERMISSION");
3
dropAmount = _dropAmount * 10 ** tokenDecimal;
4
}
Copied!
Only the DEPLOYER_ROLE or the OWNER_ROLE can call this function to disable the contract and the getAirdrop() function.
​

enableAirdrop() - onlyDeployer or onlyOwner

1
function enableAirdrop() external{
2
require(isAuthorized(msg.sender), "DOES_NOT_HAVE_PERMISSION");
3
active = true;
4
}
Copied!
Only the DEPLOYER_ROLE or the OWNER_ROLE can call this function to activate the contract and allow the getAirdrop() function to work.
​

disableAirdrop() - onlyDeployer or onlyOwner

1
function disableAirdrop() external{
2
require(isAuthorized(msg.sender), "DOES_NOT_HAVE_PERMISSION");
3
active = false;
4
}
Copied!
Only the DEPLOYER_ROLE or the OWNER_ROLE can call this function to disable the contract and the getAirdrop() function.
​