The basics
Approvals without gas (EIP-2612)
USDh supportspermit. A user signs an approval off-chain, and your contract submits it together with the action that uses it. The user pays no gas for the approval.
Transfers without gas (EIP-3009)
USDh supportstransferWithAuthorization and receiveWithAuthorization, the same functions USDC uses. A user signs a transfer, and anyone can submit it on their behalf.
- Each authorization uses a random 32-byte
nonceand a time window (validAfter,validBefore). - Use
receiveWithAuthorizationwhen a contract receives the funds. It only accepts the call from the receiver, which stops someone else from front-running it. - Contract wallets such as Safes can sign, through EIP-1271.
- An unused authorization can be cancelled with
cancelAuthorization.
Before you go live
1
Use the proxy address
Check it against Contracts. Never use the implementation address.
2
Read decimals from the contract
Do not assume 6.
3
Handle a paused system and a frozen address
Both make transfers fail. Your app should show a clear message, not break. See Handle pauses, freezes and limits.
4
Watch for scheduled changes
Every change to USDh is scheduled on the timelock 48 hours before it can take effect. Watch for
CallScheduled events on the timelock.