Skip to content

Commit

Permalink
update faucet contract for ERC1155
Browse files Browse the repository at this point in the history
  • Loading branch information
sxcamacho committed Sep 19, 2023
1 parent 7d36cfd commit db1138b
Show file tree
Hide file tree
Showing 7 changed files with 584 additions and 326 deletions.
48 changes: 0 additions & 48 deletions packages/core/src/solc_0.8/faucet/Faucet1155.md

This file was deleted.

239 changes: 0 additions & 239 deletions packages/core/src/solc_0.8/faucet/Faucet1155.sol

This file was deleted.

54 changes: 54 additions & 0 deletions packages/core/src/solc_0.8/faucet/FaucetsERC1155.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# FaucetsERC1155 Contract Documentation

This contract is designed to allow the distribution of ERC1155 tokens from multiple faucets on testnet. Each faucet can have its own distribution settings, and only the owner can manage these faucets.

## Prerequisites:

- This contract makes use of the OpenZeppelin library for standard ERC and utility contracts.
- Solidity version: 0.8.2.

## Features:

1. Ability to add, enable, disable, and remove faucets.
2. Customize each faucet with a distribution limit and waiting period.
3. Withdraw tokens from the faucet.
4. Claim tokens from the faucet.

## Events:

- `FaucetAdded`: Emitted when a new faucet is added.
- `TokenAdded`: Emitted when a new token ID is added to a faucet.
- `FaucetStatusChanged`: Emitted when a faucet is enabled or disabled.
- `PeriodUpdated`: Emitted when the claim period for a faucet is updated.
- `LimitUpdated`: Emitted when the claim limit for a faucet is updated.
- `Claimed`: Emitted when tokens are claimed from a faucet.
- `Withdrawn`: Emitted when tokens are withdrawn from the contract.

## Structs:

- `FaucetInfo`: Contains information about each faucet, such as its enabled status, claim period, claim limit, and associated token IDs.

## Modifiers:

- `exists`: Checks if the specified faucet exists.

## Functions:

1. `getPeriod`: Returns the claim period for the specified faucet.
2. `setPeriod`: Sets the claim period for the specified faucet.
3. `getLimit`: Returns the claim limit for the specified faucet.
4. `setLimit`: Sets the claim limit for the specified faucet.
5. `addFaucet`: Adds a new faucet with the specified settings.
6. `removeFaucet`: Removes the specified faucet and transfers any remaining tokens to the owner.
7. `enableFaucet`: Enables the specified faucet.
8. `disableFaucet`: Disables the specified faucet.
9. `removeTokens`: Removes specific token IDs from the specified faucet and transfers the associated tokens to the owner.
10. `claim`: Claims a specified amount of a specified token from the specified faucet.
11. `withdraw`: Withdraws tokens from the contract to a specified address.
12. `_withdraw`: Internal function to handle withdrawal logic.
13. `claimBatch`: Claims multiple tokens from a specified faucet in a single transaction.

## Notes:

- This contract is designed to work with ERC1155 tokens, which are multi-token standard contracts.
- The owner has the ability to manage faucets, but individual users can claim tokens from the faucets based on the configured settings.
Loading

1 comment on commit db1138b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

82.96%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/core/src/solc_0.8.15/common/BaseWithStorage/ERC2771
   ERC2771HandlerUpgradeable.sol44.44%25%60%44.44%23, 27, 30, 39, 39, 39–40, 42
packages/core/src/solc_0.8.15/common/OperatorFilterer
   IOperatorFilterRegistry.sol100%100%100%100%
   UpdatableOperatorFiltererUpgradeable.sol11.11%10%25%9.52%18, 23–24, 24, 24–25, 27, 27, 27–28, 30, 38, 38, 38, 42, 42, 42–44, 46, 46, 46–47, 50, 55, 55, 55–56, 56, 56–57, 60, 68, 68, 68–69, 71
