From ae2632d63307d62335b8cabd5b5ab328ea056a75 Mon Sep 17 00:00:00 2001 From: Anna Carroll Date: Wed, 17 Jul 2024 14:59:40 +0100 Subject: [PATCH] rename --- src/Orders.sol | 8 +++----- src/UsesPermit2.sol | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Orders.sol b/src/Orders.sol index 7d0e094..6f021b7 100644 --- a/src/Orders.sol +++ b/src/Orders.sol @@ -67,7 +67,7 @@ abstract contract OrderDestination is OutputPermit2 { /// @custom:emits Filled function fillPermit2(Output[] memory outputs, Permit2 calldata permit2) external { // via permit2 contract, transfer all tokens to the tokenRecipient (includes check on permit2 nonce & deadline) - _permitWitnessTransferFrom(outputs, _generateFillTransferDetails(outputs, permit2.permit.permitted), permit2); + _permitWitnessTransferFrom(outputs, _fillTransferDetails(outputs, permit2.permit.permitted), permit2); // emit emit Filled(outputs); @@ -140,12 +140,10 @@ abstract contract OrderOrigin is OutputPermit2 { Output[] memory outputs, /* signed via permit2 witness */ Permit2 calldata permit2 ) external { - _permitWitnessTransferFrom( - outputs, _generateInitiateTransferDetails(tokenRecipient, permit2.permit.permitted), permit2 - ); + _permitWitnessTransferFrom(outputs, _initiateTransferDetails(tokenRecipient, permit2.permit.permitted), permit2); // emit - emit Order(permit2.permit.deadline, _generateInputs(permit2.permit.permitted), outputs); + emit Order(permit2.permit.deadline, _inputs(permit2.permit.permitted), outputs); } /// @notice Transfer the entire balance of ERC20 tokens to the recipient. diff --git a/src/UsesPermit2.sol b/src/UsesPermit2.sol index 14f213b..3f3ebc1 100644 --- a/src/UsesPermit2.sol +++ b/src/UsesPermit2.sol @@ -55,10 +55,11 @@ abstract contract OutputPermit2 { /// @param outputs - the Outputs to transform. /// @param permitted - the TokenPermissions to transform. /// @return transferDetails - the SignatureTransferDetails generated. - function _generateFillTransferDetails( - Output[] memory outputs, - ISignatureTransfer.TokenPermissions[] calldata permitted - ) internal pure returns (ISignatureTransfer.SignatureTransferDetails[] memory transferDetails) { + function _fillTransferDetails(Output[] memory outputs, ISignatureTransfer.TokenPermissions[] calldata permitted) + internal + pure + returns (ISignatureTransfer.SignatureTransferDetails[] memory transferDetails) + { require(permitted.length == outputs.length); transferDetails = new ISignatureTransfer.SignatureTransferDetails[](permitted.length); for (uint256 i; i < permitted.length; i++) { @@ -75,10 +76,11 @@ abstract contract OutputPermit2 { /// @param tokenRecipient - the `to` field for the TransferDetails that will receive the tokens. /// @param permitted - the TokenPermissions to transform. /// @return transferDetails - the SignatureTransferDetails generated. - function _generateInitiateTransferDetails( - address tokenRecipient, - ISignatureTransfer.TokenPermissions[] calldata permitted - ) internal pure returns (ISignatureTransfer.SignatureTransferDetails[] memory transferDetails) { + function _initiateTransferDetails(address tokenRecipient, ISignatureTransfer.TokenPermissions[] calldata permitted) + internal + pure + returns (ISignatureTransfer.SignatureTransferDetails[] memory transferDetails) + { transferDetails = new ISignatureTransfer.SignatureTransferDetails[](permitted.length); for (uint256 i; i < permitted.length; i++) { // ensure the tokens are being transferred to this address @@ -90,7 +92,7 @@ abstract contract OutputPermit2 { /// @dev TokenPermissions and Inputs structs contain identical fields. /// @param permitted - the TokenPermissions to transform. /// @return inputs - the Inputs generated. - function _generateInputs(ISignatureTransfer.TokenPermissions[] calldata permitted) + function _inputs(ISignatureTransfer.TokenPermissions[] calldata permitted) internal pure returns (Input[] memory inputs)