Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-carroll committed Jul 17, 2024
1 parent 41d70d7 commit ae2632d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
8 changes: 3 additions & 5 deletions src/Orders.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down
20 changes: 11 additions & 9 deletions src/UsesPermit2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit ae2632d

Please sign in to comment.