Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit 61c751a

Browse files
author
Sukhveer Sanghera
authored
Increase airdrop throughput
1 parent 4474c40 commit 61c751a

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

Diff for: contracts/PolyDistribution.sol

+38-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ contract PolyDistribution is Ownable {
4141
uint256 amountClaimed; // Total tokens claimed
4242
}
4343
mapping (address => Allocation) public allocations;
44+
45+
mapping (address => bool) public airdropAdmins;
46+
47+
mapping (address => bool) public airdrops;
48+
49+
modifier onlyOwnerOrAdmin() {
50+
require(msg.sender == owner || airdropAdmins[msg.sender]);
51+
_;
52+
}
4453

4554
event LogNewAllocation(address indexed _recipient, AllocationType indexed _fromSupply, uint256 _totalAllocated, uint256 _grandTotalAllocated);
4655
event LogPolyClaimed(address indexed _recipient, uint8 indexed _fromSupply, uint256 _amountClaimed, uint256 _totalAllocated, uint256 _grandTotalClaimed);
@@ -72,9 +81,6 @@ contract PolyDistribution is Ownable {
7281
} else if (_supply == AllocationType.FOUNDER) {
7382
AVAILABLE_FOUNDER_SUPPLY = AVAILABLE_FOUNDER_SUPPLY.sub(_totalAllocated);
7483
allocations[_recipient] = Allocation(uint8(AllocationType.FOUNDER), startTime + 1 years, startTime + 4 years, _totalAllocated, 0);
75-
} else if (_supply == AllocationType.AIRDROP) {
76-
AVAILABLE_AIRDROP_SUPPLY = AVAILABLE_AIRDROP_SUPPLY.sub(_totalAllocated);
77-
allocations[_recipient] = Allocation(uint8(AllocationType.AIRDROP), 0, 0, _totalAllocated, 0);
7884
} else if (_supply == AllocationType.ADVISOR) {
7985
AVAILABLE_ADVISOR_SUPPLY = AVAILABLE_ADVISOR_SUPPLY.sub(_totalAllocated);
8086
allocations[_recipient] = Allocation(uint8(AllocationType.ADVISOR), startTime + 212 days, 0, _totalAllocated, 0);
@@ -94,6 +100,35 @@ contract PolyDistribution is Ownable {
94100
AVAILABLE_TOTAL_SUPPLY = AVAILABLE_TOTAL_SUPPLY.sub(_totalAllocated);
95101
LogNewAllocation(_recipient, _supply, _totalAllocated, grandTotalAllocated());
96102
}
103+
104+
/**
105+
* @dev Add an airdrop admin
106+
* @param _admin
107+
* @param _isAdmin
108+
*/
109+
function setAirdropAdmin(address _admin, bool _isAdmin) public onlyOwner {
110+
airdropAdmins[_admin] = _isAdmin;
111+
}
112+
113+
/**
114+
* @dev perform a transfer of allocations
115+
* @param _reciepients
116+
* @param _allocated
117+
*/
118+
function airdropTokens(address[] _recipient) public onlyOwnerOrAdmin {
119+
require(_startTime >= now);
120+
uint airdropped;
121+
for(uint8 i = 0; i< _recipient.length; i++)
122+
{
123+
if (!airdrops[_recipient[i]]) {
124+
airdrops[_recipient[i]] = true;
125+
require(POLY.transfer(_recipient[i], 250*(decimalsFactor));
126+
airdropped = airdropped.add(250*decimalsFactor);
127+
}
128+
}
129+
AVAILABLE_AIRDROP_SUPPLY = AVAILABLE_AIRDROP_SUPPLY.sub(airdropped);
130+
AVAILABLE_TOTAL_SUPPLY = AVAILABLE_TOTAL_SUPPLY.sub(airdropped);
131+
}
97132

98133
/**
99134
* @dev Transfer a recipients available allocation to their address

0 commit comments

Comments
 (0)