This 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.
getRecord
This 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.
_getDepositAddress
Returns 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.
_recordDonation
Auto 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.
_depositToSafe
Mints NFT for donator with fund specific id and returns the NFT id with tokenId parameter. Uses mint function of OpenZeppelin.
_mint
Mints NFT for donator with fund specific id and returns the NFT id with tokenId parameter. Uses mint function of OpenZeppelin.
Events
Definitions
Donated
Event will be emitted from donate function to record donator, donation id, fund id, donated amount and token address.
This contract does management related jobs such as controlling fund addresses, checks and gets allowed tokens for a fund, calls FundV1 contract to create clones for each different funds.
Gets unique identifier of the fund as parameter get a fund's name and focus and returns them.
getFunds
Gets all fund addresses and return them.
getDepositAddressFor
Gets unique identifier of the fund as parameter and address of token tracker and return the address of the fund.
getFundAddress
Gets unique identifier of a fund as parameter and returns the fund’s deposit address.
getAllowedTokens
Gets unique identifier of a fund as parameter and returns list of allowed tokens for a fund.
isTokenAllowed
Gets unique identifier of a fund and token address as parameter and check id token is allowed to this fund.
createFund
Gets name of the fund, focus of the fund, description of the fund, address of underlying Gnosis Safe, Array of allowed token addresses, a Boolean indicating if fund is requestable and a list of checks if fund is requestable as parameters, create a clone of FundV1 contract, and emits an event to blockchain.
createFundWithSafe
Similar to createFund but has 2 additional parameters as address array of owners of the safe and uint256 threshold value. If threshold value is greater than owner’s length than it reverts.
setImplementation
Gets address of underlying Gnosis Safe sets implementation address and returns Boolean indicating operation result.
_setupSafe
?
_encodeSetup
Gets a list of safe owners, number of required confrimations for a Safe transaction, contract address for optional delegate call, data payload for optional delegate call, a handler for fallback calls to this contract, a token that should be used for the payment, a value sthat should be paid, an address that should receive the payment as parameters and returns encoded bytes representation of the parameters with setup signature.
This contract does controls over a fund such as pausing, resuming, closing it, and checking its balance, adding checks, removing checks, listing checks, watching balances.
Gets a name parameter as an input and return address of the contract with the same name.
batchGet
Gets an array of names parameter as an input and return addresses of the contracts with these names.
register
Gets contract name and contract address as parameters, registers contract address into registry. Returns a Boolean indicating result of the operation.
batchRegister
Gets contract names from an array and contract addresses from an array as parameters, registers contract addresses into registry. Returns a Boolean indicating result of the operation.
update
Gets contract name and contract address as parameters, checks if a contract exists with this name. If exists updates the address of the contract. Else reverts. Returns a Boolean indicating result of the operation.
batchUpdate
Gets contract’s names and contract addresses as parameters. Updates the address of the contract if name already exist in registry. Else continues with next contract name. Returns a Boolean indicating result of the operation.
This contract manages things related to fund requests such as role controls, reguest location controls, approval checks, creating the request and so on.
Initiates a request with requested amount from the fund, token address, ultimate recipient of the funds requested, id of the funds requested from, a short description of the request, coordinates pointing to request location. Returns the id of the initiated request which is a _createRequest function call.
approveCheck
Checks if fund is approvable or if fund is open. If not reverts. Checks for approver role. If not reverts. Checks if request’s pending check count 0, if so sets the status of request with one of Pending, Approved, Finalized, Excuted. If status is executed at the beginning of the function, it reverts. If status is Approved at the end of function request will be finalized. Returns a Boolean indicating the result of the operation.
getStatus
Gets a request id as an input parameter and returns the status of request with this id.
getPendingChecksCount
Gets a request id as an input parameter and returns pending check count parameter’s value. It shows remaining checks for a request.
getSigner
Gets a request id and check id as input parameters and returns the signer address of that check for this request.
callOracle
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
_isApprovable
Returns true if a request’s status is Pending and approval status of request’s signature for a specific check is false.
_isFundOpen
Gets a FundV1 clone as an input parameter and returns the result of isOpen function of clone. It is a Boolean indicator shows that if a fund is donatable or not.
_hasFundRole
Gets a clone contracts and a role as input parameters and returns a Boolean indicator that shows if message.sender account has been granted role input.
_createRequest
Gets parameters from createRequest function. Allocates storage location for the new request and assign new request with parameters to the storage location. Emits a RequestCreated event with parameters and request checks. Returns request id.
_approveCheck
Gets a request, check id and success as input parameters, requires pending check count is greater than 0. If success is true, decreases pending check count value by 1. Signs the request for that specific check.
_bumpStatus
Checks if status of request is reached at maximum index, which is executed. If not, increases the status index, pending-to-approved, approved-to-finalized or finalized-to-executed.
_getFund
Gets a fund id as an input parameter. Initialize a fund address value for fund manager. Returns a clone of FundV1 contract that has a fund address as an input parameter.
_copyChecksFromFund
Gets a FundV1 contract as an input parameter. Returns all checks for that fund.
_patchRequestWithCheck
Gets request id and check id as input parameters and returns encoded request id, status, location informations, recipient of request, fund id, amount and token.
Gets registry and minter address as input parameters. Sets message sender’s role as admin, minter address’s role as minter and sets registry.
supportsInterface
XXXXXXXXXXXXXXXXXXXXXXXXX
SVG
Gets a token id as an input parameter. Pass token id, owner of token id, donation amount and type, fund name and fund focus parameters to buildSVG function of NFTDescriptor contract. Returns the result of NFTDescriptor contract’s buildSVG function, a string value.
tokenURI
gets a token id as an input parameter. Fetches donation record information of that token id. Fetches fund name and focus. Creates an image string by using NFTDescriptor contract’s encodeSVG function with token id, owner of token id, donation amount, donated token, fund name and fund focus informations. Returns packed-encoded string with a name and image.
mint
Gets recipient address and donation ID as input parameters mints an NFT and returns the id of the minted ERC721.
_getDonationRecord
Gets a token id as an input parameter. Returns the record of donation matches with the input token id.
_getFundMeta
Gets a fund id as an input parameter. Returns the name and the focus of the fund.