Skip to content

Commit

Permalink
forge fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
duncancmt committed Aug 28, 2024
1 parent cc4b257 commit 8d3d0d2
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 40 deletions.
14 changes: 8 additions & 6 deletions src/SettlerIntent.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ abstract contract SettlerIntent is Permit2PaymentIntent, SettlerMetaTxn {
}

// Solidity inheritance is so stupid
function _witnessTypeSuffix() internal pure virtual override(Permit2PaymentMetaTxn, Permit2PaymentIntent) returns (string memory) {
return super._witnessTypeSuffix();
}

function _hashSlippage(AllowedSlippage calldata slippage)
function _witnessTypeSuffix()
internal
pure
returns (bytes32 result)
virtual
override(Permit2PaymentMetaTxn, Permit2PaymentIntent)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _hashSlippage(AllowedSlippage calldata slippage) internal pure returns (bytes32 result) {
// This function does not check for or clean any dirty bits that might
// exist in `slippage`. We assume that `slippage` will be used elsewhere
// in this context and that if there are dirty bits it will result in a
Expand Down
9 changes: 4 additions & 5 deletions src/SettlerMetaTxn.sol
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@ abstract contract SettlerMetaTxn is Permit2PaymentMetaTxn, SettlerBase {
return true;
}

function _executeMetaTxn(
AllowedSlippage calldata slippage,
bytes[] calldata actions,
bytes calldata sig
) internal returns (bool) {
function _executeMetaTxn(AllowedSlippage calldata slippage, bytes[] calldata actions, bytes calldata sig)
internal
returns (bool)
{
require(actions.length != 0);
{
(bytes4 action, bytes calldata data) = actions.decodeCall(0);
Expand Down
21 changes: 18 additions & 3 deletions src/chains/Arbitrum.sol
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ abstract contract ArbitrumMixin is FreeMemory, SettlerBase, MaverickV2, CurveTri
contract ArbitrumSettler is Settler, ArbitrumMixin {
constructor(bytes20 gitCommit) SettlerBase(gitCommit) {}

function _dispatchVIP(bytes4 action, bytes calldata data) internal virtual override DANGEROUS_freeMemory returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data)
internal
virtual
override
DANGEROUS_freeMemory
returns (bool)
{
if (super._dispatchVIP(action, data)) {
return true;
} else if (action == ISettlerActions.MAVERICKV2_VIP.selector) {
Expand Down Expand Up @@ -252,15 +258,24 @@ contract ArbitrumSettlerIntent is SettlerIntent, ArbitrumSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(ArbitrumSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(ArbitrumSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
13 changes: 11 additions & 2 deletions src/chains/Avalanche.sol
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,24 @@ contract SepoliSaettlerIntent is SettlerIntent, AvalancheSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(AvalancheSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(AvalancheSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
13 changes: 11 additions & 2 deletions src/chains/Base.sol
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,24 @@ contract BaseSettlerIntent is SettlerIntent, BaseSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(BaseSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(BaseSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
13 changes: 11 additions & 2 deletions src/chains/Blast.sol
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,24 @@ contract BlastSettlerIntent is SettlerIntent, BlastSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(BlastSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(BlastSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
13 changes: 11 additions & 2 deletions src/chains/Bnb.sol
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,24 @@ contract BnbSettlerIntent is SettlerIntent, BnbSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(BnbSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(BnbSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
13 changes: 11 additions & 2 deletions src/chains/Linea.sol
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,24 @@ contract LineaSettlerIntent is SettlerIntent, LineaSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(LineaSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(LineaSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
13 changes: 11 additions & 2 deletions src/chains/Mainnet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,24 @@ contract MainnetSettlerIntent is SettlerIntent, MainnetSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(MainnetSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(MainnetSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
13 changes: 11 additions & 2 deletions src/chains/Mantle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,24 @@ contract MantleSettlerIntent is SettlerIntent, MantleSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(MantleSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(MantleSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
13 changes: 11 additions & 2 deletions src/chains/Optimism.sol
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,24 @@ contract OptimismSettlerIntent is SettlerIntent, OptimismSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(OptimismSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(OptimismSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
13 changes: 11 additions & 2 deletions src/chains/Polygon.sol
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,24 @@ contract PolygonSettlerIntent is SettlerIntent, PolygonSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(PolygonSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(PolygonSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
13 changes: 11 additions & 2 deletions src/chains/Scroll.sol
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,24 @@ contract ScrollSettlerIntent is SettlerIntent, ScrollSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(ScrollSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(ScrollSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
13 changes: 11 additions & 2 deletions src/chains/Sepolia.sol
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,24 @@ contract SepoliaSettlerIntent is SettlerIntent, SepoliaSettlerMetaTxn {
return super._msgSender();
}

function _witnessTypeSuffix() internal pure override(SettlerIntent, Permit2PaymentMetaTxn) returns (string memory) {
function _witnessTypeSuffix()
internal
pure
override(SettlerIntent, Permit2PaymentMetaTxn)
returns (string memory)
{
return super._witnessTypeSuffix();
}

function _tokenId() internal pure override(SettlerIntent, SettlerMetaTxn, SettlerAbstract) returns (uint256) {
return super._tokenId();
}

function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig) internal override(SepoliaSettlerMetaTxn, SettlerMetaTxn) returns (bool) {
function _dispatchVIP(bytes4 action, bytes calldata data, bytes calldata sig)
internal
override(SepoliaSettlerMetaTxn, SettlerMetaTxn)
returns (bool)
{
return super._dispatchVIP(action, data, sig);
}
}
8 changes: 4 additions & 4 deletions src/core/Permit2Payment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ abstract contract Permit2PaymentMetaTxn is Context, Permit2Payment {

function _witnessTypeSuffix() internal pure virtual returns (string memory) {
return string(
abi.encodePacked("SlippageAndActions slippageAndActions)", SLIPPAGE_AND_ACTIONS_TYPE, TOKEN_PERMISSIONS_TYPE)
abi.encodePacked(
"SlippageAndActions slippageAndActions)", SLIPPAGE_AND_ACTIONS_TYPE, TOKEN_PERMISSIONS_TYPE
)
);
}

Expand Down Expand Up @@ -413,8 +415,6 @@ abstract contract Permit2PaymentMetaTxn is Context, Permit2Payment {

abstract contract Permit2PaymentIntent is Permit2PaymentMetaTxn {
function _witnessTypeSuffix() internal pure virtual override returns (string memory) {
return string(
abi.encodePacked("Slippage slippage)", SLIPPAGE_TYPE, TOKEN_PERMISSIONS_TYPE)
);
return string(abi.encodePacked("Slippage slippage)", SLIPPAGE_TYPE, TOKEN_PERMISSIONS_TYPE));
}
}

0 comments on commit 8d3d0d2

Please sign in to comment.