Skip to content

Commit

Permalink
✨ feat: TeamRegistry (#29)
Browse files Browse the repository at this point in the history
* feat: TeamRegistry

* v2

* remove ITeamRegistry

* add TeamRegistry tests

* v3

* add request logic

* docs: natspec

* fix: createTeam tests and update requestMembership

* chore: update requestJoin w/ new event

* tests: add more unit tests and dividers

* feat: implemenet discussed interface

* refactor: move kickMember and setApprovalForMember contents to internal fns

* feat: add batch fns

* refactor: kick -> remove; sounds slightly nicer lmao

* docs: some @dev specifications

* fix: _newLeader -> _member

* tests: fix ci

* tests: add transferTeamLeadership unit tests

* chore: remove unnecessary _from param from transferTeam

* tests: add unit tests for rest of the contract

* chore: run forge fmt

---------

Co-authored-by: e6f4e37l <[email protected]>
  • Loading branch information
Sabnock01 and fiveoutofnine authored Nov 17, 2023
1 parent 1c60d7e commit 88d076c
Show file tree
Hide file tree
Showing 4 changed files with 902 additions and 69 deletions.
154 changes: 86 additions & 68 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,77 +1,95 @@
AuthorshipTokenTest:test_curtaMint() (gas: 85648)
AuthorshipTokenTest:test_curtaMint_SenderIsNotCurta_RevertsUnauthorized(address) (runs: 256, μ: 10204, ~: 10204)
AuthorshipTokenTest:test_ownerMint_FuzzMintTimestamps_IssuesTokensCorrectly(uint256) (runs: 256, μ: 6430685, ~: 5928022)
AuthorshipTokenTest:test_ownerMint_SenderIsNotOwner_RevertUnauthorized(address) (runs: 256, μ: 12935, ~: 12935)
AuthorshipTokenTest:test_curtaMint_SenderIsNotCurta_RevertsUnauthorized(address) (runs: 256, μ: 10248, ~: 10248)
AuthorshipTokenTest:test_ownerMint_FuzzMintTimestamps_IssuesTokensCorrectly(uint256) (runs: 256, μ: 6412423, ~: 5915354)
AuthorshipTokenTest:test_ownerMint_SenderIsNotOwner_RevertUnauthorized(address) (runs: 256, μ: 12979, ~: 12979)
AuthorshipTokenTest:test_ownerMint_SenderIsOwner_AllowsMint() (gas: 108202)
AuthorshipTokenTest:test_tokenURI_MintedToken_Succeeds() (gas: 232)
AuthorshipTokenTest:test_tokenURI_UnmintedToken_Fails() (gas: 12629)
CurtaTest:test_Initialization_DeployAddressesMatch() (gas: 11297)
CurtaTest:test_addPuzzle() (gas: 305332)
CurtaTest:test_addPuzzle_UseAuthorshipToken_UpdatesStorage() (gas: 298535)
CurtaTest:test_addPuzzle_UseSameAuthorshipTokenTwice_Fails() (gas: 299355)
CurtaTest:test_addPuzzle_UseUnownedAuthorshipToken_RevertsUnauthorized() (gas: 199252)
CurtaTest:test_approve() (gas: 434876)
CurtaTest:test_approve_SenderIsNotOwner_RevertsUnauthorized() (gas: 410380)
CurtaTest:test_approve_WithApprovalForAllTrue_AllowsTransfer() (gas: 457096)
CurtaTest:test_balanceOf_ZeroAddress_Fails() (gas: 8674)
CurtaTest:test_setApprovalForAll_False_UpdatesStorage() (gas: 15966)
CurtaTest:test_setApprovalForAll_True_UpdatesStorage() (gas: 35841)
AuthorshipTokenTest:test_tokenURI_MintedToken_Succeeds() (gas: 254)
AuthorshipTokenTest:test_tokenURI_UnmintedToken_Fails() (gas: 12652)
CurtaTest:test_Initialization_DeployAddressesMatch() (gas: 11275)
CurtaTest:test_addPuzzle() (gas: 305309)
CurtaTest:test_addPuzzle_UseAuthorshipToken_UpdatesStorage() (gas: 298512)
CurtaTest:test_addPuzzle_UseSameAuthorshipTokenTwice_Fails() (gas: 299421)
CurtaTest:test_addPuzzle_UseUnownedAuthorshipToken_RevertsUnauthorized() (gas: 199296)
CurtaTest:test_approve() (gas: 434878)
CurtaTest:test_approve_SenderIsNotOwner_RevertsUnauthorized() (gas: 410379)
CurtaTest:test_approve_WithApprovalForAllTrue_AllowsTransfer() (gas: 457095)
CurtaTest:test_balanceOf_ZeroAddress_Fails() (gas: 8718)
CurtaTest:test_setApprovalForAll_False_UpdatesStorage() (gas: 15965)
CurtaTest:test_setApprovalForAll_True_UpdatesStorage() (gas: 35840)
CurtaTest:test_setFermat_AsRandomAccount_Succeeds(address) (runs: 256, μ: 455137, ~: 455137)
CurtaTest:test_setFermat_InitialSet_UpdatesStorage() (gas: 511807)
CurtaTest:test_setFermat_SetAfterTransfer_Succeeds(address) (runs: 256, μ: 876595, ~: 876595)
CurtaTest:test_setFermat_SetDifferentPuzzlesTwiceInIncreasingOrder_Succeeds() (gas: 870154)
CurtaTest:test_setFermat_SetNonFermatPuzzle_Fails() (gas: 780207)
CurtaTest:test_setFermat_SetSamePuzzleTwice_Fails() (gas: 456913)
CurtaTest:test_setFermat_SetUnsolvedPuzzle_Fails() (gas: 300144)
CurtaTest:test_setPuzzleColors() (gas: 306229)
CurtaTest:test_setPuzzleColors_SetUnauthoredPuzzle_RevertsUnauthorized() (gas: 299507)
CurtaTest:test_solve() (gas: 657540)
CurtaTest:test_solve_DuringAllPhases_FirstSolveTimestampOnlySetOnFirstBlood(uint40) (runs: 256, μ: 520949, ~: 520275)
CurtaTest:test_solve_DuringPhase1WithPayment_PaysAuthor(uint256) (runs: 256, μ: 495665, ~: 496974)
CurtaTest:test_solve_DuringPhase2WithPayment_PaysAuthor(uint256) (runs: 256, μ: 533897, ~: 533897)
CurtaTest:test_solve_DuringPhase2_RequiresETH(uint256) (runs: 256, μ: 489577, ~: 487644)
CurtaTest:test_solve_DuringPhase3_Fails(uint40) (runs: 256, μ: 434098, ~: 434098)
CurtaTest:test_setFermat_InitialSet_UpdatesStorage() (gas: 511851)
CurtaTest:test_setFermat_SetAfterTransfer_Succeeds(address) (runs: 256, μ: 876639, ~: 876639)
CurtaTest:test_setFermat_SetDifferentPuzzlesTwiceInIncreasingOrder_Succeeds() (gas: 870131)
CurtaTest:test_setFermat_SetNonFermatPuzzle_Fails() (gas: 780187)
CurtaTest:test_setFermat_SetSamePuzzleTwice_Fails() (gas: 456892)
CurtaTest:test_setFermat_SetUnsolvedPuzzle_Fails() (gas: 300099)
CurtaTest:test_setPuzzleColors() (gas: 306206)
CurtaTest:test_setPuzzleColors_SetUnauthoredPuzzle_RevertsUnauthorized() (gas: 299486)
CurtaTest:test_solve() (gas: 657518)
CurtaTest:test_solve_DuringAllPhases_FirstSolveTimestampOnlySetOnFirstBlood(uint40) (runs: 256, μ: 521015, ~: 520341)
CurtaTest:test_solve_DuringPhase1WithPayment_PaysAuthor(uint256) (runs: 256, μ: 495643, ~: 496952)
CurtaTest:test_solve_DuringPhase2WithPayment_PaysAuthor(uint256) (runs: 256, μ: 533875, ~: 533875)
CurtaTest:test_solve_DuringPhase2_RequiresETH(uint256) (runs: 256, μ: 489257, ~: 487666)
CurtaTest:test_solve_DuringPhase3_Fails(uint40) (runs: 256, μ: 434097, ~: 434097)
CurtaTest:test_solve_FirstBlood_AuthorshipTokenMintPotentialRevertBranch() (gas: 311249)
CurtaTest:test_solve_FirstBlood_MintsAuthorshipToken() (gas: 413358)
CurtaTest:test_solve_FirstBlood_UpdatesFirstSolveTimestamp(uint40) (runs: 256, μ: 407340, ~: 407340)
CurtaTest:test_solve_IncorrectSolution_Fails(uint256) (runs: 256, μ: 309250, ~: 309250)
CurtaTest:test_solve_FirstBlood_MintsAuthorshipToken() (gas: 413335)
CurtaTest:test_solve_FirstBlood_UpdatesFirstSolveTimestamp(uint40) (runs: 256, μ: 407384, ~: 407384)
CurtaTest:test_solve_IncorrectSolution_Fails(uint256) (runs: 256, μ: 309228, ~: 309228)
CurtaTest:test_solve_NonExistantPuzzle_Fails() (gas: 13650)
CurtaTest:test_solve_SamePuzzleTwice_Fails() (gas: 407397)
CurtaTest:test_solve_Success_MintsFlag() (gas: 409078)
CurtaTest:test_solve_Success_UpdatesSolveCounters() (gas: 613748)
CurtaTest:test_solve_Success_UpdatesStorage() (gas: 408000)
CurtaTest:test_supportsInterface() (gas: 8058)
CurtaTest:test_tokenURI_MintedToken_Succeeds() (gas: 234)
CurtaTest:test_tokenURI_UnmintedToken_Fails() (gas: 12952)
CurtaTest:test_transferFrom() (gas: 450609)
CurtaTest:test_transferFrom_SenderIsOwner_AllowsTransfer() (gas: 434582)
CurtaTest:test_transferFrom_ToZeroAddress_Fails() (gas: 407936)
CurtaTest:test_transferFrom_Unauthorized_RevertsUnauthorized() (gas: 412838)
CurtaTest:test_transferFrom_WithApprovalForAllTrue_AllowsTransfer() (gas: 460343)
CurtaTest:test_transferFrom_WithTokenApproval_AllowsTransfer() (gas: 440767)
CurtaTest:test_transferFrom_WrongFrom_Fails() (gas: 407858)
DeployBaseGoerliTest:test_AddressInitializationCorrectness() (gas: 23494)
DeployBaseGoerliTest:test_authorshipTokenAuthorsEquality() (gas: 13651)
DeployBaseGoerliTest:test_authorshipTokenIssueLengthEquality() (gas: 11460)
DeployBaseGoerliTest:test_authorshipTokenMinting() (gas: 108701)
CurtaTest:test_solve_SamePuzzleTwice_Fails() (gas: 407374)
CurtaTest:test_solve_Success_MintsFlag() (gas: 409057)
CurtaTest:test_solve_Success_UpdatesSolveCounters() (gas: 613814)
CurtaTest:test_solve_Success_UpdatesStorage() (gas: 408044)
CurtaTest:test_supportsInterface() (gas: 8102)
CurtaTest:test_tokenURI_MintedToken_Succeeds() (gas: 278)
CurtaTest:test_tokenURI_UnmintedToken_Fails() (gas: 12908)
CurtaTest:test_transferFrom() (gas: 450588)
CurtaTest:test_transferFrom_SenderIsOwner_AllowsTransfer() (gas: 434581)
CurtaTest:test_transferFrom_ToZeroAddress_Fails() (gas: 407958)
CurtaTest:test_transferFrom_Unauthorized_RevertsUnauthorized() (gas: 412860)
CurtaTest:test_transferFrom_WithApprovalForAllTrue_AllowsTransfer() (gas: 460342)
CurtaTest:test_transferFrom_WithTokenApproval_AllowsTransfer() (gas: 440811)
CurtaTest:test_transferFrom_WrongFrom_Fails() (gas: 407902)
DeployBaseGoerliTest:test_AddressInitializationCorrectness() (gas: 23561)
DeployBaseGoerliTest:test_authorshipTokenAuthorsEquality() (gas: 13695)
DeployBaseGoerliTest:test_authorshipTokenIssueLengthEquality() (gas: 11482)
DeployBaseGoerliTest:test_authorshipTokenMinting() (gas: 108745)
DeployBaseGoerliTest:test_authorshipTokenOwnerEquality() (gas: 13799)
DeployBaseGoerliTest:test_curtaOwnerEquality() (gas: 13832)
DeployBaseMainnetTest:test_AddressInitializationCorrectness() (gas: 23494)
DeployBaseMainnetTest:test_authorshipTokenAuthorsEquality() (gas: 27900)
DeployBaseMainnetTest:test_authorshipTokenIssueLengthEquality() (gas: 11460)
DeployBaseMainnetTest:test_authorshipTokenMinting() (gas: 91601)
DeployBaseGoerliTest:test_curtaOwnerEquality() (gas: 13854)
DeployBaseMainnetTest:test_AddressInitializationCorrectness() (gas: 23561)
DeployBaseMainnetTest:test_authorshipTokenAuthorsEquality() (gas: 27944)
DeployBaseMainnetTest:test_authorshipTokenIssueLengthEquality() (gas: 11482)
DeployBaseMainnetTest:test_authorshipTokenMinting() (gas: 91645)
DeployBaseMainnetTest:test_authorshipTokenOwnerEquality() (gas: 13799)
DeployBaseMainnetTest:test_curtaOwnerEquality() (gas: 13832)
DeployGoerliTest:test_AddressInitializationCorrectness() (gas: 23494)
DeployGoerliTest:test_authorshipTokenAuthorsEquality() (gas: 13651)
DeployGoerliTest:test_authorshipTokenIssueLengthEquality() (gas: 11460)
DeployGoerliTest:test_authorshipTokenMinting() (gas: 108701)
DeployBaseMainnetTest:test_curtaOwnerEquality() (gas: 13854)
DeployGoerliTest:test_AddressInitializationCorrectness() (gas: 23561)
DeployGoerliTest:test_authorshipTokenAuthorsEquality() (gas: 13695)
DeployGoerliTest:test_authorshipTokenIssueLengthEquality() (gas: 11482)
DeployGoerliTest:test_authorshipTokenMinting() (gas: 108745)
DeployGoerliTest:test_authorshipTokenOwnerEquality() (gas: 13799)
DeployGoerliTest:test_curtaOwnerEquality() (gas: 13832)
DeployMainnetTest:test_AddressInitializationCorrectness() (gas: 23494)
DeployMainnetTest:test_authorshipTokenAuthorsEquality() (gas: 227362)
DeployMainnetTest:test_authorshipTokenIssueLengthEquality() (gas: 11460)
DeployMainnetTest:test_authorshipTokenMinting() (gas: 91601)
DeployGoerliTest:test_curtaOwnerEquality() (gas: 13854)
DeployMainnetTest:test_AddressInitializationCorrectness() (gas: 23561)
DeployMainnetTest:test_authorshipTokenAuthorsEquality() (gas: 227406)
DeployMainnetTest:test_authorshipTokenIssueLengthEquality() (gas: 11482)
DeployMainnetTest:test_authorshipTokenMinting() (gas: 91645)
DeployMainnetTest:test_authorshipTokenOwnerEquality() (gas: 13799)
DeployMainnetTest:test_curtaOwnerEquality() (gas: 13832)
OptimizationsTest:testFuzzComputePhaseFromTimestampBranchlessOptimization(uint40,uint40) (runs: 256, μ: 3545, ~: 3531)
DeployMainnetTest:test_curtaOwnerEquality() (gas: 13854)
OptimizationsTest:testFuzzComputePhaseFromTimestampBranchlessOptimization(uint40,uint40) (runs: 256, μ: 3602, ~: 3575)
TeamRegistyTest:test_batchRemoveMember() (gas: 214233)
TeamRegistyTest:test_batchRemoveMember_NotTeamLeader_Fails() (gas: 203684)
TeamRegistyTest:test_batchRemoveMember_NotTeamMember_Fails() (gas: 172041)
TeamRegistyTest:test_batchSetApprovalForMember() (gas: 226223)
TeamRegistyTest:test_batchSetApprovalForMember_NotTeamLeader_Fails() (gas: 203751)
TeamRegistyTest:test_createTeam(address[]) (runs: 256, μ: 3891165, ~: 3862258)
TeamRegistyTest:test_createTeam_TeamLeaderCreatesNewTeam_Fails() (gas: 175521)
TeamRegistyTest:test_removeMember() (gas: 181050)
TeamRegistyTest:test_removeMember_NotTeamLeader_Fails() (gas: 200049)
TeamRegistyTest:test_removeMember_NotTeamMember_Fails() (gas: 176628)
TeamRegistyTest:test_setApprovalForMember() (gas: 200305)
TeamRegistyTest:test_setApprovalForMember_NotTeamLeader_Fails() (gas: 200144)
TeamRegistyTest:test_transferTeam() (gas: 204160)
TeamRegistyTest:test_transferTeamLeadership() (gas: 219736)
TeamRegistyTest:test_transferTeamLeadership_NotTeamLeader_Fails() (gas: 200050)
TeamRegistyTest:test_transferTeamLeadership_NotTeamMember_Fails() (gas: 176599)
TeamRegistyTest:test_transferTeam_ApprovalFalse_Fails() (gas: 174483)
TeamRegistyTest:test_transferTeam_IsTeamLeader_Fails() (gas: 170816)
Loading

0 comments on commit 88d076c

Please sign in to comment.