-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* protocol fees tests * more tests * underscore for internal var * protocol fees tests * re-add view * gas snapshot * slot0 verify * shorten * comments * extra comment * fix snapshot
- Loading branch information
1 parent
48f79bc
commit 3351c80
Showing
6 changed files
with
286 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
32415 | ||
32444 |
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,36 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.20; | ||
|
||
import {ProtocolFees} from "../ProtocolFees.sol"; | ||
import {IProtocolFeeController} from "../interfaces/IProtocolFeeController.sol"; | ||
import {PoolKey} from "../types/PoolKey.sol"; | ||
import {Currency} from "../types/Currency.sol"; | ||
import {PoolId, PoolIdLibrary} from "../types/PoolId.sol"; | ||
import {Pool} from "../libraries/Pool.sol"; | ||
import {Slot0} from "../types/Slot0.sol"; | ||
|
||
contract ProtocolFeesImplementation is ProtocolFees { | ||
using PoolIdLibrary for PoolKey; | ||
|
||
mapping(PoolId id => Pool.State) internal _pools; | ||
|
||
constructor(uint256 _controllerGasLimit) ProtocolFees(_controllerGasLimit) {} | ||
|
||
// Used to set the price of a pool to pretend that the pool has been initialized in order to successfully set a protocol fee | ||
function setPrice(PoolKey memory key, uint160 sqrtPriceX96) public { | ||
Pool.State storage pool = _getPool(key.toId()); | ||
pool.slot0 = pool.slot0.setSqrtPriceX96(sqrtPriceX96); | ||
} | ||
|
||
function _getPool(PoolId id) internal view override returns (Pool.State storage) { | ||
return _pools[id]; | ||
} | ||
|
||
function fetchProtocolFee(PoolKey memory key) public returns (bool, uint24) { | ||
return ProtocolFees._fetchProtocolFee(key); | ||
} | ||
|
||
function updateProtocolFees(Currency currency, uint256 amount) public { | ||
ProtocolFees._updateProtocolFees(currency, amount); | ||
} | ||
} |
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
Oops, something went wrong.