Seems like none of these parameters are really necessary, since the addPatron function is called only by admin and patron profile data are stored at the different time without a transaction. So when patron has been added, server only needs to know the address.
|
bytes32 data, |
|
string link, |
|
string ipfsHash, |
|
uint256 index |
Same goes here, only address as an argument would be sufficient
|
bytes32 data, |
|
string memory link, |
|
string memory ipfsHash |
So I think we could just have isPatron[*address*] structure instead of the mapping below. I think it's not really necessary for this contract to maintain patrons count, since server-side will be able to easily construct it just from PatronAdded events.
|
mapping(uint256 => address) public patrons; |
And here instead of passing patron_indexes we would pass patronAddresses. (Also please use camelCase everywhere)
|
function donate(uint256[] memory patron_indexes, uint256[] memory amounts) public payable { |
And here instead of passing patron_index we would be passing patronAddress
|
emit Donate(tx.origin, _msgSender(), amount, patron_index, id); |
Seems like none of these parameters are really necessary, since the
addPatronfunction is called only by admin and patron profile data are stored at the different time without a transaction. So when patron has been added, server only needs to know the address.streamtide-smart-contract/streamtide.sol
Lines 34 to 37 in 5740c35
Same goes here, only address as an argument would be sufficient
streamtide-smart-contract/streamtide.sol
Lines 114 to 116 in 5740c35
So I think we could just have
isPatron[*address*]structure instead of the mapping below. I think it's not really necessary for this contract to maintain patrons count, since server-side will be able to easily construct it just fromPatronAddedevents.streamtide-smart-contract/streamtide.sol
Line 26 in 5740c35
And here instead of passing
patron_indexeswe would passpatronAddresses. (Also please use camelCase everywhere)streamtide-smart-contract/streamtide.sol
Line 126 in 5740c35
And here instead of passing
patron_indexwe would be passingpatronAddressstreamtide-smart-contract/streamtide.sol
Line 137 in 5740c35