Skip to the plate
Atlas of Engrama mind in the poolPlate II
Plate II

Memory

The hook remembers every address that signs a trade putting 0.005 ETH or more through the pool. Eight such trades later it learns how far the price went on in that trade's direction, and folds the answer into the signer's memory: an average markout, in basis points, in which each trade counts by its size.

The mind reads that memory as input h. An address the hook has never seen carries input i instead, fresh, and the mind may price a stranger differently from a regular. Nothing here is a reputation anyone grants: it is arithmetic on the address's own trades.

I. Look up an address

III. How a memory is made

A trade waits in a ring of eight. When the eighth trade after it arrives, its markout is known: how many basis points the price moved on in the trade's direction, measured from the price the trade itself left, so that a trade's own impact never counts. The label is clipped to 200 bps either way.

memory = label, for the first
memory = (memory x (64 minus w) + label x w) / 64, after
w = the trade's weight in sixteenths, 1 to 48

Each label moves the memory by its own trade's weight, w sixty-fourths of the way. A trade that puts 0.15 ETH or more through the pool moves it three quarters of the way to the new label; the smallest remembered trade moves it one sixty-fourth. A big trade counts as much as many small ones, so a record cannot be washed clean with small round trips. The mind sees the memory scaled by how much it has to go on: one labelled trade counts an eighth, eight or more count in full.

Only trades that put 0.005 ETH or more through the pool are remembered. The ether counted, for this test and for the weight, is what went through the pool after a fee taken before the swap: a 0.15 ETH exact-in buy pays its 1.00% first and weighs 47 sixteenths, not 48. A smaller trade pays the hook fee and its LP fee like any other, but it takes no place in the ring, writes no trace, changes no memory and leaves the market state the mind reads as it was, so dust can neither crowd out other trades nor shape anyone's record.