Using DeFiEscrow
Escrow Funding Deadlines and Approval Deadlines
A funding deadline and an approval deadline are how an unfinished escrow refunds. After everyone approves, those deadlines no longer cancel the deal.
· 4 min read · DeFiEscrow
A funding deadline and an approval deadline are the two clocks on a DeFiEscrow. They are chosen when the escrow is created. They cannot be extended later. They are the reason an unfinished deal can refund deposits instead of leaving tokens in a contract that nobody is allowed to empty.
They do not do the same job, and they stop mattering once the deal has gone far enough. Most confusion about "expired escrows" is a confusion about which state the deal is in.
The funding deadline
The funding deadline is the last time a required deposit can land. It has to be in the future when the escrow is created. Until that timestamp, parties who owe tokens can deposit, and the state stays Created until the full amount has arrived. The moment deposits cover the required total, the state flips to Funded, even if the funding deadline has not arrived yet. Early completion is allowed. Late completion is not.
If the timestamp passes and the escrow is still short, deposit fails. The deal cannot be finished by sending the missing tokens tomorrow. What you can do is call cancelAfterTimeout. The contract checks that the funding deadline has passed and that deposits are still below the required total. It then marks the escrow Terminated and credits each person who actually deposited with the amount they deposited. They withdraw it themselves.
Anyone may send that cancellation. It is not reserved for the buyer or the creator. If several parties deposited and one never did, each depositor gets their own deposit back. The missing party has nothing to refund. The people who were supposed to be paid do not get paid.
Pick this deadline from the real funding plan. If the buyer needs three days to move USDC onto the right network and into the right wallet, a deadline thirty minutes after creation is a way to manufacture a refund, not a way to run a closing.
The approval deadline
The approval deadline must be later than the funding deadline. Approvals are not even accepted until the escrow is Funded. The approval window is therefore the stretch after full funding and before that second timestamp.
If every required participant approves in time, the state becomes Approved. If the timestamp passes while the state is still Funded, because someone has not approved, cancelAfterTimeout can terminate the escrow. Deposits are credited back to depositors. The intended payout is not sent. A seller who was going to receive 100,000 USDC does not receive a consolation amount. A buyer who deposited 101,000 USDC, fee included, can withdraw 101,000 USDC.
This is the holdout rule. Unanimous approval means one missing signature blocks release. The approval deadline means that missing signature cannot block the deposit forever. Unanimous approval explains who has to sign. This page is only about the clock.
What the clocks do not cancel
Read this part twice, because it is the opposite of what many people assume.
If the state is already Approved, the approval deadline does not terminate the escrow. The timeout function requires that the approval deadline has passed and that the state is not Approved. A finished set of approvals is not undone at midnight. The tokens stay in the contract until someone calls release, the payouts are credited, and each party withdraws. There is no third deadline called "release by."
If you need the funds to return automatically unless someone releases by Friday, this contract does not encode that. Once everyone has approved, the deal is waiting for release, not racing a clock. A party who changes their mind after approval can raise a dispute, which freezes release. That is a different mechanism, described in how disputes work. It is available from Approved. It is not the same thing as "the deadline expired."
Disputed escrows are also outside cancelAfterTimeout. The function refuses to run while a dispute is open. The dispute has its own 30-day clock. When that clock ends, the refund is of deposits, same economic result as a timeout, different function. If you raise a dispute and later remove it, the original deadlines are still the original deadlines. Removing a dispute does not grant extra days. If the approval deadline passed while you were disputed, coming back to Funded can mean the timeout is immediately available.
How to set them for a closing
Work backward from the last off-chain condition.
For an earnest-money period, the approval deadline should cover the inspection or financing contingency you actually negotiated, plus time for every signer to get to a wallet. The funding deadline should be early enough that the deposit is locked before the seller relies on it, and late enough that the buyer can actually send it. Earnest money maps those calendars onto a property deposit.
For a milestone, do not set a six-month approval deadline "so we have room" if the work was supposed to be judged in two weeks. A long approval window is a long time the depositor's tokens sit in the contract while a holdout decides. Room for gas problems is a few days. Room for a different deal is a different escrow.
Write both timestamps into the human agreement, in a timezone you both name. The contract uses the chain's clock, which is unix time, not "end of the business day in Prague" unless you converted that moment yourself. The app asks for the deadlines in the form. Convert them deliberately.
When a deadline is missed, nobody at the protocol needs to approve the refund. The transaction is permissionless once the condition is true. That is the safety property the clocks exist to provide, and it only covers the states they were written for.