This project is a cleaned Dotone Solidity contracts workspace configured to deploy to:
- Oilcoin (DT1) — id:
oil(configured under testnets) - BSC Testnet — id:
bnb-testnet - Ethereum Sepolia — id:
ethereum-sepolia
All other networks and tokens have been removed from the presets.
- Install dependencies
yarn- Select a chain config (writes contracts/utils/DotoneConfig.sol)
# Oilcoin testnet
npx hardhat chain --testnet oil
# or BSC testnet
npx hardhat chain --testnet bnb-testnet- Compile contracts
yarn compile- Generate local ABIs and TS contract types for packages (no npm installs)
node scripts/copy-abis.js
node scripts/copy-types.js- Build monorepo packages (base, adaptors, rpc, client, sdk, presets, clients)
yarn build:packages- Set your deployer key
echo "PRIVATE_KEY=0xYOUR_PRIVATE_KEY" > .env- Use Node 22 and Yarn classic
nvm use 22 || (nvm install 22 && nvm use 22)
corepack enable && corepack prepare yarn@1.22.22 --activate
node -v && yarn -v- Install and build packages
yarn
yarn build:packages- Set your deployer key
echo "PRIVATE_KEY=0xYOUR_PRIVATE_KEY" > .env- Pick a network id
- Oilcoin testnet:
oil - BSC testnet:
bnb-testnet - Ethereum Sepolia:
ethereum-sepolia
- Deploy (upgradable)
# Oilcoin testnet
yarn compile
yarn deploy:oil
# OR BSC testnet
yarn compile
yarn deploy:bsc-testnet
# OR Ethereum Sepolia
yarn compile
yarn deploy:ethereum-sepoliaEquivalent generic form:
npx hardhat deploy --testnet oil --upgradable true
# or
npx hardhat deploy --testnet bnb-testnet --upgradable true
# or
npx hardhat deploy --testnet ethereum-sepolia --upgradable true- Verify outputs
- Console will print deployed proxy/implementation (when upgradable) and Dotone address.
- File
packages/base/networks/testnets.jsonwill be updated:- The
dotoneAddressfield under your network will be filled. - Any test tokens deployed during the run will have their
addrfilled.
- The
- Sanity checks
# Confirm the network entry contains a non-empty dotoneAddress
grep -n '"id": "oil"' -n packages/base/networks/testnets.json -n && \
sed -n '1,60p' packages/base/networks/testnets.json | sed -n '1,40p'- Ensure the deployer wallet had gas on the target network (DT1 or tBNB).
- If you re‑deploy,
hardhat deploywill re‑switch config, recompile, and redeploy.
- Next steps (optional)
- Add/remove supported tokens by editing the
tokenslist of the target network inpackages/base/networks/testnets.jsonand re‑deploy. - For LP operations (deposit/withdraw/authorize), see
scripts/lib/pool.js. It is sample code; wire it as needed for your use case.
- Build workspaces
nvm use 22
yarn && yarn build:packages-
Fund deployer wallet with native gas on both testnets (DT1 on Oilcoin, tBNB on BSC Testnet)
-
Set deployer key and compile
echo "PRIVATE_KEY=0xYOUR_PRIVATE_KEY" > .env
yarn compile- Deploy on testnets
yarn deploy:oil
yarn deploy:bsc-testnet
yarn deploy:ethereum-sepoliadotoneAddressinpackages/base/networks/testnets.jsonis filled automatically. No manual edit needed.
- (Optional) Generate ABIs/types for consumers
node scripts/copy-abis.js
node scripts/copy-types.js- (Optional) Env toggles
PREMIUM_MANAGER: address to set as premium manager (defaults to deployer).DEPOSIT_ON_DEPLOY: string amount (e.g."1000") to auto‑deposit LP balances for listed tokens on testnets.
For running a relayer service to execute swaps, see the dotone-bridge-relayer project documentation. The relayer listens for swap events and executes corresponding transactions on destination chains.
- Node.js 22
- Yarn 1.x
yarn
yarn build:packagesSet your private key in one of these ways (preferred first):
- Create
.envin the project root:
PRIVATE_KEY=0xYOUR_PRIVATE_KEY
- Or export in your shell:
export PRIVATE_KEY=0xYOUR_PRIVATE_KEY- Or inline per command:
PRIVATE_KEY=0xYOUR_PRIVATE_KEY npx hardhat deploy --testnet oil --upgradable trueNote: PRIVATE_KEY is required for all deployment scripts. Scripts will fail with an error if it's not set. Always set your own key in production.
- id:
oil - chainId:
75245483421285(0x446f744f6e65) - rpc:
https://rpc-testnet.oilcoin.online/ - explorer:
https://explorer.oilcoin.online/ - native currency: DT1 (18)
- tokens (presets): DT1 native only
Deploy:
yarn compile
yarn deploy:oil
# equivalent: npx hardhat deploy --testnet oil --upgradable true- id:
bnb-testnet - chainId:
97(0x61) - rpc:
https://bsc-testnet-rpc.publicnode.com - explorer:
https://testnet.bscscan.com - native currency: tBNB (18)
- tokens (presets): tBNB native, LINK
0x84b9B910527Ad5C03A9Ca831909E21e236EA7b06(18)
Deploy:
yarn compile
yarn deploy:bsc-testnet
# equivalent: npx hardhat deploy --testnet bnb-testnet --upgradable true- id:
ethereum-sepolia - chainId:
11155111(0xaa36a7) - rpc:
https://ethereum-sepolia-rpc.publicnode.com - explorer:
https://sepolia.etherscan.io/ - native currency: ETH (18)
- tokens (presets): None (tokens can be added after deployment)
Deploy:
yarn compile
yarn deploy:ethereum-sepolia
# equivalent: npx hardhat deploy --testnet ethereum-sepolia --upgradable trueThe build script ensures chain config is applied:
yarn build # runs: hardhat chain --testnet oil && hardhat clean && yarn compile
yarn compileThe Hardhat deploy task also switches chain config automatically before compile and deploy.
After compiling, populate real ABIs and TypeScript contract types into packages/base/abis:
Option A (automatic): runs on full build
yarn build # triggers postbuild → scripts/copy-abis.js && scripts/copy-types.jsOption B (manual): run copy scripts explicitly
# Ensure artifacts and typechain-types exist
yarn compile
# Then copy ABIs and types into packages/base/abis
node scripts/copy-abis.js
node scripts/copy-types.jsResults:
packages/base/abis/DotoneAbi.json(fromartifacts/contracts/Dotone.sol/Dotone.json)packages/base/abis/ERC20Abi.json(fromartifacts/contracts/test/MockToken.sol/MockToken.json)packages/base/abis/DotoneContract.d.ts,ERC20Contract.d.ts,ContractTypes.d.ts(fromtypechain-types)
- Copies chain-specific
DotoneConfig.solintocontracts/utils/ - Compiles contracts
- Deploys upgradable Dotone (unless
--upgradable false) - Registers preset tokens on the deployed Dotone contract
- Writes the deployed Dotone address back to the network preset file
Relevant files:
packages/base/networks/testnets.jsonpackages/base/networks/mainnets.json(contains only Ethereum and BNB)scripts/deploy.jscontracts/utils/DotoneConfig.sol
- Ensure your wallet has gas on the target network (DT1 on Oilcoin, tBNB on BSC Testnet).
- If
PRIVATE_KEYis not picked up, verify.envis in the project root and re-run the command from that directory. - If deployment succeeds but tokens are missing, confirm token entries in the corresponding network preset file.
- What is
dotoneAddressin the network JSONs?- It is the deployed Dotone contract (proxy if upgradable) on that chain. You do not set it manually before deploy. The deploy script writes it after deployment.
- Do I need to pre-fill token addresses on testnets?
- No. If a token in
packages/base/networks/testnets.jsonhas an emptyaddr, the testnet deploy script will auto-deploy aMockTokenand update the file with the new address.
- No. If a token in
- Where is the relayer documentation?
- See the
dotone-bridge-relayerproject for relayer setup and configuration.
- See the