Donation

This contract does donation related jobs such as minting, depositing the donated amount of assets, and recording the donation.

Function Calls

Donation Contract Function Calls

FunctionsDefinitons
donateThis function takes a fund ID, token address and donation amount. Ask _depositToSafe function with _getDepositAddress function with the parameters to safely deposit the amount with related token address. Returns true if it is completed successfully.
getRecordThis function takes an ID and returns the related donation record from mapping. Record is a struct in Donations.sol. Please refer it for detailed information.
_getDepositAddressReturns the address of the ERC721 minter contract. Asks FundManager.sol for the wallet address of that _fundId if that fund accepts deposit with related _tokenAddress. Other case reverts.
_recordDonationAuto increments the previous donation ID produced by using OpenZeppelin’s Counters.sol contract. Records it into donations mapping with donator, fundId, amount and token data. Returns the incremented donationId.
_depositToSafeMints NFT for donator with fund specific id and returns the NFT id with tokenId parameter. Uses mint function of OpenZeppelin.
_mintMints NFT for donator with fund specific id and returns the NFT id with tokenId parameter. Uses mint function of OpenZeppelin.
EventsDefinitions
DonatedEvent will be emitted from donate function to record donator, donation id, fund id, donated amount and token address.

Inheritance Flow

Donation Contract Inheritance Relations

Contracts Description Table

ContractTypeBases
Function NameVisibilityMutabilityModifiers
DonationImplementationRegistered, Ownable
Public ❗️🛑NO❗️
donateExternal ❗️🛑NO❗️
getRecordExternal ❗️NO❗️
_getDepositAddressInternal 🔒
_recordDonationInternal 🔒🛑
_depositToSafeInternal 🔒🛑
_mintInternal 🔒🛑

Legend

SymbolMeaning
🛑Function can modify state
💵Function is payable