Skip to content

Commit 7f78661

Browse files
committed
updated contract
1 parent 9a319d2 commit 7f78661

11 files changed

+54
-1769
lines changed

src/PaymentsGateway.sol

+7-7
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ contract PaymentsGateway is EIP712, Ownable, ReentrancyGuard {
8080
keccak256("PayoutInfo(bytes32 clientId,address payoutAddress,uint256 feeBPS)");
8181
bytes32 private constant REQUEST_TYPEHASH =
8282
keccak256(
83-
"PayRequest(bytes32 transactionId,address tokenAddress,uint256 tokenAmount,PayoutInfo[] payouts,address payable forwardAddress,bytes data)PayoutInfo(bytes32 clientId,address payoutAddress,uint256 feeBPS)"
83+
"PayRequest(bytes32 clientId,bytes32 transactionId,address tokenAddress,uint256 tokenAmount,PayoutInfo[] payouts,address forwardAddress,bytes data)PayoutInfo(bytes32 clientId,address payoutAddress,uint256 feeBPS)"
8484
);
8585
address private constant THIRDWEB_CLIENT_ID = 0x0000000000000000000000000000000000000000;
8686
address private constant NATIVE_TOKEN_ADDRESS = 0x0000000000000000000000000000000000000000;
@@ -158,13 +158,13 @@ contract PaymentsGateway is EIP712, Ownable, ReentrancyGuard {
158158
}
159159

160160
function _hashPayoutInfo(PayoutInfo[] calldata payouts) private pure returns (bytes32) {
161-
bytes32 payoutHash = PAYOUTINFO_TYPEHASH;
162-
for (uint256 i = 0; i < payouts.length; ++i) {
163-
payoutHash = keccak256(
164-
abi.encode(payoutHash, payouts[i].clientId, payouts[i].payoutAddress, payouts[i].feeBPS)
161+
bytes32[] memory payoutsHashes = new bytes32[](payouts.length);
162+
for (uint i = 0; i < payouts.length; i++) {
163+
payoutsHashes[i] = keccak256(
164+
abi.encode(PAYOUTINFO_TYPEHASH, payouts[i].clientId, payouts[i].payoutAddress, payouts[i].feeBPS)
165165
);
166166
}
167-
return payoutHash;
167+
return keccak256(abi.encodePacked(payoutsHashes));
168168
}
169169

170170
function _verifyTransferStart(PayRequest calldata req, bytes calldata signature) private view returns (bool) {
@@ -178,7 +178,7 @@ contract PaymentsGateway is EIP712, Ownable, ReentrancyGuard {
178178
req.tokenAmount,
179179
payoutsHash,
180180
req.forwardAddress,
181-
req.data
181+
keccak256(req.data)
182182
)
183183
);
184184

0 commit comments

Comments
 (0)