Skip to content

Commit

Permalink
fix: Add ERC6909 support (#447)
Browse files Browse the repository at this point in the history
* forge install: erc-6909

* migrate 1155 to 6909

* rm old 6909

* forge install: erc-6909

* add event arg

* rm old 6909

* forge install: erc-6909

* update test event

* Add gas snaps

* squash: support arbitrary calldata on test routers (#361)

* Chore: update licenses (#364)

* chore: update README

* chore: update interface licenses

* chore: update Hooks.sol license

* chore: update types licenses

* Migrate SwapMath tests to foundry (#363)

* write SwapMath Tests

* write gas snapshots tests

* delete SwapMath hardhat implementation

* eliminate SwapMathTest + add gas snapshots

* delete js snapshots

* migrate echidna test

* forge fmt

* test titles

* remove console import

---------

Co-authored-by: Job Mwitah <[email protected]>
Co-authored-by: Mwitah <[email protected]>

* add base hook for tests (#377)

* change natspec to ILockCallback.lockAcquired (#376)

* feat: update to solidity 0.8.22 (#378)

- Enforce evm_version to avoid compiling push0
- Remove unchecked loops which are unchecked by default in 0.8.22

* Cache dynamic fee in slot0 (#360)

* Bug: Require different currencies (#380)

* Require different currencies

* hardhat snapshots

* Add new custom type function

* remove extra paren

* Replace MockERC20 with solmate's MockERC20 (#374)

* rename MockERC20 -> UniMockERC20

* remove UniMockERC20 in favor of solmate/MockERC20

* update snapshots

* Fixing compiler warnings (#386)

* fix: add gas snaps for swaps with 1155 as input/output (#383)

* Add snaps for 1155 swaps

* remove lib

* Add gas prefix

* Delete Hardhat (#372)

Co-authored-by: Sara Reynolds <[email protected]>
Co-authored-by: Alice <[email protected]>
Co-authored-by: Sara Reynolds <[email protected]>

* feat: use standard forge directory structure (#389)

* feat: standard foundry directory structure

This commit moves to the standard foundry directory structure with
contracts in src/ and tests in test/.

* feat: remove JS stuff

* fix: remove out dir

* fix: workflows

* fix: re-add js scripts

* fix: add back js stuff

* feat: yarn lock

* fix: alice comments

* Improve forge tests (#391)

* Updating lots of tests

* Fixed final test

* remove console2

* mark PR comment

* Fix Issue #397: Incorrect Documentation (#399)

* feat: move whitepapers to docs dir to cleanup root (#393)

* feat: move whitepapers to docs dir to cleanup root

* fix: remove draft so links dont break

* add snapshots to CI with tolerance (#401)

* Implement Claims accounting as minimal balance (#379)

* Add MinimalBalance

* Initial commmit

* Router custodies Claims, has access to priviledged burnFrom anbd tests

* updategas

* remove 6909 lib

* yarn snapshots

* Add gas snaps for swapping from claims balance

* fix gas snaps by removing aux logic in router

* gas

* remove lib

* Add transfer to minimalBalance, update tests

* nit: rename

* add back custom errors

* move addition out of unchecked

* Add transfer overflow check

* Rename impl test

* nit comments

* comment#

* Remove unused inheritance

* remove comment

* Remove poolClaimTest

* fix interfaces

* Feedback

* Add address(0) and address(this) check for transfer

* remove address(0) check

* Remove batchBurn

* Move mock claims to diff file

* Add gas snaps for collect protocol fees

* Add balance checks, make balances mapping private

* Fix imports

* fix fs perms

* Remove uint256 in mapping and use Currency

* feedback

* Add gas snaps

* fix: whitepaper link (#400)

I accidentally broke the link from readme

* Add solc binaries and transient storage lock library (#395)

* Updated solc setup and instructions (#406)

* Added contribution instructions

* missing space

* Updated solc config

* feat: move JS scripts to subdir and add helper (#405)

This commit moves our JS helper scripts into a test subdirectory and
adds a helper abstract contract to more easily build the ffi commands to
interop with javascript testers

* Set tick spacing range as constants (#369)

* Set tick spacing range as constants

While tick and tick spacing both use int24 as their type, each has a
different range. Tick spacing has a range of [1, 32767].
This commit updates Tick test cases to use proper tick spacing range
instead that of tick.

Resolves issue #371

* Restore a unit test on tick spacing liquidity

This commit adds back the unit test that checks for tick spacing
liquidity given the entire tick range as the input argument.
This is an alternative change mentioned on the issue referred below.

resolves #369

* Remove duplicate constants from test suite

This commit moves MIN_TICK, MAX_TICK, MIN_TICK_SPACING, and
MAX_TICK_SPACING constants from test suite constants file to TickMath
library. Previous to this commit, TickMath library declared MIN_TICK and
MAX_TICK constants with the same value from the test suite constants
file. Removing duplicate constants from the test file and referencing
them from the production file prevents future dicrepancies between
production and test environments.

* Remove unused import

* Remove unnecessary override keywords

* Update forge snapshots

* Part 1: Improve forge tests (#407)

* Revert messages

* Common take and settle contract for tests

* improving swap and take tests

* add asserts for modify position

* extra asserts in modify position

* asserts in donate test

* More deployment helpers

* native set up in deployer

* simplify initialize tests

* few more corrections

* more cleanup

* remove console logs

* snapshots and test fix post merge

* snapshots

* accidentally pushed foundry.toml

* PR comments

* remove forge snapshot --check (#417)

* feat: update justfile with custom solc (#418)

For folks who dont want to update their global env they can use `just
test` or `just build` which sets solc using cli arg

* Fix typos (#365)

* Fix typos

* Fix typo in src/libraries/Lockers.sol

* Update just prep and build (#421)

* udpate prep and add build

* Update justfile

* fix tests

* remove totalsupply

* remove lib

* remove solmate

* forge install: solmate

main

* Add comment

* Add solmate 6909 and remove claims

* feat: add variadic args to justfile (#423)

allows to pass on args to forge i.e. `forge test --mt fuzz`

* move up settle and remove solmate

* forge install: solmate

* copy erc6909 locally and use _mint and _burn

* forge fmt

* remove lib

* forge install: solmate

v6

* rmeove solmate

* forge install: solmate

2001af43ae

* fix gas snaps

* remove unchecked without totalSupply

* Lock on initialize (#424)

* Lock on initialize

* Rename initialize error

* fix CI fuzz edge case

* NoOp implementation with flag (#324)

* cherrypicking

* tests running and update snaps

* test supoprt

* format and run hardhat tests

* remove irrelevant comment

* test noops

* add tests for noop

* lint and snapshots

* fix hook tests

* clean

* foundry toml

* helper function

* Revert early if pool isnt initialized

* Extra tests

* Tests NoOps on disallowed hooks fail

* linting

* snapshots

* helper function for initialized pool

* PR comments

* PR comment test coverage

* Final PR comments

* comments about sentinel value

* Fix masking tests

* decrease calls to assume

---------

Co-authored-by: Alex <[email protected]>
Co-authored-by: hensha256 <[email protected]>

* update testss

* rm solmate

* forge install: solmate

main

* Use solmate 6909

* fmt

* cache msg sender

* Explain different solc options (#429)

* explain solc options

* Add reference in readme

* random linting issue

* Access lock (#404)

* Fix broken tests that were using old claims balance format

* Add V46909 and reorder params

* Add V46909 and Mock contract for test

* Add revert tests

* burnFrom internal

* remove old gas snaps and add native tests

* feat: add lock target (#300)

* feat: add lock target

* feat: store lockOriginator

* fix: tests

* feat: lockOriginator => lockCaller

* feat: add invalid locker tests

* fix: remove unused params

* fix tests and snaps

* forge fmt

* expectEmit() all

* expect emit all

* Prevent ProtocolFeeController from bricking pool initialization on revert (#362)

* Default protocol fees to 0 if protocolFeeController reverts

* snapshots

* fix comment

* add another malicious contract

* remove useless var assignment

* make call and decode return in assembly

* fix typo in var assingmenet

* clean up tests

* update snapshots#

* check withdrawFee == 0 on tests too

* add test

* separate out fetchProtocolFees and checkProtocolFees

* manually revert in setProtocolFees

* Add success return value to fetchProtocolFEes

* Add test for FeeTooLarge passing on initialzie but not on setProtocolFees

* check low level call success

* clean up

* add comment

* simplify

* udpate snaps

* fix compiler warnings

* fix result type

* fix formatting

* Add more descriptive error message

* Change error name again

* Add comments

* update gas specs

* fix merge conflict t4ests

* fix tests

* Add tests for setProtocolFee with invalid controllers

* Add missing snaps

* Feedback changes

* fix initialize tests

* fix fmt

* Fix comment

* comments and revise order

---------

Co-authored-by: Sara Reynolds <[email protected]>

* feedback

* Add IERC69009, does not compile

* Revert "Add IERC69009, does not compile"

This reverts commit 4e89408.

* added delta overflow checks (#433)

* add pool getters (#438)

* add getters

* update snaps

* clean test

* A few cleanup tasks (#437)

* Fix compiler warnings

* todo for mapping transient

* fixing tests with fuzzing

* remove console logs

* Update PoolDonateTest.sol

* remove amount overload

---------

Co-authored-by: Sara Reynolds <[email protected]>

* Remove hook fees and protocol fee on withdrawal (#432)

* Remove hook fees and protocol fee on withdrawal

* hook fee tests

* Update AccessLockHook.sol

* assume -> bound

* more comments on fee grnaularity

* refactor: hooks callsites (#439)

* feat: hooks refactor

* fix: tests

* feat: noop -> shouldExecute

* fix: remove shouldCall functions for helper

* fix: using for in test

* fix: alice comment

* merge conflicts

* fix fialing test

* Copy solmate 6909 locally to get interface inheritance

* natspec

* expose getters in pool interface

* Use id for mint/burn instead of currency

* forge fmt

* Add burnFrom no approval test

* feedback

* feedback

* forge install: ERC-6909

main

* remove lib

* Add commit SHA

* merge conflicts galore

* forge install: solmate

4b47a19038b798b4a33d9749d25e570443520647

* fix conflict

* fix libs

* del

* forge install: openzeppelin-contracts

v4.4.2

* fix tests from conflcits and gas

* forge fmt

* removed unused file

* fix: faling fuzz tests (#441)

* Add failing fuzz test

* Add bounds

* added out of range checks

* changed assume to bound

* forge fmt

* changed Position -> Liquidity on merge main

* moved amount helper to utils

---------

Co-authored-by: Austin Adams <[email protected]>

* fix gas snap

* forge test

* feedback

---------

Co-authored-by: jtriley.eth <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: Erin Koen <[email protected]>
Co-authored-by: Emily Williams <[email protected]>
Co-authored-by: Job Mwitah <[email protected]>
Co-authored-by: Mwitah <[email protected]>
Co-authored-by: Sara Reynolds <[email protected]>
Co-authored-by: Ed Mazurek <[email protected]>
Co-authored-by: marktoda <[email protected]>
Co-authored-by: Alice <[email protected]>
Co-authored-by: Sara Reynolds <[email protected]>
Co-authored-by: Jose Carlos Montero Gomez <[email protected]>
Co-authored-by: hyunchel <[email protected]>
Co-authored-by: xiaolou86 <[email protected]>
Co-authored-by: emma <[email protected]>
Co-authored-by: Alex <[email protected]>
Co-authored-by: hensha256 <[email protected]>
Co-authored-by: Austin Adams <[email protected]>
Co-authored-by: Austin Adams <[email protected]>
  • Loading branch information
20 people authored Dec 16, 2023
1 parent 99cd9d5 commit 1f350fa
Show file tree
Hide file tree
Showing 52 changed files with 715 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/addLiquidity with empty hook.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
323249
323277
2 changes: 1 addition & 1 deletion .forge-snapshots/addLiquidity with native token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
200141
200111
2 changes: 1 addition & 1 deletion .forge-snapshots/addLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
200109
200079
Original file line number Diff line number Diff line change
@@ -1 +1 @@
194300
194367
2 changes: 1 addition & 1 deletion .forge-snapshots/cached dynamic fee, no hooks.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
146667
146705
2 changes: 1 addition & 1 deletion .forge-snapshots/donate gas with 1 token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
137771
137750
2 changes: 1 addition & 1 deletion .forge-snapshots/donate gas with 2 tokens.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
185216
185163
2 changes: 1 addition & 1 deletion .forge-snapshots/erc20 collect protocol fees.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
27033
27001
2 changes: 1 addition & 1 deletion .forge-snapshots/gas overhead of no-op lock.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15224
15223
2 changes: 1 addition & 1 deletion .forge-snapshots/initialize.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
74200
74274
2 changes: 1 addition & 1 deletion .forge-snapshots/mint with empty hook.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
323262
323262
2 changes: 1 addition & 1 deletion .forge-snapshots/mint with native token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
200100
200100
2 changes: 1 addition & 1 deletion .forge-snapshots/mint.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
200042
200042
2 changes: 1 addition & 1 deletion .forge-snapshots/mintWithEmptyHookEOAInitiated.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
255129
255189
2 changes: 1 addition & 1 deletion .forge-snapshots/modify position with noop.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
58013
58076
2 changes: 1 addition & 1 deletion .forge-snapshots/native collect protocol fees.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
38699
38667
2 changes: 1 addition & 1 deletion .forge-snapshots/poolManager bytecode size.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23823
25102
2 changes: 1 addition & 1 deletion .forge-snapshots/removeLiquidity with empty hook.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
106962
106952
2 changes: 1 addition & 1 deletion .forge-snapshots/removeLiquidity with native token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
208322
208312
2 changes: 1 addition & 1 deletion .forge-snapshots/removeLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
204612
204602
2 changes: 1 addition & 1 deletion .forge-snapshots/simple swap with native.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
195638
195676
2 changes: 1 addition & 1 deletion .forge-snapshots/simple swap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
204206
204244
2 changes: 1 addition & 1 deletion .forge-snapshots/simpleSwapEOAInitiated.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
173543
174149
2 changes: 1 addition & 1 deletion .forge-snapshots/simpleSwapNativeEOAInitiated.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
172131
172798
Original file line number Diff line number Diff line change
@@ -1 +1 @@
126266
126304
2 changes: 1 addition & 1 deletion .forge-snapshots/swap against liquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
113757
113795
1 change: 1 addition & 0 deletions .forge-snapshots/swap burn 6909 for input.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
133995
2 changes: 1 addition & 1 deletion .forge-snapshots/swap burn claim for input.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
132930
132930
1 change: 1 addition & 0 deletions .forge-snapshots/swap burn native 6909 for input.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
129926
1 change: 1 addition & 0 deletions .forge-snapshots/swap mint native output as 6909.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
198205
1 change: 1 addition & 0 deletions .forge-snapshots/swap mint output as 6909.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
215075
2 changes: 1 addition & 1 deletion .forge-snapshots/swap mint output as claim.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
216399
216399
2 changes: 1 addition & 1 deletion .forge-snapshots/swap with dynamic fee.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
193401
193468
2 changes: 1 addition & 1 deletion .forge-snapshots/swap with hooks.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
113735
113773
1 change: 0 additions & 1 deletion .forge-snapshots/swap with native.snap

This file was deleted.

2 changes: 1 addition & 1 deletion .forge-snapshots/swap with noop.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
51304
51425
2 changes: 1 addition & 1 deletion .forge-snapshots/update dynamic fee in before swap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
200144
200232
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
[submodule "lib/forge-gas-snapshot"]
path = lib/forge-gas-snapshot
url = https://github.com/marktoda/forge-gas-snapshot
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
tag = v4.4.2
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
100 changes: 100 additions & 0 deletions src/ERC6909.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import {IERC6909Claims} from "./interfaces/external/IERC6909Claims.sol";

/// @notice Minimalist and gas efficient standard ERC6909 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC6909.sol)
/// @dev Copied from the commit at 4b47a19038b798b4a33d9749d25e570443520647
/// @dev This contract has been modified from the implementation at the above link.
abstract contract ERC6909 is IERC6909Claims {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/

event OperatorSet(address indexed owner, address indexed operator, bool approved);

event Approval(address indexed owner, address indexed spender, uint256 indexed id, uint256 amount);

event Transfer(address caller, address indexed from, address indexed to, uint256 indexed id, uint256 amount);

/*//////////////////////////////////////////////////////////////
ERC6909 STORAGE
//////////////////////////////////////////////////////////////*/

mapping(address => mapping(address => bool)) public isOperator;

mapping(address => mapping(uint256 => uint256)) public balanceOf;

mapping(address => mapping(address => mapping(uint256 => uint256))) public allowance;

/*//////////////////////////////////////////////////////////////
ERC6909 LOGIC
//////////////////////////////////////////////////////////////*/

function transfer(address receiver, uint256 id, uint256 amount) public virtual returns (bool) {
balanceOf[msg.sender][id] -= amount;

balanceOf[receiver][id] += amount;

emit Transfer(msg.sender, msg.sender, receiver, id, amount);

return true;
}

function transferFrom(address sender, address receiver, uint256 id, uint256 amount) public virtual returns (bool) {
if (msg.sender != sender && !isOperator[sender][msg.sender]) {
uint256 allowed = allowance[sender][msg.sender][id];
if (allowed != type(uint256).max) allowance[sender][msg.sender][id] = allowed - amount;
}

balanceOf[sender][id] -= amount;

balanceOf[receiver][id] += amount;

emit Transfer(msg.sender, sender, receiver, id, amount);

return true;
}

function approve(address spender, uint256 id, uint256 amount) public virtual returns (bool) {
allowance[msg.sender][spender][id] = amount;

emit Approval(msg.sender, spender, id, amount);

return true;
}

function setOperator(address operator, bool approved) public virtual returns (bool) {
isOperator[msg.sender][operator] = approved;

emit OperatorSet(msg.sender, operator, approved);

return true;
}

/*//////////////////////////////////////////////////////////////
ERC165 LOGIC
//////////////////////////////////////////////////////////////*/

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == 0x01ffc9a7 // ERC165 Interface ID for ERC165
|| interfaceId == 0x0f632fb3; // ERC165 Interface ID for ERC6909
}

/*//////////////////////////////////////////////////////////////
INTERNAL MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/

function _mint(address receiver, uint256 id, uint256 amount) internal virtual {
balanceOf[receiver][id] += amount;

emit Transfer(msg.sender, address(0), receiver, id, amount);
}

function _burn(address sender, uint256 id, uint256 amount) internal virtual {
balanceOf[sender][id] -= amount;

emit Transfer(msg.sender, sender, address(0), id, amount);
}
}
23 changes: 23 additions & 0 deletions src/ERC6909Claims.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import {ERC6909} from "./ERC6909.sol";

/// @notice ERC6909Claims inherits ERC6909 and implements an internal burnFrom function
abstract contract ERC6909Claims is ERC6909 {
/// @notice Burn `amount` tokens of token type `id` from `from`.
/// @dev if sender is not `from` they must be an operator or have sufficient allowance.
/// @param from The address to burn tokens from.
/// @param id The currency to burn.
/// @param amount The amount to burn.
function _burnFrom(address from, uint256 id, uint256 amount) internal {
address sender = msg.sender;
if (from != sender && !isOperator[from][sender]) {
uint256 senderAllowance = allowance[from][sender][id];
if (senderAllowance != type(uint256).max) {
allowance[from][sender][id] = senderAllowance - amount;
}
}
_burn(from, id, amount);
}
}
16 changes: 8 additions & 8 deletions src/PoolManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import {IDynamicFeeManager} from "./interfaces/IDynamicFeeManager.sol";
import {IPoolManager} from "./interfaces/IPoolManager.sol";
import {ILockCallback} from "./interfaces/callback/ILockCallback.sol";
import {Fees} from "./Fees.sol";
import {Claims} from "./Claims.sol";
import {ERC6909Claims} from "./ERC6909Claims.sol";
import {PoolId, PoolIdLibrary} from "./types/PoolId.sol";
import {BalanceDelta, BalanceDeltaLibrary} from "./types/BalanceDelta.sol";
import {Lockers} from "./libraries/Lockers.sol";
import {PoolGetters} from "./libraries/PoolGetters.sol";

/// @notice Holds the state for all pools
contract PoolManager is IPoolManager, Fees, NoDelegateCall, Claims {
contract PoolManager is IPoolManager, Fees, NoDelegateCall, ERC6909Claims {
using PoolIdLibrary for PoolKey;
using SafeCast for *;
using Pool for *;
Expand Down Expand Up @@ -288,15 +288,15 @@ contract PoolManager is IPoolManager, Fees, NoDelegateCall, Claims {
}

/// @inheritdoc IPoolManager
function mint(Currency currency, address to, uint256 amount) external noDelegateCall onlyByLocker {
_accountDelta(currency, amount.toInt128());
_mint(to, currency, amount);
function mint(address to, uint256 id, uint256 amount) external override noDelegateCall onlyByLocker {
_accountDelta(CurrencyLibrary.fromId(id), amount.toInt128());
_mint(to, id, amount);
}

/// @inheritdoc IPoolManager
function burn(Currency currency, uint256 amount) external noDelegateCall onlyByLocker {
_accountDelta(currency, -(amount.toInt128()));
_burn(currency, amount);
function burn(address from, uint256 id, uint256 amount) external override noDelegateCall onlyByLocker {
_accountDelta(CurrencyLibrary.fromId(id), -(amount.toInt128()));
_burnFrom(from, id, amount);
}

function setProtocolFee(PoolKey memory key) external {
Expand Down
11 changes: 6 additions & 5 deletions src/interfaces/IPoolManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import {Currency} from "../types/Currency.sol";
import {PoolKey} from "../types/PoolKey.sol";
import {Pool} from "../libraries/Pool.sol";
import {IHooks} from "./IHooks.sol";
import {IERC6909Claims} from "./external/IERC6909Claims.sol";
import {IFees} from "./IFees.sol";
import {IClaims} from "./IClaims.sol";
import {BalanceDelta} from "../types/BalanceDelta.sol";
import {PoolId} from "../types/PoolId.sol";
import {Position} from "../libraries/Position.sol";

interface IPoolManager is IFees, IClaims {
interface IPoolManager is IFees, IERC6909Claims {
/// @notice Thrown when currencies touched has exceeded max of 256
error MaxCurrenciesTouched();

Expand Down Expand Up @@ -185,11 +186,11 @@ interface IPoolManager is IFees, IClaims {
/// @dev Can also be used as a mechanism for _free_ flash loans
function take(Currency currency, address to, uint256 amount) external;

/// @notice Called by the user to move value into Claims balance
function mint(Currency token, address to, uint256 amount) external;
/// @notice Called by the user to move value into ERC6909 balance
function mint(address to, uint256 id, uint256 amount) external;

/// @notice Called by the user to redeem their Claims balance
function burn(Currency token, uint256 amount) external;
/// @notice Called by the user to move value from ERC6909 balance
function burn(address from, uint256 id, uint256 amount) external;

/// @notice Called by the user to pay what is owed
function settle(Currency token) external payable returns (uint256 paid);
Expand Down
Loading

0 comments on commit 1f350fa

Please sign in to comment.