Company: HodlTree
Role: Senior Solidity Developer
Stack: Solidity 0.8.0 · Aave V2 · Chainlink Oracle · Truffle · OpenZeppelin · Web3.js
Period: 09/2020 - 05/2021
Decentralized lending and borrowing protocol on Polygon and Ethereum enabling users to deposit collateral, earn multi-layer yields through Aave integration, and borrow against their holdings with dynamic risk management. The system uses Chainlink price oracles for accurate asset pricing and implements sophisticated liquidation mechanics to maintain protocol health. Supports multiple collateral types (USDC, DAI) and denominations (wMATIC, wETH) with per-token yield strategies.
| Decision | Rationale |
|---|---|
| Dual-contract (Lender/Borrower) | Clear separation of concerns; lenders unaware of borrower risk; independent token economics |
| Aave collateral deposits | Free yield generation on locked collateral; leverages battle-tested Aave V2 risk management |
| Chainlink oracle feeds | Decentralized price feeds eliminate single-point-of-failure pricing; 8-decimal standardization reduces implementation risk |
| ECDSA fee signatures | Off-chain computation reduces gas costs while maintaining on-chain verification; enables batched fee claims |
| 20% liquidation bonus | Aggressive incentive attracts liquidators; maintains protocol solvency during market volatility |
Chainlink decimal inversion in one step. Price feeds return USD values in 8-decimal precision; collateral is 6-decimal USDC, debt is 18-decimal wMATIC. Rather than converting in stages, priceDecimalsPower = 18 + oracle_decimals is computed once at deploy time, and price = 10 ** priceDecimalsPower / rawFeedValue normalizes and inverts in a single expression - no intermediate rounding.
Yield accounting via aToken delta. User collateral is tracked as totalBalance. The same funds sit in Aave as a rebasing aToken, whose balance grows automatically with interest. The difference aToken.balanceOf(this) − totalBalance is the claimable yield - no separate accrual logic needed.
Mainnet-fork-first integration tests. The test suite forks Polygon mainnet with real Aave and Chainlink addresses and an unlocked USDC whale account. All external integrations are tested against production state, not mocks - a decision that caught decimal-handling bugs invisible in unit tests.
Atomic compound operations. depositAndBorrow() and repayAndWithdraw() execute both actions in one transaction, eliminating the window between two separate calls where a price move could leave the position undercollateralized before the second call lands.
See HodlTree page for additional context.