Developer Guide
Build on ANDE
Deploy smart contracts, integrate Token Duality, and build the next generation of decentralized applications on ANDE Network.
6174
Chain ID
^0.8.20
Solidity Version
36M
Block Gas Limit
~5s
Block Time
Development Tools
Foundry
Recommended toolkit for smart contract development
curl -L https://foundry.paradigm.xyz | bash && foundryupDocumentationHardhat
Popular JavaScript-based development environment
npm install --save-dev hardhatDocumentationRemix IDE
Browser-based Solidity IDE for quick prototyping
No installation neededDocumentationToken Duality Integration
Precompile address: 0x00000000000000000000000000000000000000FD
ANDE's unique Token Duality precompile allows the native gas token to function as an ERC-20 simultaneously. This enables seamless DeFi integration without wrapped tokens.
Using Token Duality in Your Contracts
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract MyDeFiProtocol {
// Token Duality precompile address
address constant ANDE_TOKEN = 0x00000000000000000000000000000000000000FD;
// Use ANDE as ERC-20 in your protocol
function depositANDE(uint256 amount) external {
// Transfer ANDE as ERC-20
IERC20(ANDE_TOKEN).transferFrom(msg.sender, address(this), amount);
// Your deposit logic here
}
function withdrawANDE(uint256 amount) external {
// Transfer ANDE back to user
IERC20(ANDE_TOKEN).transfer(msg.sender, amount);
}
// Check ANDE balance (same as native balance)
function checkBalance(address user) external view returns (uint256) {
return IERC20(ANDE_TOKEN).balanceOf(user);
}
}Key Features
- Full ERC-20 interface (transfer, approve, transferFrom)
- Balance equals native ETH balance - no syncing needed
- Works with existing DeFi protocols (Uniswap, Aave, etc.)
- No wrapping/unwrapping overhead
Deploying Contracts
Using Foundry
# Create new project
forge init my-ande-project
cd my-ande-project
# Configure foundry.toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc = "0.8.20"
[rpc_endpoints]
ande = "https://rpc.ande.network"
# Write your contract in src/MyContract.sol
# Deploy to ANDE Network
forge create src/MyContract.sol:MyContract \
--rpc-url https://rpc.ande.network \
--private-key $PRIVATE_KEY \
--verify \
--verifier blockscout \
--verifier-url https://api.ande.network/api
# Verify existing contract
forge verify-contract $CONTRACT_ADDRESS \
src/MyContract.sol:MyContract \
--chain-id 6174 \
--verifier blockscout \
--verifier-url https://api.ande.network/apiTesting Your Contracts
// test/MyContract.t.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "forge-std/Test.sol";
import "../src/MyContract.sol";
contract MyContractTest is Test {
MyContract public myContract;
function setUp() public {
myContract = new MyContract();
}
function testExample() public {
// Your test logic
assertEq(myContract.value(), 0);
}
// Fork test against ANDE network
function testFork() public {
// Create fork of ANDE
vm.createSelectFork("https://rpc.ande.network");
// Test against live state
// ...
}
}
// Run tests
// forge test -vvvCore Contract Addresses
Best Practices
Security
- • Use checks-effects-interactions pattern
- • Implement reentrancy guards for external calls
- • Validate all inputs thoroughly
- • Use OpenZeppelin's audited contracts
- • Get audited before mainnet deployment
- • Implement pausable functionality for emergencies
Gas Optimization
- • Pack storage variables efficiently
- • Use events instead of storage for history
- • Prefer calldata over memory for read-only
- • Cache array length in loops
- • Use custom errors instead of require strings
- • Batch operations when possible