Skip to content

Commit 5740c35

Browse files
authored
Update streamtide.sol
1 parent 52dde99 commit 5740c35

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

streamtide.sol

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ contract MVPCLR is Ownable {
1717

1818

1919
address[] public admins;
20+
address[] public blacklisted;
2021

2122

2223
mapping(address => bool) public isAdmin;
2324

24-
mapping(address => uint256) public supporters;
25+
2526
mapping(uint256 => address) public patrons;
2627

2728
Donation[] public donations;
@@ -93,18 +94,39 @@ contract MVPCLR is Ownable {
9394
return block.timestamp;
9495
}
9596

97+
function addToBlacklist(address _address) public onlyAdmin {
98+
blacklisted.push(_address);
99+
}
100+
101+
function removeFromBlacklist(address _address) public onlyAdmin {
102+
uint256 index;
103+
for (uint256 i = 0; i < blacklisted.length; i++) {
104+
if (blacklisted[i] == _address) {
105+
index = i;
106+
break;
107+
}
108+
}
109+
delete blacklisted[index];
110+
}
111+
96112
function addPatron(
97113
address payable addr,
98114
bytes32 data,
99115
string memory link,
100116
string memory ipfsHash
101117
) public onlyAdmin {
118+
for (uint256 i = 0; i < blacklisted.length; i++) {
119+
require(blacklisted[i] != addr, "Patron address is blacklisted");
120+
}
102121
patrons[patronCount] = addr;
103122
emit PatronAdded(addr, data, link, ipfsHash, patronCount);
104123
patronCount = patronCount + 1;
105124
}
106125

107126
function donate(uint256[] memory patron_indexes, uint256[] memory amounts) public payable {
127+
for (uint256 i = 0; i < blacklisted.length; i++) {
128+
require(blacklisted[i] != _msgSender(), "Sender address is blacklisted");
129+
}
108130
uint256 total_amount = 0;
109131
for(uint256 i = 0; i < patron_indexes.length; i++) {
110132
uint256 patron_index = patron_indexes[i];
@@ -113,13 +135,11 @@ contract MVPCLR is Ownable {
113135
require(patron_index < patronCount, "CLR:donate - Not a valid recipient");
114136
donations.push(Donation(patrons[patron_index], amount));
115137
emit Donate(tx.origin, _msgSender(), amount, patron_index, id);
116-
}
117-
require(total_amount == msg.value, "amount sent does not match sum of donations");
118-
supporters[_msgSender()] = supporters[_msgSender()] + total_amount;
119-
// add tip amount in investors mapping
138+
}
120139
}
121140

122141
function distribute(uint256 _maxProcess) external onlyAdmin {
142+
require(roundIsClosed(), "Round is still open");
123143
uint256 processed = 0;
124144
while(index_of_last_processed_donation + int256(processed) < int256(donations.length)-1 && processed < _maxProcess) {
125145
Donation memory donation = donations[uint256(index_of_last_processed_donation+1)+processed];

0 commit comments

Comments
 (0)