Skip to content

Conversation

@gibson042
Copy link

Description

Remove some incorrect stray text in the witnessTypeString example at https://docs.uniswap.org/contracts/permit2/reference/signature-transfer#batch-permitwitnesstransferfrom , and fix some nearby references to EIP-712.

Type(s) of changes

  • Bug fix
  • New feature
  • Update to an existing feature

Motivation for PR

Fix incorrect example.

How Has This Been Tested?

n/a

Follow-up PR

Given the emphasis on proper ordering of struct types with the injection of a not-obviously-relevant TokenPermissions, it would be nice for the example entry-point type to actually reference some other structs. For example:

 ```solidity
 struct ExampleTrade {
 	address exampleTokenAddress;
 	uint256 exampleMinimumAmountOut;
+	TradeCondition condition;
 }
+struct TradeCondition {
+	string language;
+	string expression;
+}
 ```
 Following EIP-712, the typehash for the data would be defined by:
 ```solidity
-bytes32 _EXAMPLE_TRADE_TYPEHASH = keccak256('ExampleTrade(address exampleTokenAddress,uint256 exampleMinimumAmountOut)');
+bytes32 _EXAMPLE_TRADE_TYPEHASH = keccak256('ExampleTrade(address exampleTokenAddress,uint256 exampleMinimumAmountOut,TradeCondition condition)TradeCondition(string language,string expression)');
 ```
 The `witness` that should be passed along with the permit message should be:
 ```solidity
  bytes32 witness = keccak256(
-            abi.encode(_EXAMPLE_TRADE_TYPEHASH, exampleTrade.exampleTokenAddress, exampleTrade.exampleMinimumAmountOut));
+            abi.encode(_EXAMPLE_TRADE_TYPEHASH, exampleTrade.exampleTokenAddress, exampleTrade.exampleMinimumAmountOut, (exampleTrade.condition.language, exampleTrade.condition.expression)));
 ```
 And the `witnessTypeString` to be passed in should be:
 
 ```solidity
-string constant witnessTypeString = "ExampleTrade(address exampleTokenAddress,uint256 exampleMinimumAmountOut)TokenPermissions(address token,uint256 amount)"
+string constant witnessTypeString = "ExampleTrade(address exampleTokenAddress,uint256 exampleMinimumAmountOut,TradeCondition condition)TokenPermissions(address token,uint256 amount)TradeCondition(string language,string expression)"

@vercel
Copy link

vercel bot commented Jan 10, 2026

@gibson042 is attempting to deploy a commit to the Uniswap Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant