Why wrap
BOT is the native coin, so it has no ERC-20 functions such asapprove and transferFrom. DeFi contracts like BDEX pools work with ERC-20 tokens. WBOT is BOT inside an ERC-20 contract: you deposit BOT and get the same amount of WBOT, and you can withdraw it 1:1 at any time.
WBOT has 18 decimals and lives at 0xD5452816194a3784dBa983426cCe7c122F4abd30 on both mainnet and testnet.
Prerequisites
- Node.js 22 or later.
- At least 0.003 tBOT in your testnet wallet. See Get testnet tokens.
Steps
1
Create the project
2
Add your testnet key
.env
3
Write the script
wrap-bot.ts
deposit()is payable. Thevalueyou send becomes WBOT.withdraw(amount)burns WBOT and sends you the same amount of tBOT.wbotAbicomes from@uzolabs/sdk/contracts. Any standard WETH9-style ABI works too.
4
Run it
Verify it worked
Output
Troubleshooting
insufficient funds for gas
insufficient funds for gas
You need tBOT for both the deposit and gas. Lower the amount or top up from the faucet.
withdraw reverts
withdraw reverts
You tried to unwrap more WBOT than you hold. Check the WBOT balance first.
WBOT doesn't show in my wallet
WBOT doesn't show in my wallet
Import it as a custom token with the address above, symbol WBOT and 18 decimals.
Next steps
Swap on BDEX V2
Swap your WBOT for USDT.
USDT and decimals
Avoid the most common amount bug.