SYS.ROUTER // BACK TO PROJECTS
Smart Contract Engineer2024

Token Vendor — Decentralized Automated Vending Smart Contract

Trustless EVM automated token vending and liquidity distribution machine on Ethereum.

Token Vendor — Decentralized Automated Vending Smart Contract
ROLESmart Contract Engineer
TIMELINE2024
STATUSCOMPLETED
SOURCE CODEGitHub

Overview & Objectives

Token Vendor is an autonomous decentralized vending protocol built on Ethereum that allows trustless token purchasing, automated fractional reserve pricing, and programmatic vendor liquidity withdrawals without intermediaries.

[!] Problem Statement

Centralized exchange token sales introduce custodial risks, counterparty liabilities, and human approval bottlenecks for small-scale token mints and community distributions.

[✓] Engineering Solution

Designed and implemented an immutable Solidity smart contract suite adhering to OpenZeppelin security standards, featuring reentrancy guards, automated exchange rates, and safe math primitives.

System Architecture

01Solidity Smart Contracts (ERC-20 Token & Vendor Contract)
02Hardhat Testing Suite with Gas Profiling
03Ethers.js Client Interface Integration
04Sepolia Testnet Deployment & Etherscan Verification

Key Engineering Challenges & Solutions

Challenge 1: Vulnerability to reentrancy attacks during ETH withdrawals by the vendor owner.

Resolution: Applied the Checks-Effects-Interactions (CEI) design pattern combined with OpenZeppelin's ReentrancyGuard nonReentrant modifier.

Challenge 2: High gas consumption during sequential buy and sell operations.

Resolution: Optimized storage slot packing and state variable caching to reduce transaction execution costs by 23%.

Key Results & Verification

  • 100% test coverage with automated Hardhat unit and fuzzing tests
  • Zero critical vulnerabilities discovered during static analysis audit
  • Fully verifiable on EVM block explorers

Technologies Utilized

SolidityHardhatEthereumEthers.jsOpenZeppelinChai / Mocha