INTELLIGENT DANCE MARKET · DOCS
How it works
$IDM trades on a Uniswap v4 pool with a hook that works like a 16-step drum machine. Each swap changes the pattern stored in the contract, and the player on this site plays it back.
01 The idea
The hook keeps a small sequencer in contract storage. There is a 4 × 16 drum grid (kick, snare, hat, glitch), a 16-step bass line, tempo, key, mode, a page counter and a heat value. After each swap in the IDM/ETH pool the hook looks at the trade, whether it was a buy or a sell, how much ETH moved and where the price ended up, and updates the sequencer.
The contract only stores notes. The sound is made by the synth in your browser. It reads the same state for everyone, so everyone hears the same music.
The hook has no owner and can't be upgraded. It takes no fee and never holds funds. It was launched through IMD, and their agent swarm reviewed and deployed the contracts.
02 What a swap does
Step
The step, 1 to 16, is picked by a hash of the swap count, the price tick and the block number, so you can't choose where your trade lands.
Drum
The drum depends on how big the trade is compared with recent trades in the same pool. The hook keeps a running average of trade sizes, so the rules work the same way for a tiny pool and a big one.
| Trade size vs. average | Drum |
|---|---|
| below ~0.7× | hat |
| ~0.7× to 1.5× | glitch |
| ~1.5× to 3× | snare |
| above ~3× | kick |
Buys and sells
A buy turns its cell on. If that cell is already on, it moves up to the next drum on the same step (hat, glitch, snare, kick). If the whole step is full, it goes to the next free step on its own drum.
A sell turns a cell off. It can remove hats, glitches and snares, but never a kick, so selling thins the beat without breaking it.
Bass, tempo and mode
- A buy also writes a bass note on its step, pitched by the price. A sell removes it about half the time.
- Tempo follows how often people trade. The chain value runs from 72 to 118 and each genre maps it into its own range, so a busy pool plays faster.
- Mode follows buying and selling pressure. Heavy buying plays in Lydian, light buying in Dorian, light selling in Phrygian and heavy selling in Locrian.
03 Whales
A whale is any trade above a size threshold. The threshold isn't a fixed number. The hook works it out after every swap from the pool's fully diluted value, which it gets from the price.
whale = 2·10⁷ · √FDV (FDV in wei, kept between 0.005 and 50 ETH)
| Pool FDV | Whale threshold |
|---|---|
| 4 ETH | 0.04 ETH |
| 10 ETH | ~0.063 ETH |
| 40 ETH | 0.126 ETH |
| 400 ETH | 0.4 ETH |
| 4,000 ETH | 1.26 ETH |
Because it follows the square root, the threshold rises more slowly than the pool, and whales stay fairly rare as the project grows. You can read the current value from whaleThreshold() on the hook.
A whale changes a whole drum instead of one cell. A whale buy fills a drum with an evenly spaced rhythm of 3 to 8 hits. A whale sell clears a drum completely. In both cases the key moves up a fifth and the page turns. Whales don't change heat.
04 Heat and finished tracks
When 44 or more of the 64 cells are on, each buy adds 1 heat, including a buy that has nowhere left to go, and each sell takes 1 away. You can see it on the HEAT meter. As heat goes up the music gets busier, with the filter opening, hat rolls and a riser.
At 16 heat the track is finished. The hook emits TrackComplete with the final pattern and starts a new track. The new track gets a starting beat from a fixed set, keeps only the bass notes on the main beats, moves up a fifth and gets the next track number.
If nobody trades for an hour, heat goes back to 0, but the grid stays as it is. In practice a track finishes when buyers keep coming into a full grid. In a flat or falling market a track can stay open for a long time.
05 Pages, epochs and genres
The page number goes up every 64 swaps, on every whale and on every finished track. Four pages make an epoch, and each epoch has one genre. Genres play in rounds. Every round plays each genre once in a shuffled order, and the same genre never plays twice in a row. Each genre also has a few variations that rotate between its appearances.
Genres currently in rotation:
New genres can be added later, starting from a future epoch. Earlier epochs keep the music they had.
06 How it sounds
The synth arranges the pattern into a 32-bar song form with an intro, build, full section, breakdown and rebuild. The pool decides the notes and how dense they are, the form decides which parts play. Every genre has its own drums, bass, chords and effects.
When trading stops, the music winds down gradually.
| Time since last swap | What plays |
|---|---|
| under 10 min | everything |
| 10 to 30 min | glitch and hats fade out, then the snare |
| 30 to 60 min | pad, bass and a soft kick |
| over 60 min | a held drone |
The next swap brings it all back, since the grid itself never resets.
07 Releases and posts
Every finished track becomes a release. It replays the whole track from its on-chain history, from its first swap to the finish, at about one swap per bar, in the genre it ended on. Most releases run 3 to 5 minutes, and anyone can rebuild one from the chain data.
Our bot renders the releases and posts them on @theidmfun, along with snapshots of the live pattern and whale moments. It posts at most six times a day.
08 Pulse treasury
The pulse treasury is a separate contract, also with no owner. Its job is to keep the music going when nobody trades. If there has been no swap for 15 minutes, anyone can call pulse() and the treasury makes a small IDM buy with ETH. The hook treats it like any other buy, usually as a hat, and on a full grid it adds heat.
- A pulse spends at most 0.002 ETH and never more than 1% of the treasury balance. It can move the price by about 2% at most.
- Any real swap resets the 15-minute wait, so pulses only happen in quiet periods.
- Once a day, the IDM the pulses bought is burned. The IDM from fees is burned by the fee splitter (see Token and fees).
- Pulses are marked as PULSE on the site and in posts.
09 Token and fees
- $IDM has a fixed supply of 1,000,000,000. At launch 10% goes to the IMD swarm that built and deployed it, and the other 90% goes into the pool. There is no team allocation.
- The pool fee is 1.25% per trade, set by IMD's launch rules. 0.25% goes to the IMD network. The other 1% is the launcher's share and goes to a fee splitter contract with no owner: half of the ETH goes to the pulse treasury, half goes to the team, and every IDM token from fees is burned. The team never receives IDM from fees.
- The hook adds no fee of its own.
10 Contracts
The source code is on GitHub. The Solidity hook and the TypeScript model share a set of test vectors and produce exactly the same state.
11 FAQ
Can anyone change the rules?
No. The hook has no owner and can't be upgraded. The only thing that changes the pattern is trading.
My swap failed with "out of gas". Why?
How much work the hook does depends on the block your swap ends up in, so a gas estimate made a block earlier can come up a few thousand gas short. Most wallets add a buffer. If yours doesn't, set a slightly higher gas limit.
Can I pick the genre?
No. The chain decides, one genre per epoch.
Are all buys real trades?
All of them except pulses, which come from the treasury after 15 minutes of silence and are marked as such.