A bot that participates in Filecoin Pay dutch auctions by monitoring active auctions and placing bids at regular intervals.
This bot monitors ERC20 token auctions on the Filecoin Pay contract and automatically places bids using FIL. The auctions use a dutch auction mechanism where prices decay exponentially over time, halving every 3.5 days.
- Monitors USDFC token auction
- Sushiswap price checking for profitable bidding
- Only bids when market price > auction price
- Periodically places bids directly from wallet based on configurable intervals
- Node.js (v18 or higher recommended)
- FIL tokens on Filecoin Calibration testnet (or mainnet)
- Private key for signing transactions
npm installCreate a .env file or set environment variables:
PRIVATE_KEY- Wallet private key (with 0x prefix)
RPC_URL- RPC endpoint (default:https://api.calibration.node.glif.io/). Chain is determined from the RPC.DELAY- Milliseconds between auction checks (default:600000= 10 minutes)
The bot monitors USDFC token only:
USDFC:
- Calibration:
0xb3042734b608a1B16e9e86B374A3f3e389B4cDf0 - Mainnet:
0x80B98d3aa09ffff255c3ba4A241111Ff1262F045
FIL (Sushiswap quotes):
- Calibration & Mainnet:
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
Note: Contract addresses are determined automatically by the SDK based on the chain ID. No manual contract address configuration is needed.
RPC_URL=https://api.calibration.node.glif.io/
PRIVATE_KEY=0x1234567890abcdef...
DELAY=600000Start the bot:
npm startThe bot will:
- Initialize and display wallet address and balance
- Monitor USDFC token for active auction (using
@filoz/synapse-coreSDK) - Check if auction has available fees
- Calculate auction price per token using SDK's
auctionPriceAtfunction - Get Sushiswap quote for WFIL → USDFC on mainnet to determine market price
- Compare market price vs auction price
- Place a bid only if market price >= auction price and wallet has sufficient balance
- Wait for configured delay before next check
- Repeat indefinitely
The auction bot can be deployed to Kubernetes using the provided kustomize manifests. This approach is suitable for production deployments and provides better resource management, monitoring, and operational capabilities.
- kubectl - Kubernetes command-line tool
- Access to a Kubernetes cluster (local via kind/minikube, or remote)
- Docker - Required only for local overlay
The repository includes three kustomize overlays for different environments:
| Overlay | Use Case | Image | Network | RPC URL |
|---|---|---|---|---|
local |
Local development/testing | auction-bot:local (built locally) |
Calibration | api.calibration.node.glif.io |
calibration |
Testnet deployment | filoz/auction-bot:latest |
Calibration | api.calibration.node.glif.io |
mainnet |
Production deployment | filoz/auction-bot:stable |
Mainnet | api.node.glif.io |
Before deploying, you must create and configure the wallet private key secret file for your target environment:
- Copy the example secret file to create your actual secret file:
# For local deployment
cp kustomize/overlays/local/secret.yaml.example kustomize/overlays/local/secret.yaml
# For calibration deployment
cp kustomize/overlays/calibration/secret.yaml.example kustomize/overlays/calibration/secret.yaml
# For mainnet deployment
cp kustomize/overlays/mainnet/secret.yaml.example kustomize/overlays/mainnet/secret.yaml- Edit the secret file and replace
<PRIVATE_KEY>with your actual private key (including0xprefix):
apiVersion: v1
kind: Secret
metadata:
name: auction-bot-secrets
namespace: filecoin-pay-auction-bot
type: Opaque
stringData:
PRIVATE_KEY: '0x1234567890abcdef...'Security Warning:
- The
secret.yamlfile is in.gitignoreand will never be committed - Template files (
secret.yaml.example) are safe to commit as they contain only placeholders - For production deployments, consider using Sealed Secrets or External Secrets Operator
- Alternatively, create secrets directly:
kubectl create secret generic auction-bot-secrets --from-literal=PRIVATE_KEY=0x... -n filecoin-pay-auction-bot
For local development and testing:
- Build the Docker image:
docker build -t auction-bot:local .-
Configure the secret (see above)
-
Deploy to your local cluster:
kubectl apply -k kustomize/overlays/local- View logs:
kubectl logs -n filecoin-pay-auction-bot -l app.kubernetes.io/name=auction-bot -fFor testnet deployment:
-
Configure the secret (see above)
-
Deploy to your cluster:
kubectl apply -k kustomize/overlays/calibration- Monitor the deployment:
kubectl get pods -n filecoin-pay-auction-bot -w- View logs:
kubectl logs -n filecoin-pay-auction-bot -l app.kubernetes.io/name=auction-bot -fFor production deployment:
-
Configure the secret (see above)
-
Review the configuration:
- Uses stable image tag (
filoz/auction-bot:stable) - Connects to mainnet RPC (
api.node.glif.io) - Ensure wallet has sufficient FIL balance
- Uses stable image tag (
-
Deploy to your cluster:
kubectl apply -k kustomize/overlays/mainnet- Monitor the deployment:
kubectl get pods -n filecoin-pay-auction-bot -w- View logs:
kubectl logs -n filecoin-pay-auction-bot -l app.kubernetes.io/name=auction-bot -fCheck pod status:
kubectl get pods -n filecoin-pay-auction-botView detailed pod information:
kubectl describe pod -n filecoin-pay-auction-bot -l app.kubernetes.io/name=auction-botUpdate configuration:
Edit the configmap patch file, then reapply:
# Edit configuration
vi kustomize/overlays/{local|calibration|mainnet}/configmap-patch.yaml
# Apply changes
kubectl apply -k kustomize/overlays/{local|calibration|mainnet}
# Restart pod to pick up changes
kubectl rollout restart deployment/auction-bot -n filecoin-pay-auction-botDelete deployment:
kubectl delete -k kustomize/overlays/{local|calibration|mainnet}Delete namespace (removes all resources):
kubectl delete namespace filecoin-pay-auction-botnpm testnpm run lint:fix- index.js - Core library functions
- bin/bot.js - Main bot entry point
- test/test.js - Unit tests
Filecoin Pay uses dutch auctions where:
- Price starts at
startPriceand decays exponentially - Price halves every 3.5 days (302,400 seconds)
- Formula:
price = startPrice / 2^(elapsed / 3.5days)
- Query auction info for USDFC using SDK's
auctionInfo() - Skip if no active auction (startTime = 0) or no available fees
- Query available fees using SDK's
auctionFunds() - Calculate auction price per token using SDK's
auctionPriceAt()with current timestamp - Get Sushiswap quote for available fees in the auction.
- Compare profitability: Only proceed if market price > auction price
- Verify wallet has sufficient FIL balance
- Place bid via
burnForFees(token, recipient, amount)function
This bot uses the @filoz/synapse-core SDK for:
- ABI definitions - Imports canonical FilecoinPay ABI from SDK
- Auction queries - Uses
auctionInfo()andauctionFunds()functions - Price calculation - Uses
auctionPriceAt()for accurate next-block pricing - Contract addresses - Automatically resolved from chain ID via
getChain()
FilecoinPay contract addresses used by SDK:
- Calibration (chain ID 314159):
0x09a0fDc2723fAd1A7b8e3e00eE5DF73841df55a0 - Mainnet (chain ID 314):
0x23b1e018F08BB982348b15a86ee926eEBf7F4DAa
The bot uses Sushiswap quote API to check market prices before bidding:
- Quote pair: USDFC → FIL (using the 0.05% slippage)
- Quote network: Always queries mainnet for accurate pricing (even when bidding on Calibration)
- Profitability check: Only bids when market price > auction price
This ensures the bot never overpays for tokens relative to their market value.
See LICENSE file for details.