Skip to main content

Contract Architecture

GweAI’s smart contract ecosystem is deployed on Base Sepolia (Chain ID: 84532) and consists of four main components that work together to provide secure DeFi functionality.

Verified Contracts

All contract addresses are hardcoded and verified on-chain to prevent frontend manipulation attacks:

Router Contract

Main trading interface for token swaps0x49B538646dc51f1b8c533113113A7dE05fBC2218

Liquidity Pool

Holds all protocol liquidity0xDEEd6a61940bD4162f9955aeBb477C3bDABf6078

Vault Staking

Time-locked staking with yield generation0xB156a66521BCB5A903daA42879A3e562E402Fa41

Subscription

Manages user subscription plans0xcFbdEaba321700A9C125b41dB6bBd6BBBA752287

Supported Tokens

GweAI supports a whitelist of verified tokens on Base Sepolia:
TokenAddressDecimals
USDC0xBEE08798a3634e29F47e3d277C9d11507D55F66a6
BTC0x7d9E31f5cCac4b9c8566f343A6bD6f3263DFcC918
SOL0x241ECE6Dce0E0825F9992410B3fA5d4b8fC8d1999
BNB0xAA9Be1a8A7f7254C1759bAa7e0f7864579c33a968
XRP0x01E278B5421AAC93A206C15b2933419DA19E17b38
TON0xC85D84a1092b81aCBA9bC75fad6063a7DA642E368
AVAX0x5DC449E37b6DAAD182d4Fb13C8dFE53C383C2E468
TRX0x45442ecB66A1a10c0F9817fb7F2B50a3bB99bd698
ADA0xcB1A4c81E7a56cbE2246DA3aE256Ba01549406488
DOGE0x803aD69f487536Ec1eE8a83Cd329e3d1703f83378

Network Configuration

chainId
number
required
84532 (Base Sepolia testnet)
rpcUrl
string
required
https://base-sepolia.g.alchemy.com/v2/-mGklZw8tTiO9fg9sRGQP
blockExplorer
string
https://sepolia.basescan.org

Security Features

Address Verification

All contract addresses are validated using multiple security layers:
import { getVerifiedContract, validateTransaction } from '@/config/contracts';

// Get verified contract address - throws error if modified
const routerAddress = getVerifiedContract('ROUTER');

// Validate before transaction
const validation = await validateTransaction({
  contractAddress: routerAddress,
  contractType: 'ROUTER',
  userAddress: '0x...',
});

if (!validation.valid) {
  throw new Error(validation.error);
}

Token Whitelist

Only whitelisted tokens can be used in transactions:
import { isVerifiedToken } from '@/config/contracts';

if (!isVerifiedToken(tokenAddress)) {
  throw new Error('Token not in whitelist');
}

On-Chain Verification

Contracts are verified by checking bytecode exists on-chain:
import { verifyContractOnChain } from '@/config/contracts';

const isValid = await verifyContractOnChain(contractAddress);
// Returns true if contract has valid bytecode
Contract addresses are immutable in the codebase and cannot be modified through environment variables. Any attempt to use unverified addresses will trigger security events and fail validation.

Function Signatures

Verified function selectors for transaction validation:
FunctionSelectorContract
buy(address,uint256,uint256)0xa59ac6ddRouter
sell(address,uint256,uint256)0x6a272462Router
swap(address,address,uint256,uint256)0xfe029156Router
purchasePlan(uint8)0x98693010Subscription
transfer(address,uint256)0xa9059cbbERC20
approve(address,uint256)0x095ea7b3ERC20

Treasury Wallet

Protocol treasury and admin address:
0x39c0b97A8F2194fcd7396296F7697a84dd81077A
The treasury receives:
  • Protocol fees from swaps
  • Early withdrawal penalties from vault staking
  • Subscription payments
View verified contracts on BaseScan:

Router

View on BaseScan

Liquidity Pool

View on BaseScan

Vault Staking

View on BaseScan

Subscription

View on BaseScan

Security Monitoring

All contract interactions are logged for security monitoring:
import { logSecurityEvent } from '@/config/contracts';

logSecurityEvent({
  type: 'CONTRACT_CALL',
  details: 'Swap transaction initiated',
  address: routerAddress,
});
Event types:
  • CONTRACT_CALL - Contract function invoked
  • ADDRESS_VALIDATION - Address verified
  • SIGNATURE_CHECK - Function signature validated
  • ERROR - Security violation detected

Build docs developers (and LLMs) love