Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Send claimed market fees to factory owner #79

Merged
merged 3 commits into from
Aug 28, 2023

Conversation

arjun-io
Copy link
Collaborator

No description provided.

@arjun-io arjun-io requested a review from kbrizzle August 25, 2023 18:26
/// @param receiver The address to receive the fee
/// @param fee The amount of the fee to claim
function _claimFee(address receiver, UFixed6 fee) private returns (bool) {
if (msg.sender != receiver) return false;
if (msg.sender == address(factory())) receiver = factory().owner();
Copy link
Collaborator

Choose a reason for hiding this comment

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

you should just pass in factory().owner() in the above method instead, in the protocolFee clause

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see - then should we also remove the fund method in the Factory since it's not longer possible to use it to claim the fees?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah good catch let's remove that too

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@arjun-io arjun-io requested a review from kbrizzle August 28, 2023 02:08
@github-actions
Copy link

[Payoff] Integration Test Code Coverage Report

Coverage after merging arjun/claim-protocol-fee-to-owner into main will be
100.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-payoff/contracts
   PayoffFactory.sol100%100%100%100%
packages/perennial-payoff/contracts/interfaces
   IPayoffFactory.sol100%100%100%100%
packages/perennial-payoff/contracts/payoff
   Giga.sol100%100%100%100%
   Kilo.sol100%100%100%100%
   KiloPowerHalf.sol100%100%100%100%
   KiloPowerTwo.sol100%100%100%100%
   Mega.sol100%100%100%100%
   MegaPowerTwo.sol100%100%100%100%
   Micro.sol100%100%100%100%
   MicroPowerTwo.sol100%100%100%100%
   Milli.sol100%100%100%100%
   MilliPowerHalf.sol100%100%100%100%
   MilliPowerTwo.sol100%100%100%100%
   Nano.sol100%100%100%100%
   PowerHalf.sol100%100%100%100%
   PowerTwo.sol100%100%100%100%

@github-actions
Copy link

[Payoff] Unit Test Code Coverage Report

Coverage after merging arjun/claim-protocol-fee-to-owner into main will be
100.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-payoff/contracts
   PayoffFactory.sol100%100%100%100%
packages/perennial-payoff/contracts/interfaces
   IPayoffFactory.sol100%100%100%100%
packages/perennial-payoff/contracts/payoff
   Giga.sol100%100%100%100%
   Kilo.sol100%100%100%100%
   KiloPowerHalf.sol100%100%100%100%
   KiloPowerTwo.sol100%100%100%100%
   Mega.sol100%100%100%100%
   MegaPowerTwo.sol100%100%100%100%
   Micro.sol100%100%100%100%
   MicroPowerTwo.sol100%100%100%100%
   Milli.sol100%100%100%100%
   MilliPowerHalf.sol100%100%100%100%
   MilliPowerTwo.sol100%100%100%100%
   Nano.sol100%100%100%100%
   PowerHalf.sol100%100%100%100%
   PowerTwo.sol100%100%100%100%

@github-actions
Copy link

[Oracle] Unit Test Coverage Report

Coverage after merging arjun/claim-protocol-fee-to-owner into main will be
82.31%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-oracle/contracts
   Oracle.sol100%100%100%100%
   OracleFactory.sol100%100%100%100%
packages/perennial-oracle/contracts/interfaces
   IOracle.sol100%100%100%100%
   IOracleFactory.sol100%100%100%100%
   IPythFactory.sol100%100%100%100%
   IPythOracle.sol100%100%100%100%
packages/perennial-oracle/contracts/pyth
   PythFactory.sol57.14%31.82%77.78%72%100, 106, 117, 44, 53, 60–61, 75, 84, 89, 89–91, 91, 91–92, 92, 92–93, 93, 93, 95
   PythOracle.sol55.17%36.96%73.33%65.45%115–116, 122, 122, 122, 133, 138–139, 144, 148–149, 151, 151, 151, 154, 154, 154, 177, 177, 177, 182–183, 186, 189–190, 190, 190, 192, 192, 192–193, 193, 193–195, 195, 195, 195, 195, 197–198, 237, 66, 70, 76, 81, 83, 93

@github-actions
Copy link

[Vault] Unit Test Coverage Report

Coverage after merging arjun/claim-protocol-fee-to-owner into main will be
31.88%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-vault/contracts
   Vault.sol0%0%0%0%103, 109–110, 118–119, 128, 130, 130, 130, 137, 139, 139, 139, 144, 144–145, 147–148, 148, 148, 151, 157, 157, 157–158, 158, 158, 160, 162–164, 171, 171–172, 174, 174, 174, 176–180, 185, 185–186, 188–189, 194, 194–197, 204, 204–206, 208–210, 223, 223–225, 227–230, 236–237, 237, 237–240, 242, 260, 260, 260–261, 261, 261, 264, 264, 264–266, 266, 266–268, 268, 268–270, 270, 270–272, 272, 272–274, 274, 274–275, 277, 277, 277, 280, 283–285, 288–290, 292, 306, 306, 306–308, 310, 310, 310, 315–316, 331, 335–338, 340, 346, 350, 350, 350, 354–356, 369, 371, 371, 371, 371, 371, 373, 379–380, 380, 380–383, 383, 383–384, 391, 394, 396, 406, 420, 422–425, 427, 429–432, 435–436, 438–441, 444–445, 448–449, 452–454, 461–463, 470, 470, 470–472, 480, 480, 480, 482–485, 487, 487, 487, 487, 487, 489, 494, 501–503, 513–515, 517–519, 58, 58–59, 61–63, 69, 76, 83, 90, 97
   VaultFactory.sol0%0%0%0%23, 27, 27–28, 40, 40–42, 49–50
packages/perennial-vault/contracts/interfaces
   IVault.sol100%100%100%100%
   IVaultFactory.sol100%100%100%100%
packages/perennial-vault/contracts/lib
   StrategyLib.sol0%0%0%0%101–104, 106, 108–109, 111–112, 126–128, 137, 64–66, 68, 70–73, 76, 80, 80, 80–81, 81, 85, 87
packages/perennial-vault/contracts/types
   Account.sol100%100%100%100%
   Checkpoint.sol100%100%100%100%
   Mapping.sol100%100%100%100%
   Registration.sol100%100%100%100%
   VaultParameter.sol100%100%100%100%

@github-actions
Copy link

[Extensions] Unit Test Coverage Report

Coverage after merging arjun/claim-protocol-fee-to-owner into main will be
82.40%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-extensions/contracts
   MultiInvoker.sol78.28%72.86%85.71%80.37%104, 143–144, 147–149, 151, 156, 222, 224, 233, 273, 273, 275, 278, 287, 287, 289, 292, 310, 312, 312, 312–313, 315, 320, 328–329, 331, 357, 360–362, 377, 382, 405, 77, 80–82
packages/perennial-extensions/contracts/interfaces
   IMultiInvoker.sol100%100%100%100%
packages/perennial-extensions/contracts/types
   TriggerOrder.sol78.26%62.50%100%94.44%34–35, 61–68

@github-actions
Copy link

[Core] Integration Test Coverage Report

Coverage after merging arjun/claim-protocol-fee-to-owner into main will be
92.60%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial/contracts
   Market.sol76.17%57%88.57%85.28%100–101, 106, 113, 120–122, 131, 133, 133, 133–134, 134, 134–136, 136, 136–137, 137, 137, 139, 146, 146, 146, 148–150, 155, 157–158, 160–161, 252–254, 393, 438, 477–478, 478, 478, 478, 487–488, 493–494, 496–497, 501, 507–508, 508, 517, 521, 532, 538–539, 556–557, 60, 605, 610, 83, 92, 99, 99
   MarketFactory.sol69.70%50%83.33%80%37, 48, 57–58, 64, 66, 72, 75–76
packages/perennial/contracts/interfaces
   IMarket.sol100%100%100%100%
   IMarketFactory.sol100%100%100%100%
   IOracleProvider.sol100%100%100%100%
   IOracleProviderFactory.sol100%100%100%100%
   IPayoffProvider.sol100%100%100%100%
packages/perennial/contracts/types
   Global.sol78.57%50%100%100%114–125
   Local.sol80%56.25%83.33%95.65%127–132, 89, 97
   MarketParameter.sol69.57%40.91%100%95%112, 114–115, 117, 119, 121, 121, 121, 121, 133–137
   OracleVersion.sol100%100%100%100%
   Order.sol88.46%70%100%100%73, 79, 98
   Position.sol88.52%60%96.88%98.33%200, 218, 275, 443–452
   ProtocolParameter.sol75%50%100%100%59–60, 66–70
   RiskParameter.sol73.91%50%100%100%133, 138, 143, 145, 150, 152, 154, 156, 166–169
   Version.sol90.18%70.59%100%98.57%192–193, 361–369

@github-actions
Copy link

[Extensions] Integration Test Coverage Report

Coverage after merging arjun/claim-protocol-fee-to-owner into main will be
99.20%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-extensions/contracts
   MultiInvoker.sol96.97%91.43%100%100%156, 275, 289, 357, 377, 77
packages/perennial-extensions/contracts/interfaces
   IMultiInvoker.sol100%100%100%100%
packages/perennial-extensions/contracts/types
   TriggerOrder.sol89.13%83.33%100%94.44%34–35, 61–63

@github-actions
Copy link

[Vault] Integration Test Coverage Report

Coverage after merging arjun/claim-protocol-fee-to-owner into main will be
98.91%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-vault/contracts
   Vault.sol96.89%94.12%96.88%98.09%194, 194–197, 261, 277
   VaultFactory.sol85.71%50%100%100%27, 40
packages/perennial-vault/contracts/interfaces
   IVault.sol100%100%100%100%
   IVaultFactory.sol100%100%100%100%
packages/perennial-vault/contracts/lib
   StrategyLib.sol100%100%100%100%
packages/perennial-vault/contracts/types
   Account.sol82.86%50%100%100%126–131
   Checkpoint.sol88.64%68.75%100%100%132, 186, 224–231
   Mapping.sol95.12%80%100%100%100, 95
   Registration.sol81.82%50%100%100%41–42
   VaultParameter.sol87.50%50%100%100%31

@github-actions
Copy link

[Core] Unit Test Coverage Report

Coverage after merging arjun/claim-protocol-fee-to-owner into main will be
99.76%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial/contracts
   Market.sol99.66%99%100%100%83
   MarketFactory.sol100%100%100%100%
packages/perennial/contracts/interfaces
   IMarket.sol100%100%100%100%
   IMarketFactory.sol100%100%100%100%
   IOracleProvider.sol100%100%100%100%
   IOracleProviderFactory.sol100%100%100%100%
   IPayoffProvider.sol100%100%100%100%
packages/perennial/contracts/types
   Global.sol100%100%100%100%
   Local.sol95.56%100%83.33%95.65%97
   MarketParameter.sol100%100%100%100%
   OracleVersion.sol100%100%100%100%
   Order.sol100%100%100%100%
   Position.sol100%100%100%100%
   ProtocolParameter.sol100%100%100%100%
   RiskParameter.sol100%100%100%100%
   Version.sol100%100%100%100%

@github-actions
Copy link

[Oracle] Integration Test Coverage Report

Coverage after merging arjun/claim-protocol-fee-to-owner into main will be
71.43%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-oracle/contracts
   Oracle.sol22.78%16.67%33.33%24.32%100, 102, 102, 102–103, 110–111, 113, 113, 113–114, 114, 114, 116, 121, 121, 121–123, 20, 28, 28–30, 35, 35–36, 38–40, 47–48, 53, 58, 65, 65, 65–68, 68, 68–69, 71, 77, 85, 95, 95, 95, 97–98, 98, 98
   OracleFactory.sol43.06%28.13%60%53.33%103–105, 105, 105–106, 112, 112, 112–113, 33, 41, 48, 48–50, 57–59, 62, 73, 73–74, 74, 74–75, 75, 75, 77–78, 78, 78, 80–81, 85, 94–95
packages/perennial-oracle/contracts/interfaces
   IOracle.sol100%100%100%100%
   IOracleFactory.sol100%100%100%100%
   IPythFactory.sol100%100%100%100%
   IPythOracle.sol100%100%100%100%
packages/perennial-oracle/contracts/pyth
   PythFactory.sol89.29%72.73%100%100%106, 117, 44, 53, 60, 89
   PythOracle.sol98.28%95.65%100%100%133, 224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants