createEscrow
solidity
function createEscrow(
address freelancer,
uint256 amount,
address token,
uint256 durationInSeconds
) external returns (uint256)Creates an unfunded escrow. The caller becomes the client.
Rules
freelancercannot be zero;amountmust be greater than zero;tokencannot be zero;durationInSecondsmust be greater than zero.
Effects
The function increments nextEscrowId, calculates deadline = block.timestamp + durationInSeconds, stores the escrow with Created status, emits EscrowCreated, and returns the ID.
Reverts
ZeroAddress()InvalidAmount()
Creating an escrow does not move tokens. The client must approve token spending and then call fundEscrow.