Skip to content

Revising patrons structure #11

Description

@madvas

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);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions