Skip to content

Commit 71bc3b5

Browse files
refactor: Refactor Drop protocol contracts
1 parent 09f8a23 commit 71bc3b5

116 files changed

Lines changed: 4221 additions & 4186 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitmodules

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
[submodule "moda-contracts/lib/forge-std"]
2-
path = moda-contracts/lib/forge-std
1+
[submodule "contracts/lib/forge-std"]
2+
path = contracts/lib/forge-std
33
url = https://github.com/foundry-rs/forge-std
4-
[submodule "moda-contracts/lib/openzeppelin-contracts-upgradeable"]
5-
path = moda-contracts/lib/openzeppelin-contracts-upgradeable
4+
[submodule "contracts/lib/openzeppelin-contracts-upgradeable"]
5+
path = contracts/lib/openzeppelin-contracts-upgradeable
66
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
7-
[submodule "moda-contracts/lib/openzeppelin-foundry-upgrades"]
8-
path = moda-contracts/lib/openzeppelin-foundry-upgrades
7+
[submodule "contracts/lib/openzeppelin-foundry-upgrades"]
8+
path = contracts/lib/openzeppelin-foundry-upgrades
99
url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright 2023 MODA Foundation
190+
Copyright 2024 DROPcmdk
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

README.md

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
<div align="center">
2-
<img src="./logo.svg" alt="Logo" height="60" />
3-
<br/>
4-
<br/>
5-
<a href="https://www.npmjs.com/package/modadao">
6-
<img src="https://img.shields.io/npm/v/modadao?style=flat&label=Version" />
7-
</a>
8-
<br/>
9-
<p>A web3 protocol for distributing music on EVM chains.</p>
10-
11-
[![k1]][k2]
12-
13-
[k1]: https://img.shields.io/twitter/follow/moda_dao?style=flat
14-
[k2]: https://x.com/MODA_DAO
15-
</div>
1+
162

173
## Getting Started
184

@@ -23,53 +9,35 @@ pnpm i
239

2410
2. Set up environment variables
2511
```bash
26-
cp ./moda-contracts/.env-local ./moda-contracts/.env
27-
# Add your values to ./moda-contracts/.env
12+
cp ./contracts/.env-local ./contracts/.env
13+
# Add your values to ./contracts/.env
2814
```
2915

3016
## Generate Smart Contract Documentation
3117

3218
1. `pnpm c:docs`
3319
2. Visit [localhost:8080](localhost:8080)
3420

35-
### Deploy Membership
21+
### Membership //TODO
3622

37-
Membership is a way to control who has access to your Catalog. The default implementation defines any address as a "member", which means anyone can register tracks in the Catalog. You can extend this logic to define your own rules such as NFT-gates, minimal ERC-20 balance amounts, or a generic whitelist. See Membership.sol in `./moda-contracts/src/Membership.sol`
23+
Membership is a way to control who has access to your Registry. The default implementation defines any address as a "member", which means anyone can register tracks in the Catalog. You can extend this logic to define your own rules such as NFT-gates, minimal ERC-20 balance amounts, or a generic whitelist. See Membership.sol in `./contracts/src/Membership.sol`
3824

3925
1. Deploy contract `pnpm 1_deploy_Membership --chain mumbai`
4026

41-
### Deploy Catalog
42-
43-
2. Deploy contract `pnpm 2_deploy_Catalog --chain mumbai --sender <YOUR_OWNER_ADDRESS>`
44-
45-
Then look in the console for your Catalog address:
4627

47-
```
48-
$ Your Catalog was deployed to:
49-
$ <ADDRESS>
50-
```
28+
### Registry
5129

52-
## (Optional, but not recommended) Deploy Common-Good Contracts
30+
#### Technical Overview
5331

54-
These contracts have already been deployed on Mumbai. It is recommended that you use the ones already deployed so that the creators can benefit, but if you need to change certain features you are free to redeploy these. If you would like these contracts on a particular chain please reach out to the team and we will help facilitate.
32+
The Registry is an upgradeable contract and the only one in the protocol. It follows an Upgradeable Beacon pattern in which a Beacon contract containing the the implementation address is deployed and controlled by an Authorized account. Any proxy that is deployed will refer to this Beacon contract for the implementation address.
5533

