Gasless USDT Escrow Infrastructure for Avalanche C-Chain
Built for Avalanche x Tether Hackathon 🏔️💰
| Contract | Address | Snowtrace |
|---|---|---|
| MockUSDT | 0x314FAf4931e6bd8dc4ae0b17cA48dFA7F88838b9 |
View Code |
| GaslessForwarder | 0xe5E115786F3a5131BEDB62EB9FD02811723c757C |
View Code |
| TrustlessWorkFactory | 0x3cD54445dC9812B74752B671561C7204A75b045C |
View Code |
Network: Avalanche Fuji Testnet Chain ID: 43113 Status: ✅ All contracts deployed and verified
Trustless Work is NOT an app - it's INFRASTRUCTURE.
ANY platform can deploy their own escrow contracts in 5 minutes using our Factory pattern.
✅ USDT Programmable Vaults - 4% APY on locked funds (NEW!) ✅ TES-1 Standard - First USDT escrow standard on Avalanche (NEW!) ✅ Gasless Transactions - Users NEVER need AVAX, only USDT ✅ Factory Pattern - Any platform can deploy escrows ✅ EIP-2771 Compliant - Meta-transactions support ✅ 6 Decimal USDT - Correctly handles real USDT ✅ Role-Based Access - 6 configurable roles per escrow ✅ Milestone Support - Single-release escrows with multiple checkpoints ✅ Yield Tracking - Real-time metrics across all escrows
EVM/
├── contracts/
│ ├── core/
│ │ ├── EscrowBase.sol # Base logic for all escrows (implements TES-1)
│ │ ├── SingleReleaseEscrow.sol # Single-payment escrow with yield
│ │ └── TrustlessWorkFactory.sol # Factory for deploying escrows
│ ├── gasless/
│ │ └── GaslessForwarder.sol # EIP-2771 forwarder
│ ├── mocks/
│ │ └── MockUSDT.sol # 6-decimal USDT for testing
│ └── interfaces/
│ ├── IUSDT.sol # USDT interface
│ └── ITetherEscrowStandard.sol # TES-1 standard interface
├── scripts/
│ └── deploy.js # Deployment script
├── deployments/ # Deployment info JSONs
└── IMPLEMENTATION_SUMMARY.md # Complete feature documentation
npm install --legacy-peer-depsCopy .env.example to .env and fill in:
FUJI_RPC_URL=https://api.avax-test.network/ext/bc/C/rpc
PRIVATE_KEY=your_private_key_here
SNOWTRACE_API_KEY=your_snowtrace_api_key_herenpx hardhat compilenpx hardhat run scripts/deploy.js --network fujinpx hardhat verify --network fuji <CONTRACT_ADDRESS>Want to test the live contracts? Here's how:
-
Go to the TrustlessWorkFactory on Snowtrace: https://testnet.snowtrace.io/address/0x3cD54445dC9812B74752B671561C7204A75b045C#writeContract
-
Connect your wallet
-
Call
createSingleReleaseEscrowwith your parameters -
Check
getTotalYieldGenerated()to see accumulated yield across all escrows
npx hardhat console --network fuji
const factory = await ethers.getContractAt(
"TrustlessWorkFactory",
"0x3cD54445dC9812B74752B671561C7204A75b045C"
);
// Check metrics
const totalEscrows = await factory.getTotalEscrows();
const totalYield = await factory.getTotalYieldGenerated();
const totalLocked = await factory.getTotalUSDTLocked();
console.log("Total Escrows:", totalEscrows.toString());
console.log("Total Yield:", ethers.formatUnits(totalYield, 6), "USDT");
console.log("Total Locked:", ethers.formatUnits(totalLocked, 6), "USDT");The core infrastructure contract. ANY platform calls this to deploy their own escrow.
function createSingleReleaseEscrow(
string memory _engagementId,
string memory _title,
string memory _description,
EscrowBase.Roles memory _roles,
uint256 _amount,
uint256 _platformFee,
string[] memory _milestoneDescriptions
) external returns (address escrowAddress)Individual escrow contract with:
- 6 Roles: Approver, ServiceProvider, ReleaseSigner, DisputeResolver, PlatformAddress, Receiver
- Milestones: Multiple checkpoints that must all be approved
- Gasless Support: Works with GaslessForwarder for meta-transactions
- Dispute Resolution: Built-in arbitration mechanism
EIP-2771 compliant forwarder:
- Users sign transactions
- Relayer pays gas
- Users only need USDT, never AVAX
The first proposed standard for USDT escrows on Avalanche:
interface ITetherEscrowStandard {
// Standard Events
event USDTLocked(uint256 amount, string escrowId, address indexed platform);
event USDTReleased(uint256 amount, address indexed recipient, uint256 yieldAmount);
event USDTDisputed(string escrowId, address indexed initiator);
// Core Metrics
function totalUSDTLocked() external view returns (uint256);
function totalYieldGenerated() external view returns (uint256);
function averageHoldTime() external view returns (uint256);
// Core Functions
function depositUSDT(uint256 amount) external;
function releaseWithYield() external;
function getYieldRate() external view returns (uint256);
}Why TES-1?
- Enables ANY platform to build USDT escrows that are interoperable
- Tether can track ALL USDT escrow activity on Avalanche via standard events
- Creates a foundation for USDT DeFi infrastructure on Avalanche
Every escrow automatically generates 4% APY on locked USDT:
// When funds are deposited, timestamp is recorded
depositTimestamp = block.timestamp;
// Yield calculation (simple interest)
function getAccumulatedYield() public view returns (uint256) {
uint256 timeElapsed = block.timestamp - depositTimestamp;
uint256 principal = amount;
return (principal * 400 * timeElapsed) / (365 days * 10000);
}
// On release, receiver gets principal + yield
uint256 yieldAmount = getAccumulatedYield();
uint256 totalPayout = amount - platformFee + yieldAmount;- ✅ Automatic: No action required, yield accrues every second
- ✅ Transparent: Anyone can query
getAccumulatedYield()anytime - ✅ Fair: Platform fee calculated on principal only, not yield
- ✅ Bonus: Yield goes 100% to the receiver as bonus payment
- ✅ Trackable:
YieldGeneratedevent emitted on every release
// Freelancer escrow: 1000 USDT locked for 30 days
const principal = 1000; // USDT
const days = 30;
const apy = 0.04; // 4%
// Yield calculation
const yield = (principal * apy * days) / 365;
// = 3.29 USDT
// Total payout to freelancer
const total = principal - platformFee + yield;
// = 1000 - 25 + 3.29 = 978.29 USDTThis makes Trustless Work the FIRST escrow system where your money works for you while locked!
1. User signs transaction (has only USDT, no AVAX)
2. Relayer receives signed message
3. Relayer submits to GaslessForwarder (pays gas)
4. Forwarder verifies signature
5. Forwarder executes on target contract
6. User's USDT is used, they paid $0 in AVAX
┌─────────────────────────────────────┐
│ Frontend (Next.js + ethers) │
├─────────────────────────────────────┤
│ Gasless Relayer (Express) │
├─────────────────────────────────────┤
│ GaslessForwarder Contract │
├─────────────────────────────────────┤
│ TrustlessWorkFactory Contract │
│ ├── SingleReleaseEscrow 1 │
│ ├── SingleReleaseEscrow 2 │
│ └── SingleReleaseEscrow ... │
├─────────────────────────────────────┤
│ Avalanche C-Chain (Fuji) │
└─────────────────────────────────────┘
// Platform deploys escrow for client-freelancer job
const escrow = await factory.createSingleReleaseEscrow({
engagementId: "job-123",
title: "Website Development",
roles: {
approver: clientAddress,
serviceProvider: freelancerAddress,
releaseSigner: platformAddress,
// ...
},
amount: parseUnits("1000", 6), // 1000 USDT
platformFee: 250, // 2.5%
// ...
});// DAO deploys escrow for bounty
const escrow = await factory.createSingleReleaseEscrow({
engagementId: "bounty-456",
title: "Fix Critical Bug",
roles: {
approver: daoMultisig,
serviceProvider: developerAddress,
releaseSigner: daoMultisig,
// ...
},
amount: parseUnits("500", 6), // 500 USDT
// ...
});- Locked USDT generates 4% APY automatically
- Makes idle funds productive while awaiting milestone completion
- First escrow system where your money works for you while locked
- Users can use USDT without ever touching AVAX
- EIP-2771 meta-transactions via GaslessForwarder
- Platform pays gas, users only need USDT
- Instant international payments with USDT
- No banks, no delays, no high fees
- Perfect for freelancers, DAOs, and P2P exchanges
- First proposed standard for USDT escrows on Avalanche
- Standardized events, metrics, and functions
- Enables interoperability between platforms
- Makes Avalanche THE place for USDT escrow infrastructure
- Infrastructure Play: Not a single app, enables 1000s of apps
- Real USDT Integration: Correctly handles 6 decimals and non-standard ERC20
- Avalanche Speed: 1-2 second finality showcased in demo
- Volume Potential: Every escrow = more USDT flowing through Avalanche
- Total Escrows Created - Number of escrows deployed via factory
- Total USDT Locked - Current TVL across all active escrows
- Total Yield Generated - 4% APY accumulated across all escrows
- Total Volume Processed - Lifetime USDT volume through the system
- Active Escrows - Currently funded and operational
- Gas Saved for Users - From gasless meta-transactions
- Average Hold Time - How long USDT stays locked (yield calculation)
- Platforms Integrated - Number of platforms using our infrastructure
- Volume per platform
- Yield generated per platform
- Number of escrows per platform
npx hardhat testnpx hardhat nodenpx hardhat run scripts/deploy.js --network localhost- ✅ USDT Programmable Vaults - 4% APY on locked funds
- ✅ Gasless USDT Payments - EIP-2771 meta-transactions
- ✅ Cross-Border Freelance Highway - Instant international payments
- ✅ TES-1 Standard - First USDT escrow standard on Avalanche
- ✅ Fully Functional Contracts on Avalanche Fuji
- ✅ Factory Pattern - Infrastructure, not just an app
- ✅ Live Demo with real transactions
- ✅ Open Source and composable
- ✅ Yield Generation - Making USDT productive while locked
- ✅ Real-Time Metrics - Dashboard-ready analytics
- 🏆 First-ever USDT yield-generating escrow
- 🏆 First proposed standard (TES-1) for USDT escrows on Avalanche
- 🏆 Infrastructure play that enables thousands of platforms
- 🏆 Gasless UX removing barriers to USDT adoption
Check these metrics in real-time on the deployed Factory contract:
// Via Snowtrace Read Contract:
// https://testnet.snowtrace.io/address/0x3cD54445dC9812B74752B671561C7204A75b045C#readContract
getTotalEscrows() // Number of escrows created
getTotalVolume() // Total USDT volume processed
getTotalYieldGenerated() // Total yield accumulated (4% APY)
getTotalUSDTLocked() // Current TVL across all escrowsFor Judges: You can verify ALL functionality is working by:
- Checking the verified source code on Snowtrace ✅
- Reading real-time metrics from the Factory contract ✅
- Seeing the 3 demo escrows already created ✅
- Viewing all events emitted (including TES-1 standard events) ✅
- USDT has 6 decimals, not 18! Use
parseUnits(amount, 6) - Gasless relayer needs funding for gas
- Platform fee is in basis points (250 = 2.5%)
- All roles are immutable once escrow is deployed
- MockUSDT: https://testnet.snowtrace.io/address/0x314FAf4931e6bd8dc4ae0b17cA48dFA7F88838b9#code
- GaslessForwarder: https://testnet.snowtrace.io/address/0xe5E115786F3a5131BEDB62EB9FD02811723c757C#code
- TrustlessWorkFactory: https://testnet.snowtrace.io/address/0x3cD54445dC9812B74752B671561C7204A75b045C#code
- Implementation Summary: See
IMPLEMENTATION_SUMMARY.mdfor complete feature documentation - Deployment Info: Check
deployments/folder for deployment details
- RPC URL: https://api.avax-test.network/ext/bc/C/rpc
- Chain ID: 43113
- Block Explorer: https://testnet.snowtrace.io
- Faucet: https://faucet.avax.network/
Theme: Making USDT payments frictionless on Avalanche
Our Solution: Gasless escrow infrastructure that ANY platform can use
Impact: Enable thousands of platforms to integrate programmable USDT payments
Made with ❤️ for the Avalanche ecosystem