diff --git a/src/TheCompact.sol b/src/TheCompact.sol index ada8a2a..9fd5ea7 100644 --- a/src/TheCompact.sol +++ b/src/TheCompact.sol @@ -247,6 +247,14 @@ contract TheCompact is ITheCompact, ERC6909, Tstorish { _deposit(msg.sender, id, msg.value); } + function depositAndRegister(address allocator, bytes32 claimHash, bytes32 typehash) external payable returns (uint256 id) { + id = address(0).toIdIfRegistered(Scope.Multichain, ResetPeriod.TenMinutes, allocator); + + _deposit(msg.sender, id, msg.value); + + _register(msg.sender, claimHash, typehash); + } + function deposit(address token, address allocator, uint256 amount) external returns (uint256 id) { _setTstorish(_REENTRANCY_GUARD_SLOT, 1); id = token.excludingNative().toIdIfRegistered(Scope.Multichain, ResetPeriod.TenMinutes, allocator); @@ -255,6 +263,16 @@ contract TheCompact is ITheCompact, ERC6909, Tstorish { _clearTstorish(_REENTRANCY_GUARD_SLOT); } + function depositAndRegister(address token, address allocator, uint256 amount, bytes32 claimHash, bytes32 typehash) external returns (uint256 id) { + _setTstorish(_REENTRANCY_GUARD_SLOT, 1); + id = token.excludingNative().toIdIfRegistered(Scope.Multichain, ResetPeriod.TenMinutes, allocator); + + _transferAndDeposit(token, msg.sender, id, amount); + + _register(msg.sender, claimHash, typehash); + _clearTstorish(_REENTRANCY_GUARD_SLOT); + } + function deposit(address allocator, ResetPeriod resetPeriod, Scope scope, address recipient) external payable returns (uint256 id) { id = address(0).toIdIfRegistered(scope, resetPeriod, allocator); diff --git a/src/interfaces/ITheCompact.sol b/src/interfaces/ITheCompact.sol index e6f1954..73993ba 100644 --- a/src/interfaces/ITheCompact.sol +++ b/src/interfaces/ITheCompact.sol @@ -101,14 +101,20 @@ interface ITheCompact { function deposit(address allocator) external payable returns (uint256 id); + function depositAndRegister(address allocator, bytes32 claimHash, bytes32 typehash) external payable returns (uint256 id); + function deposit(address token, address allocator, uint256 amount) external returns (uint256 id); + function depositAndRegister(address token, address allocator, uint256 amount, bytes32 claimHash, bytes32 typehash) external returns (uint256 id); + function deposit(address allocator, ResetPeriod resetPeriod, Scope scope, address recipient) external payable returns (uint256 id); function deposit(address token, address allocator, ResetPeriod resetPeriod, Scope scope, uint256 amount, address recipient) external returns (uint256 id); function deposit(uint256[2][] calldata idsAndAmounts, address recipient) external payable returns (bool); + function depositAndRegister(uint256[2][] calldata idsAndAmounts, bytes32[2][] calldata claimHashesAndTypehashes) external payable returns (bool); + function deposit( address token, uint256 amount, diff --git a/src/test/CalldataDebugger.sol b/src/test/CalldataDebugger.sol index a1afe89..22894ed 100644 --- a/src/test/CalldataDebugger.sol +++ b/src/test/CalldataDebugger.sol @@ -7,4 +7,4 @@ contract CalldataDebugger { fallback() external payable { revert Debug(msg.data); } -} +} \ No newline at end of file