56-
### Deploy Registry
57-
`pnpm c:deploy_Registry --chain mumbai`
34+
The Registry uses a Namespaced Storage Layout defined in [ERC-7201](https://eips.ethereum.org/EIPS/eip-7201)
5835

59-
### Deploy Profile
60-
`pnpm c:deploy_Profile --chain mumbai`
36+
The [Foundry Upgrades](https://docs.openzeppelin.com/upgrades-plugins/1.x/api-foundry-upgrades) library is used for ease of upgradeable contract deployment and customizable upgrade safety validations.
6137

62-
### Deploy Management
63-
`pnpm c:deploy_Management --chain mumbai`
6438

65-
### Deploy Splits Factory
66-
`pnpm c:deploy_SplitsFactory --chain mumbai`
6739

68-
### Deploy CatalogFactory
69-
`pnpm c:deploy_CatalogFactory --chain mumbai`
7040

71-
### Register Contracts with Registry
72-
`pnpm c:set_OfficialContracts --chain mumbai --sender <public address of who deployed the Registry>`
7341

7442

7543
## Automatic track verification
@@ -88,7 +56,7 @@ All registered tracks have a status that is used to represent their authenticity
8856

8957
## Smart Contract Testing
9058

91-
Navigate to the moda-contracts directory and run
59+
Navigate to the contracts directory and run
9260

9361
```bash
9462
pnpm test
@@ -102,7 +70,7 @@ pnpm coverage
10270

10371
## License
10472

105-
`moda-protocol` is [Apache licensed](LICENSE).
73+
`drop-protocol` is [Apache licensed](LICENSE).
10674

10775
## Contributing
10876

apps/dapp/next.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ const nextConfig = {
33
images: {
44
remotePatterns: [
55
{
6-
protocol: 'https',
7-
hostname: 'drops.moda.audio',
8-
pathname: '/ipfs/*',
6+
protocol: "https",
7+
hostname: "", //TODO
8+
pathname: "/ipfs/*",
99
},
1010
{
11-
protocol: 'https',
12-
hostname: 'gateway.pinata.cloud',
13-
pathname: '/ipfs/*',
11+
protocol: "https",
12+
hostname: "gateway.pinata.cloud",
13+
pathname: "/ipfs/*",
1414
},
1515
],
1616
},
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
# DEVELOPER CONFIG - Change these to match your organization values
33
# =================================================================
44
DEPLOYER_PRIVATE_KEY=SECRET
5-
EVM_RPC_URL=https://polygon-mumbai.g.alchemy.com/v2/<YOUR_API_KEY>
5+
EVM_RPC_URL=
6+
TESTNET_RPC_URL=
67

78
# Etherscan or Polygonscan API Key
89
ETHERSCAN_API_KEY=SECRET
910

10-
# Change the catalog to your organization name.
11-
CATALOG_NAME="DRIP"
12-
# Once deployed add your Catalog address here.
13-
CATALOG_ADDRESS=<0xCatalogAddress...>
11+
# USDC Address
12+
USDC_ADDRESS=0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238 # Sepolia
13+
14+
# Once deployed add your Registry address here.
15+
REGISTRY_ADDRESS=<0xRegistryAddress...>
1416

1517
# OpenReleases Contract (Optional & Recommended) - Organizations can deploy a common good Releases contract for artists and
1618
# labels to release tracks without the need of deploying their own Releases contract.
@@ -26,7 +28,7 @@ TREASURY_ADDRESS=0x01...
2628
# Change this to the address on your chain if you are deploying common good contracts.
2729
# See: https://docs.splits.org/core/split#addresses
2830

29-
SPLIT_MAIN_ADDRESS=0x2ed6c4B5dA6378c7897AC67Ba9e43102Feb694EE # Mumbai
31+
SPLIT_MAIN_ADDRESS=0x54E4a6014D36c381fC43b7E24A1492F556139a6F # Sepolia
3032

3133
# =================================================================
3234
=======

contracts/.gas-snapshot

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
MarketplaceTest:test_constructor() (gas: 10761)
2+
MarketplaceTest:test_createSale() (gas: 432806)
3+
MarketplaceTest:test_createSale_RevertIf_Releases_is_not_registered() (gas: 49023)
4+
MarketplaceTest:test_createSale_RevertIf_amountTotal_is_zero() (gas: 49057)
5+
MarketplaceTest:test_createSale_RevertIf_beneficiary_address_is_zero() (gas: 49090)
6+
MarketplaceTest:test_createSale_RevertIf_maxCountPerWallet_is_zero() (gas: 49213)
7+
MarketplaceTest:test_createSale_RevertIf_startAt_is_after_endAt() (gas: 47607)
8+
MarketplaceTest:test_createSale_emits_event() (gas: 426522)
9+
MarketplaceTest:test_purchase() (gas: 600636)
10+
MarketplaceTest:test_purchase_RevertIf_Sale_has_ended() (gas: 432092)
11+
MarketplaceTest:test_purchase_RevertIf_Sale_has_not_started() (gas: 433422)
12+
MarketplaceTest:test_purchase_RevertIf_maxCountPerWallet_is_exceeded() (gas: 594112)
13+
MarketplaceTest:test_purchase_RevertIf_tokenAmount_is_greater_than_amountRemaining() (gas: 435268)
14+
MarketplaceTest:test_purchase_RevertIf_tokenAmount_is_zero() (gas: 434655)
15+
MarketplaceTest:test_purchase_emits_event() (gas: 588888)
16+
MarketplaceTest:test_withdraw() (gas: 450701)
17+
OpenReleasesFactoryTest:test_constructor() (gas: 14921)
18+
OpenReleasesFactoryTest:test_create() (gas: 289818)
19+
OpenReleasesTest:test_burn_emits_event() (gas: 990909)
20+
OpenReleasesTest:test_constructor() (gas: 29107)
21+
OpenReleasesTest:test_create_RevertIf_caller_is_not_track_owner() (gas: 588877)
22+
OpenReleasesTest:test_create_RevertIf_royalty_amount_is_over_2000() (gas: 595969)
23+
OpenReleasesTest:test_create_emits_event() (gas: 1076025)
24+
OpenReleasesTest:test_create_release() (gas: 1100692)
25+
OpenReleasesTest:test_removeRelease() (gas: 993576)
26+
OpenReleasesTest:test_royaltyInfo() (gas: 1079364)
27+
OpenReleasesTest:test_setUri() (gas: 1083522)
28+
OpenReleasesTest:test_setUri_RevertIf_caller_is_not_release_owner() (gas: 1077540)
29+
OpenReleasesTest:test_setUri_RevertIf_tokenId_is_invalid() (gas: 1077380)
30+
OpenReleasesTest:test_setUri_emits_event() (gas: 1082455)
31+
OpenReleasesTest:test_supportsInterface() (gas: 8539)
32+
ProfileTest:test_accountUri() (gas: 109271)
33+
ProfileTest:test_accountUri_reverts_with_nonexistent_profile() (gas: 17082)
34+
ProfileTest:test_approve_reverts() (gas: 10759)
35+
ProfileTest:test_balanceOf_with_profile() (gas: 106209)
36+
ProfileTest:test_balanceOf_without_profile() (gas: 10017)
37+
ProfileTest:test_canMintFor_as_IAccessControl_DEFAULT_ADMIN_ROLE() (gas: 278295)
38+
ProfileTest:test_canMintFor_as_owner() (gas: 92572)
39+
ProfileTest:test_canMintFor_without_DEFAULT_ADMIN_ROLE() (gas: 282304)
40+
ProfileTest:test_canMintFor_without_ownership() (gas: 95031)
41+
ProfileTest:test_constructor() (gas: 19907)
42+
ProfileTest:test_getApproved_reverts() (gas: 8611)
43+
ProfileTest:test_isApprovedForAll() (gas: 10196)
44+
ProfileTest:test_mintFor_as_IAccessControl_DEFAULT_ADMIN_ROLE() (gas: 387396)
45+
ProfileTest:test_mintFor_as_owner() (gas: 201768)
46+
ProfileTest:test_mintFor_emits_events() (gas: 195491)
47+
ProfileTest:test_mintFor_increments_total_supply() (gas: 266038)
48+
ProfileTest:test_mintFor_reverts_for_duplicates() (gas: 198767)
49+
ProfileTest:test_mintFor_without_DEFAULT_ADMIN_ROLE() (gas: 288527)
50+
ProfileTest:test_mintFor_without_ownership() (gas: 101186)
51+
ProfileTest:test_mint_creates_new_token() (gas: 115503)
52+
ProfileTest:test_mint_emits_event() (gas: 107567)
53+
ProfileTest:test_mint_increments_total_supply() (gas: 182489)
54+
ProfileTest:test_mint_reverts_for_duplicates() (gas: 104163)
55+
ProfileTest:test_name() (gas: 12348)
56+
ProfileTest:test_ownerOf() (gas: 106412)
57+
ProfileTest:test_ownerOf_reverts_with_nonexistent_token() (gas: 10708)
58+
ProfileTest:test_returns_false_for_unsupported_interfaces() (gas: 5988)
59+
ProfileTest:test_safeTransferFrom_reverts() (gas: 12946)
60+
ProfileTest:test_safeTransferFrom_with_data_arg_reverts() (gas: 13585)
61+
ProfileTest:test_setApprovalForAll_reverts() (gas: 10805)
62+
ProfileTest:test_supports_ERC165() (gas: 5969)
63+
ProfileTest:test_supports_IERC165() (gas: 5971)
64+
ProfileTest:test_supports_IERC4906() (gas: 5957)
65+
ProfileTest:test_supports_IERC721() (gas: 5880)
66+
ProfileTest:test_supports_IERC721Metadata() (gas: 5895)
67+
ProfileTest:test_supports_IProfile() (gas: 5891)
68+
ProfileTest:test_symbol() (gas: 12390)
69+
ProfileTest:test_tokenUri() (gas: 108898)
70+
ProfileTest:test_tokenUri_reverts_with_nonexistent_token() (gas: 12764)
71+
ProfileTest:test_totalSupply_returns_the_token_count() (gas: 101291)
72+
ProfileTest:test_transferFrom_reverts() (gas: 12954)
73+
ProfileTest:test_updateProfileFor_emits_events() (gas: 391007)
74+
ProfileTest:test_updateProfileFor_reverts_for_nonexisting_profile() (gas: 286741)
75+
ProfileTest:test_updateProfileFor_reverts_when_unauthorized() (gas: 391805)
76+
ProfileTest:test_updateProfileFor_with_AccessControl_DEFAULT_ADMIN_ROLE() (gas: 401956)
77+
ProfileTest:test_updateProfileFor_with_ownership_sets_new_uri() (gas: 215621)
78+
ProfileTest:test_updateProfile_emits_MetadataUpdate() (gas: 108851)
79+
ProfileTest:test_updateProfile_reverts_for_nonexisting_profile() (gas: 13255)
80+
ProfileTest:test_updateProfile_sets_new_uri() (gas: 126727)
81+
RegisterReleaseTest:test_getReleaseTracks() (gas: 426539)
82+
RegisterReleaseTest:test_registerRelease_RevertIf_release_duplicate() (gas: 715756)
83+
RegisterReleaseTest:test_registerRelease_RevertIf_releases_contract_has_no_approval() (gas: 410240)
84+
RegisterReleaseTest:test_registerRelease_RevertIf_releases_contract_not_registered() (gas: 397157)
85+
RegisterReleaseTest:test_registerRelease_RevertIf_track_not_validated() (gas: 471437)
86+
RegisterReleaseTest:test_registerRelease_RevertIf_tracks_unregistered() (gas: 410833)
87+
RegisterReleaseTest:test_registerRelease_emits_event() (gas: 693316)
88+
RegisterReleaseTest:test_registerRelease_with_setReleasesApproval() (gas: 707534)
89+
RegisterReleaseTest:test_registerRelease_with_setReleasesApprovalForAll() (gas: 668860)
90+
RegisterReleaseTest:test_unregisterRelease() (gas: 571904)
91+
RegisterReleaseTest:test_unregisterRelease_emits_event() (gas: 569784)
92+
RegisterReleasesContractTest:test_registerReleasesContract() (gas: 20266)
93+
RegisterReleasesContractTest:test_registerReleasesContract_emits_event() (gas: 134132)
94+
RegisterReleasesContractTest:test_registerReleasesContract_reverts_if_no_releases_registrar_role() (gas: 52701)
95+
RegisterReleasesContractTest:test_registerReleasesContract_reverts_if_releases_contract_already_registered() (gas: 38370)
96+
RegisterReleasesContractTest:test_revert_if_unregistering_unregistered_releases_contract() (gas: 24122)
97+
RegisterReleasesContractTest:test_unregisterReleasesContract() (gas: 28370)
98+
RegisterReleasesContractTest:test_unregisterReleasesContract_emits_event() (gas: 30129)
99+
RegisterTrackTest:test_registerTrack() (gas: 200654)
100+
RegisterTrackTest:test_registerTrack_RevertIf_track_already_registered() (gas: 193313)
101+
RegisterTrackTest:test_registerTrack_RevertIf_user_not_member() (gas: 32188)
102+
RegisterTrackTest:test_registerTrack_emits_event() (gas: 165876)
103+
RegisterTrackTest:test_registerTrack_with_AUTO_VERIFIED_ROLE() (gas: 209434)
104+
RegistryInitializeTest:test_initialize_RevertIf_already_initialized() (gas: 6791331)
105+
RegistryUpgradesTest:test_beacon() (gas: 7489)
106+
RegistryUpgradesTest:test_implementation_address_updated() (gas: 3315989)
107+
RegistryUpgradesTest:test_proxy_can_call_updated_Registry() (gas: 3323900)
108+
ReleasesApprovalTest:test_remove_releases_approval() (gas: 216979)
109+
ReleasesApprovalTest:test_setReleasesApproval() (gas: 227866)
110+
ReleasesApprovalTest:test_setReleasesApprovalForAll() (gas: 223322)
111+
ReleasesApprovalTest:test_setReleasesApprovalForAll_RevertIf_setting_approval_not_artist() (gas: 199177)
112+
ReleasesApprovalTest:test_setReleasesApprovalForAll_RevertIf_setting_approval_with_unregistered_releases_contract() (gas: 194695)
113+
ReleasesApprovalTest:test_setReleasesApprovalForAll_emits_event() (gas: 223173)
114+
ReleasesApprovalTest:test_setReleasesApproval_RevertIf_setting_approval_not_artist() (gas: 200150)
115+
ReleasesApprovalTest:test_setReleasesApproval_RevertIf_setting_approval_with_unregistered_releases_contract() (gas: 198018)
116+
ReleasesApprovalTest:test_setReleasesApproval_emits_event() (gas: 227824)
117+
ReleasesFactoryTest:test_constructor() (gas: 14921)
118+
ReleasesFactoryTest:test_create() (gas: 323542)
119+
ReleasesTest:test_create_RevertIf_caller_is_not_release_admin() (gas: 609395)
120+
ReleasesTest:test_create_RevertIf_royalty_amount_is_over_2000() (gas: 607354)
121+
ReleasesTest:test_create_emits_event() (gas: 1063670)
122+
ReleasesTest:test_create_release_curated() (gas: 1088448)
123+
ReleasesTest:test_initialize() (gas: 26153)
124+
ReleasesTest:test_initialize_RevertIf_already_initialized() (gas: 30475)
125+
ReleasesTest:test_royaltyInfo() (gas: 1067164)
126+
ReleasesTest:test_setUri() (gas: 1073351)
127+
ReleasesTest:test_setUri_RevertIf_tokenId_is_invalid() (gas: 1067464)
128+
ReleasesTest:test_setUri_emits_event() (gas: 1072239)
129+
ReleasesTest:test_supportsInterface() (gas: 8555)
130+
ReleasesTest:test_withdrawRelease() (gas: 1076129)
131+
ReleasesTest:test_withdrawRelease_RevertIf_tokenId_is_invalid() (gas: 1066600)
132+
ReleasesTest:test_withdrawRelease_emits_event() (gas: 1076856)
133+
SetTrackDataTest:test_setTrackBeneficiary() (gas: 212827)
134+
SetTrackDataTest:test_setTrackBeneficiary_RevertIf_not_track_owner() (gas: 200770)
135+
SetTrackDataTest:test_setTrackBeneficiary_RevertIf_track_not_registered() (gas: 24712)
136+
SetTrackDataTest:test_setTrackBeneficiary_emits_event() (gas: 209071)
137+
SetTrackDataTest:test_setTrackFingerprintHash() (gas: 235072)
138+
SetTrackDataTest:test_setTrackFingerprintHash_RevertIf_not_track_owner() (gas: 201252)
139+
SetTrackDataTest:test_setTrackFingerprintHash_RevertIf_track_not_registered() (gas: 25151)
140+
SetTrackDataTest:test_setTrackFingerprintHash_emits_event() (gas: 227870)
141+
SetTrackDataTest:test_setTrackMetadata() (gas: 214610)
142+
SetTrackDataTest:test_setTrackMetadata_RevertIf_not_track_owner() (gas: 201210)
143+
SetTrackDataTest:test_setTrackMetadata_RevertIf_track_not_registered() (gas: 25092)
144+
SetTrackDataTest:test_setTrackMetadata_emits_event() (gas: 206940)
145+
SetTrackDataTest:test_setTrackStatus() (gas: 264320)
146+
SetTrackDataTest:test_setTrackStatus_RevertIf_no_verifier_role() (gas: 195144)
147+
SetTrackDataTest:test_setTrackStatus_RevertIf_track_not_registered() (gas: 56876)
148+
SetTrackDataTest:test_setTrackStatus_emits_event() (gas: 260516)
149+
SetTrackDataTest:test_setTrackValidationHash() (gas: 235202)
150+
SetTrackDataTest:test_setTrackValidationHash_RevertIf_not_track_owner() (gas: 201274)
151+
SetTrackDataTest:test_setTrackValidationHash_RevertIf_track_not_registered() (gas: 25260)
152+
SetTrackDataTest:test_setTrackValidationHash_emits_event() (gas: 227936)
153+
SplitsFactoryTest:test_PERCENTAGE_SCALE() (gas: 5489)
154+
SplitsFactoryTest:test_constructor_sets_sender_as_owner() (gas: 18025)
155+
SplitsFactoryTest:test_create_adds_all_beneficiaries() (gas: 344101)
156+
SplitsFactoryTest:test_create_adds_dust_allocations_to_treasury() (gas: 744589)
157+
SplitsFactoryTest:test_create_emits_SplitCreated() (gas: 342899)
158+
SplitsFactoryTest:test_create_gives_more_shares_to_duplicate_accounts() (gas: 396780)
159+
SplitsFactoryTest:test_create_returns_the_split_address() (gas: 335946)
160+
SplitsFactoryTest:test_create_sets_one_percent_distributor_fee() (gas: 335920)
161+
SplitsFactoryTest:test_create_sorts_unordered_accounts() (gas: 402547)
162+
SplitsFactoryWithForkTest:test_distributeETH_from_SplitMain() (gas: 457027)
163+
SplitsFactoryWithForkTest:test_withdraw_from_splitMain() (gas: 591375)
File renamed without changes.

0 commit comments

Comments
 (0)