Skip to content

Commit 0cc083d

Browse files
committed
Updated IOnChainAllocation
1 parent 4118ca9 commit 0cc083d

File tree

1 file changed

+45
-8
lines changed

1 file changed

+45
-8
lines changed

src/interfaces/IOnChainAllocation.sol

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,90 @@ interface IOnChainAllocation is IAllocator {
88
error InvalidPreparation();
99
error InvalidRegistration(address sponsor, bytes32 claimHash);
1010

11-
/// @notice Emitted when a tokens are successfully allocated
12-
/// @param sponsor The address of the sponsor
13-
/// @param commitments The commitments of the allocations
14-
/// @param nonce The nonce of the allocation
15-
/// @param expires The expiration of the allocation
16-
/// @param claimHash The hash of the allocation
11+
/**
12+
* @notice Emitted when a tokens are successfully allocated
13+
* @param sponsor The address of the sponsor
14+
* @param commitments The commitments of the allocations
15+
* @param nonce The nonce of the allocation
16+
* @param expires The expiration of the allocation
17+
* @param claimHash The hash of the allocation
18+
*/
1719
event Allocated(address indexed sponsor, Lock[] commitments, uint256 nonce, uint256 expires, bytes32 claimHash);
1820

21+
/**
22+
* @notice Deposits, registers and allocates a claim via Permit2 signature transfer
23+
* @dev Deposits the tokens subject to the order and registers the claim directly with the compact, then allocates the claim
24+
* @param arbiter The arbiter of the allocation
25+
* @param depositor The address depositing tokens and the sponsor of the claim (must sign the Permit2 message)
26+
* @param permitted The token permissions for the Permit2 transfer. Must match the commitments in the claim
27+
* @param details The deposit details including nonce, deadline, and lock tag
28+
* Nonce must match the nonce structure expected by the allocator
29+
* Deadline will be used as the expiration of the claim
30+
* @param claimHash The hash of the claim to register. Must match the claim hash recreated by the allocator
31+
* @param witness The witness typestring for the Permit2 signature (empty string if no witness)
32+
* @param witnessHash The hash of the witness data (bytes32(0) if no witness)
33+
* @param signature The Permit2 signature from the depositor, will be verified by the compact
34+
* @param context Additional context for the allocation
35+
* @return commitments The lock commitments created by the allocation
36+
*/
37+
function permit2Allocation(
38+
address arbiter,
39+
address depositor,
40+
uint256 expires,
41+
ISignatureTransfer.TokenPermissions[] calldata permitted,
42+
DepositDetails calldata details,
43+
bytes32 claimHash,
44+
string calldata witness,
45+
bytes32 witnessHash,
46+
bytes calldata signature,
47+
bytes calldata context
48+
) external returns (Lock[] memory commitments);
49+
1950
/**
2051
* @notice Allows to create an allocation on behalf of a recipient without the contract being in control over the funds.
2152
* @notice Will typically be used in combination with `batchDepositAndRegisterFor` on the compact.
2253
* @dev Must be called before `executeAllocation` to ensure a valid balance change has occurred for the recipient.
2354
* @param recipient The account to receive the tokens.
2455
* @param idsAndAmounts The ids and amounts to allocate.
56+
* @param additionalCommitmentAmounts Additional commitment amounts to allocate. Allocator must verify those tokens are unallocated.
2557
* @param arbiter The account tasked with verifying and submitting the claim.
2658
* @param expires The time at which the claim expires.
2759
* @param typehash The typehash of the claim.
2860
* @param witness The witness of the claim.
61+
* @param context Additional context for the allocation
2962
* @return nonce The next valid nonce. It is only guaranteed that the nonce is valid within the same transaction..
3063
*/
3164
function prepareAllocation(
3265
address recipient,
3366
uint256[2][] calldata idsAndAmounts,
67+
uint256[] calldata additionalCommitmentAmounts,
3468
address arbiter,
3569
uint256 expires,
3670
bytes32 typehash,
3771
bytes32 witness,
38-
bytes calldata orderData
72+
bytes calldata context
3973
) external returns (uint256 nonce);
4074

4175
/**
4276
* @notice Executes an allocation on behalf of a recipient.
4377
* @dev Must be called after `prepareAllocation` to ensure a valid balance change has occurred for the recipient.
4478
* @param recipient The account to receive the tokens.
4579
* @param idsAndAmounts The ids and amounts to allocate.
80+
* @param additionalCommitmentAmounts Additional commitment amounts to allocate. Allocator must verify those tokens are unallocated.
4681
* @param arbiter The account tasked with verifying and submitting the claim.
4782
* @param expires The time at which the claim expires.
4883
* @param typehash The typehash of the claim.
4984
* @param witness The witness of the claim.
85+
* @param context Additional context for the allocation
5086
*/
5187
function executeAllocation(
5288
address recipient,
5389
uint256[2][] calldata idsAndAmounts,
90+
uint256[] calldata additionalCommitmentAmounts,
5491
address arbiter,
5592
uint256 expires,
5693
bytes32 typehash,
5794
bytes32 witness,
58-
bytes calldata orderData
95+
bytes calldata context
5996
) external;
6097
}

0 commit comments

Comments
 (0)