packages/core/src/solc_0.8.15/raffle
   DanceFight.sol75%50%100%100%20
   FistOfTheNorthStar.sol75%50%100%100%20
   GenericRaffle.sol61.32%41.11%58.62%81.72%177, 188–194, 224–228, 251–258, 265–266, 269, 287, 287–288, 288, 288–289, 307, 335–336, 346, 346–347, 347, 347–349, 357–358, 380, 389, 397–398, 408, 408–409, 418, 418, 420, 429, 429, 431, 441, 441–442, 452, 452–453, 464, 464–465, 565, 574, 625–626, 629, 632
   HellsKitchen.sol75%50%100%100%20
   MadBalls.sol75%50%100%100%20
   ParisHilton.sol75%50%100%100%20
   Rabbids.sol75%50%100%100%20
packages/core/src/solc_0.8/Game
   GameBaseToken.sol87.78%74.26%100%95.60%101, 139–140, 142–143, 185, 189, 189–190, 193–194, 213, 216–217, 231, 248, 251, 266, 286, 352, 415, 420, 436, 441–442, 442, 442–443, 485–486, 507–508, 510, 523, 523, 523, 523, 523, 542, 547, 55, 618, 81
   GameMinter.sol96.15%83.33%100%100%77
   GameV1.sol100%100%100%100%
packages/core/src/solc_0.8/OperatorFilterer/contracts
   OperatorFilterRegistrant.sol62.50%50%100%66.67%17, 19–20
packages/core/src/solc_0.8/OperatorFilterer/contracts/upgradeable
   DefaultOperatorFiltererUpgradeable.sol0%0%0%0%12, 12–13
   OperatorFiltererUpgradeable.sol88.64%85%100%90%16, 52–53, 62–63
packages/core/src/solc_0.8/OperatorFilterer/interfaces
   IOperatorFilterRegistry.sol100%100%100%100%
packages/core/src/solc_0.8/Sand
   SandBaseToken.sol100%100%100%100%
packages/core/src/solc_0.8/StarterPack
   PurchaseValidator.sol95.12%83.33%100%100%29, 37
   StarterPackV2.sol92.96%82.35%95.65%99.07%108–111, 309, 378, 67–72, 84
packages/core/src/solc_0.8/Utils
   Batch.sol85.48%59.09%100%100%34, 38, 44, 50, 56, 65, 75, 82, 88
packages/core/src/solc_0.8/asset
   AssetAttributesRegistry.sol66.91%56%83.33%71.43%103, 103, 103–104, 104, 109, 109, 109–112, 112, 112–113, 116, 118–119, 121, 123, 151–152, 160–161, 169–171, 185, 200–201, 201, 201–202, 202, 202–203, 205, 205, 205–206, 228, 232, 67, 69–70
   AssetMinter.sol85.71%73.75%87.50%94.34%113, 117, 137, 137, 137–138, 138, 141–142, 226, 235, 248, 284, 284–285, 287, 415, 44–46, 53–54, 65, 70, 75, 80, 85
   AssetSignedAuctionWithAuth.sol78%65.15%84.62%88.73%109, 111, 180, 180, 193, 202, 211, 227, 227, 240, 249, 258, 272, 285, 298, 303, 307–308, 311–312, 316, 346–347, 347, 347, 351–352, 352, 352, 373, 89
   AssetUpgrader.sol80.81%61.76%84.62%92.31%113–114, 122, 127, 168, 192–193, 195, 221, 221–222, 224, 232, 76–77, 96–97
packages/core/src/solc_0.8/asset/libraries
   AssetHelper.sol0%0%0%0%16–17, 17, 17–18, 18, 18–19, 35–38, 40, 47, 49, 51, 59–60, 62, 65–67, 67, 67–72, 72, 72–74, 78, 86, 88–90, 90, 90–91, 94
   ERC1155ERC721Helper.sol100%100%100%100%
packages/core/src/solc_0.8/assetERC1155
   AssetBaseERC1155.sol80.12%65.45%83.72%88.76%110, 112, 133, 152, 152, 152, 152, 152–153, 179, 190, 196, 204, 204, 204, 204, 204, 216, 218, 263, 301, 301, 301–304, 317–318, 339, 355, 355, 355–356, 358, 367, 369–370, 390, 437, 447–449, 449, 449–450, 452, 491,

Please sign in to comment.