allforclimate / cryptomatchingfund

Matching Fund Smart Contract
MIT License
0 stars 0 forks source link

Funder(s) aren't considered as donors to the non profit, the smart contract is #1

Open xdamman opened 2 years ago

xdamman commented 2 years ago

The way the matching fund is currently implemented, every time a donor gives tokens to a non profit, there is two transactions happening, one from the donor's wallet to the non profit wallet and one from the smart contract to the non profit.

That works but the problem is if the non profit wants to issue an NFT to all donors' wallets, the smart contract will receive it.

I can see two ways to solve that (but maybe you can see more):

The latter seems to be the best way to do this but I can foresee one problem: what if the transfer from the funder doesn't go through? Giving an allowance is not a guarantee that the funds are still there. So we could be in a situation where a donor is giving money to the smart contract, there is no error because the Matching Fund hasn't been exhausted yet, but the transfer from the funder's wallet to the non profit is not going through. The donor's money would have already been sent.

Is there a way to make both transfers part of one transaction that would revert if it fails?

Should we instead ask the funder the lock the total amount in the Matching Fund and then when there is a match, we transfer back the amount to the funder and then execute the transfer to the non profit? It seems that this could work but it also feels like being very gas inefficient. Are we over-engineering here? Arguably, if there is a whitelist of recipients, and since the donors have to donate the same amount coming from their own wallet, the risk for abuse seems fairly low.

Also how to handle multiple funders in that case? Right now, we simply return the balance of the Matching Fund -if any- to all funders pro-rata.

Feedback welcome!

xdamman commented 2 years ago

Reading more about https://www.partybid.app/ I’m wondering if the NFT going to the Matching Fund is not actually a feature instead of a bug.

Some non profits could release special NFTs to the best fundraisers or to the donors that reach a certain donation amount. In that context, it might be a good idea to come together as a Matching Fund and issue fractional ownership ERC20 token to the LP (funders) of the fund.

The question is what is the most likely intent of the donor that wants to start a Matching Fund and what’s the best way to reward them so that they will do it again (or top up their donation).

My hunch: if I start a Matching Fund, I want to make sure people will use it and it’s even more rewarding if other people top it up and join me. If I get an NFT for that, that’s icing on the cake. I feel like I’d rather be recognized for helping raise more funds than simply for being a direct donor with the total amount of my matching fund (I’d rather have a fraction of a NFT that reflects that than an NFT that would reflect my direct donation of the amount I put in the Matching Fund).

asood123 commented 2 years ago

Maybe the closeFund function could take all the NFTs and fractionalize them across the funders and even donors?

xdamman commented 2 years ago

Donors would already receive NFTs directly from the source since they will directly show up as donors (they only give an approval to the Matching Fund). But yes fractionalized NFTs seems to be the way to go as far as funders are concerned. Thanks for your input!