An open API service indexing awesome lists of open source software.

https://github.com/johnexzy/give2wild-defi

A crypto donation system that aims to help wildlife conservancies raise funds
https://github.com/johnexzy/give2wild-defi

Last synced: 8 months ago
JSON representation

A crypto donation system that aims to help wildlife conservancies raise funds

Awesome Lists containing this project

README

          

# MaraScan Contract
This contract was written in purpose of a Hackathon. Security issues may not be analyzed correctly, use cautiosly

## Concepts of the MaraScan Contract?
- It is an upgradeable UUPS contract
- Accepts USDC (central cuurency) Token from donor and disbures equally to beneficiaries
- Accepts ETH from donor, swaps Exact ETH to USDC and disbures equally to beneficiaries
- Accepts anyother approved tokens and swap Exact Token to USDC and disbures equally to beneficiaries

### Disburesement
```typescript
function _disburseToken(
address _tokenAddress,
uint256 _amount,
address[] calldata _beneficiaries,
bytes memory _category
) internal {
uint256 amountPerBeneficiary = _amount / _beneficiaries.length;
for (uint256 index = 0; index < _beneficiaries.length; index++) {
require(
ERC20(_tokenAddress).transfer(
_beneficiaries[index],
amountPerBeneficiary
),
"Unable to transfer token"
);
}
// Disbursement ends

// Mint Badge
IBadges(BADGE).mintBadge(0, msg.sender, _category);
emit Disbursed(msg.sender, _amount, _beneficiaries);
}
```
Upon disbursement of USDC, an ERC1155 is minted to Donor.

```typescript
IBadges(BADGE).mintBadge(0, msg.sender, _category);
```
### Thirdparty Contract

- UNISWAPV2ROUTER
- BADGE CONTRACT