Smart Contract Addresses
This page provides verified contract addresses and practical integration examples for all Tharwa protocol deployments. Each contract is explained with its purpose, key functions, and real-world usage patterns.
Ethereum Mainnet
All core Tharwa contracts are deployed and operational on Ethereum Mainnet:
Network Details
Chain ID: 1
RPC:
https://mainnet.infura.io/v3/YOUR_KEY
Block Explorer: Etherscan
Sepolia Testnet
Development and testing environment for Tharwa protocol:
Network Details
Chain ID: 11155111
RPC:
https://sepolia.infura.io/v3/YOUR_KEY
Block Explorer: Sepolia Etherscan
Faucet: Sepolia Faucet
Contract Verification
All contracts are verified on Etherscan with:
✅ Source code published
✅ Constructor arguments verified
✅ Proxy implementation verified (where applicable)
✅ ABI available for integration
Verification Status
thUSD
✅ Verified
✅ Verified
Solidity 0.8.24
sthUSD
✅ Verified
✅ Verified
Solidity 0.8.24
thBonds
✅ Verified
✅ Verified
Solidity 0.8.24
TRWA
✅ Verified
✅ Verified
Solidity 0.8.24
thUSDSwap
✅ Verified
✅ Verified
Solidity 0.8.24
Integration Examples: Real-World Usage
Basic Integration: Checking User Balances
Most integrations start with reading user balances across Tharwa's ecosystem:
const Web3 = require('web3');
const web3 = new Web3('https://mainnet.infura.io/v3/YOUR_KEY');
// Contract instances
const thUSD = new web3.eth.Contract(thUSDABI, '0x76972F054aB43829064d31fF5f3AcC5Fabe57FE8');
const sthUSD = new web3.eth.Contract(sthUSDABI, '0xf7Af0A8079F12F19533B0DF69ce7ee6718b0C46f');
// Get user's complete Tharwa position
async function getUserPosition(userAddress) {
const [thUSDBalance, sthUSDShares, sthUSDValue] = await Promise.all([
thUSD.methods.balanceOf(userAddress).call(),
sthUSD.methods.balanceOf(userAddress).call(),
sthUSD.methods.convertToAssets(await sthUSD.methods.balanceOf(userAddress).call()).call()
]);
return {
thUSD: thUSDBalance,
sthUSDShares: sthUSDShares,
sthUSDValue: sthUSDValue,
totalValue: BigInt(thUSDBalance) + BigInt(sthUSDValue)
};
}
Advanced Integration: Complete Tharwa Interaction
Here's how to build a complete integration that handles the full Tharwa ecosystem:
// Complete staking flow with error handling
async function stakeThUSD(amount, userAddress, signer) {
try {
// 1. Check user's thUSD balance
const balance = await thUSD.balanceOf(userAddress);
if (balance.lt(amount)) throw new Error('Insufficient thUSD balance');
// 2. Check allowance
const allowance = await thUSD.allowance(userAddress, sthUSD.address);
if (allowance.lt(amount)) {
// Approve sthUSD to spend thUSD
const approveTx = await thUSD.connect(signer).approve(sthUSD.address, amount);
await approveTx.wait();
}
// 3. Preview the deposit to show user expected shares
const expectedShares = await sthUSD.previewDeposit(amount);
console.log(`You will receive ${ethers.utils.formatEther(expectedShares)} sthUSD shares`);
// 4. Execute the stake
const stakeTx = await sthUSD.connect(signer).deposit(amount, userAddress);
const receipt = await stakeTx.wait();
// 5. Confirm success
const newBalance = await sthUSD.balanceOf(userAddress);
console.log(`Staking successful! New sthUSD balance: ${ethers.utils.formatEther(newBalance)}`);
return receipt;
} catch (error) {
console.error('Staking failed:', error.message);
throw error;
}
}
Future Deployments
Planned Networks
Arbitrum: TBA
Polygon: TBA
Base: TBA
Optimism: TBA
All future deployments will use LayerZero's OFT standard for seamless cross-chain functionality.
Important Notes
Always verify contract addresses from official sources
Test integrations on Sepolia before mainnet deployment
Use latest ABI from verified Etherscan contracts
Monitor for contract upgrades and announcements
Last updated