-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from 0xSplits/move-discount-to-swapper
add discount to swapper
- Loading branch information
Showing
11 changed files
with
567 additions
and
155 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
Submodule forge-std
updated
3 files
+2 −0 | src/Vm.sol | |
+394 −382 | src/console2.sol | |
+4 −4 | test/StdStyle.t.sol |
Submodule solady
updated
11 files
+268 −253 | .gas-snapshot | |
+15 −14 | .github/workflows/ci.yml | |
+1 −1 | foundry.toml | |
+1 −1 | src/auth/OwnableRoles.sol | |
+54 −71 | src/tokens/ERC1155.sol | |
+10 −5 | src/tokens/ERC721.sol | |
+1 −1 | src/utils/LibBitmap.sol | |
+158 −0 | test/Ownable.t.sol | |
+9 −14 | test/utils/mocks/MockERC1155.sol | |
+6 −13 | test/utils/mocks/MockERC721.sol | |
+83 −0 | test/utils/mocks/MockOwnable.sol |
Submodule splits-oracle
updated
7 files
+1 −0 | .gitmodules | |
+1 −1 | lib/splits-utils | |
+10 −40 | src/UniV3OracleImpl.sol | |
+1 −9 | src/interfaces/IOracle.sol | |
+0 −33 | src/utils/QuotePair.sol | |
+0 −1 | test/UniV3OracleFactory.t.sol | |
+17 −94 | test/UniV3OracleImpl.t.sol |
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,52 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.17; | ||
|
||
import {QuotePair, SortedQuotePair} from "splits-utils/LibQuotes.sol"; | ||
|
||
import {SwapperImpl} from "../SwapperImpl.sol"; | ||
|
||
/// @title PairScaledOfferFactor Library | ||
/// @author 0xSplits | ||
/// @notice Setters & getters for quote pairs' scaledOfferFactors | ||
library PairScaledOfferFactors { | ||
/// set pairs' scaled offer factors | ||
function _set( | ||
mapping(address => mapping(address => uint32)) storage self, | ||
SwapperImpl.SetPairScaledOfferFactorParams[] calldata params_ | ||
) internal { | ||
uint256 length = params_.length; | ||
for (uint256 i; i < length;) { | ||
_set(self, params_[i]); | ||
unchecked { | ||
++i; | ||
} | ||
} | ||
} | ||
|
||
/// set pair's scaled offer factor | ||
function _set( | ||
mapping(address => mapping(address => uint32)) storage self, | ||
SwapperImpl.SetPairScaledOfferFactorParams calldata params_ | ||
) internal { | ||
SortedQuotePair memory sqp = params_.quotePair._sort(); | ||
self[sqp.token0][sqp.token1] = params_.scaledOfferFactor; | ||
} | ||
|
||
/// get pair's scaled offer factor | ||
function _get(mapping(address => mapping(address => uint32)) storage self, QuotePair calldata quotePair_) | ||
internal | ||
view | ||
returns (uint32) | ||
{ | ||
return _get(self, quotePair_._sort()); | ||
} | ||
|
||
/// get pair's scaled offer factor | ||
function _get(mapping(address => mapping(address => uint32)) storage self, SortedQuotePair memory sqp_) | ||
internal | ||
view | ||
returns (uint32) | ||
{ | ||
return self[sqp_.token0][sqp_.token1]; | ||
} | ||
} |
Oops, something went wrong.