-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: test fee collector with clientTakeRate
- Loading branch information
Showing
8 changed files
with
298 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.21; | ||
|
||
// External Imports | ||
import { Test } from "forge-std/Test.sol"; | ||
|
||
// Local Imports | ||
import { CLIENT_RATE } from "test/common/Constants.t.sol"; | ||
|
||
contract FeeUtils is Test { | ||
function _getExpectedClientAllocations(uint256 _maxFee, uint256 _clientTakeRate) | ||
internal | ||
pure | ||
returns (uint256 userSavings, uint256 clientFee) | ||
{ | ||
uint256 userTakeRate = 100 - _clientTakeRate; | ||
uint256 userPercentOfProtocolFee = (userTakeRate * CLIENT_RATE) / 100; | ||
userSavings = (userPercentOfProtocolFee * _maxFee) / 100; | ||
|
||
// 2. Calculate client fee | ||
uint256 maxClientFee = (_maxFee * CLIENT_RATE) / 100; | ||
clientFee = maxClientFee - userSavings; | ||
} | ||
} |
Oops, something went wrong.