Users
Users shows who uses your protocol, in groups such as your traders and your LPs: why a group’s figure moved and who moved it, how each user is doing, and whether new users come back. Alerts tell you when a user changes.
Groups
A user is one address, such as a wallet or a contract, across every watched contract. A workspace has no users until you make a group.
A group is a kind of user. It names the event field that holds the user, such as the owner of a Deposit, and every address named there is in it. A group can instead keep the users a rule holds for, such as volume over $1M. A user can be in several groups. A group can rank its users by one of its numbers, largest first, such as dollars traded or dollars deposited.
A list of addresses you import, such as Partners, is a group too. It has no type, so it has no states, Summary, alerts or report section.
Group types
Every other group has a type, which decides how its users are judged.
| Type | For | Judged by |
|---|---|---|
traders | Users that act: traders, swappers | Each user’s own pace |
holders | Users that hold: LPs, lenders, lockers | What each holds now against before. The group ranks by what each holds |
other | Voters, claimers | Each user’s own pace |
What a group measures
Every user has a first and last activity, a transaction count, dollars in and out, and the number of contracts it used. A group adds numbers of its own:
| Number | What it is | Example |
|---|---|---|
| Count | How many of an event the user made | Swaps |
| Sum | An event’s amount added up, in tokens or dollars | Volume |
| Read | A contract view called with the user’s address | LP now |
| Formula | An expression over the other numbers | Deposited − Withdrawn |
| Category | A label from rules you write | Whale, Other |
Counts and sums cover the workspace’s whole history. A read is the value on the chain now. A sum can be split by a field, such as volume by pool. A formula can read a figure over a period, such as volume in the last 7 days (sum(Volume, 7d)) or a position against its 30-day peak; a group cannot rank by one. See user for how each number is written.
How a user is doing
Each user in a group with a type has a state, judged against its own history.
Groups of traders and other, by each user’s usual gap between actions:
| State | Meaning |
|---|---|
| Active | Acting at its usual pace |
| Slowing | Silent for twice its usual gap, at least a day and at most 14 days |
| Quiet | Silent for three times its usual gap, at least 2 days and at most 30 days |
| Returned | Acted again in the last 7 days after going quiet |
Groups of holders, by what each holds:
| State | Meaning |
|---|---|
| Holding | Holds more than half of its 30-day high, and is not Added |
| Added | Held some 7 days ago and holds at least a quarter more now |
| Shrinking | Holds half or less of its 30-day high |
| Left | Holds nothing, or 1% or less of its 30-day high |
Why a group’s figure moved
A group’s Summary shows how the number it ranks by changed over a period, split by who changed it. For traders and other it compares what they did in the period with the period before; for holders, what they hold now with a period ago. The lines add up to the change, and each lists the users that moved it most.
| Line | Traders and other | Holders |
|---|---|---|
| New | First acted in this period | Holds now and never held before |
| Came back | Silent in the period before, active earlier | Held nothing a period ago, held earlier |
| Doing more | Did more than in the period before | Holds more than a period ago |
| About the same | Moved by less than the threshold | Moved by less than the threshold |
| Doing less | Did less than in the period before | Holds less than a period ago |
| Left | Acted in the period before, not since | Holds nothing, or under 1% of what it held a period ago |
Choose the period (1, 3, 7, 14 or 30 days, where the history covers it) and how far a user must move to count as doing more or less (any, 10%, 25% or 50%). A Summary needs a group of holders, or a group of traders or other ranked by a count or a sum.
Who to act on
Accounts lists a group’s largest users, each with its state, its open alerts and why it stands out: Withdrew its position · $25.4k at its peak. Sort by any number it shows, narrow it to one of the Summary’s lines, or Export it as CSV.
Retention shows how many new users the group gains each day and how many come back; for holders, how many still hold.
A user’s page
Open a user to see how it is doing in each of its groups, how its numbers changed over the period you choose, its open alerts and every action it took on your contracts. Search by address to find any user.
Alerts on users
An alert on users applies a rule you write to each user in a group, or to its N largest. Each user alerts and clears on its own, judged every 10 minutes.
On a group of holders, an alert covers every user that held anything in the last 30 days, so one that withdrew everything is still judged. On a large group of small users, such as traders, put a size in the rule rather than a top N: {State} == "Quiet" and {Volume} >= 10000. Creating an alert warns when its rule already holds for more than 100 users.
What a rule can read
| In the rule | Reads |
|---|---|
{LP now}, {Volume 7d} | Any of the group’s numbers, by label |
{State} | The user’s state in the group, such as "Quiet" or "Left" |
count(Swap, 7d) | How many of an event in the last 7 days |
sum(Volume, 7d) | A sum’s amount over the last 7 days |
count(Swap, 7d, 7d), sum(Volume, 7d, 7d) | The same over the 7 days before those |
usual(Swap, 7d), usual(Volume, 7d) | The user’s own average per 7 days, over its history before the current 7 days |
hoursSince(Swap), daysSince(Swap) | Time since its last such event; with none named, its last action in the group |
usualGap() | Its own usual gap between actions, in hours |
ago({LP now}, 7d) | A number as it stood 7 days ago |
peak({LP now}, 30d) | The most a number was in the last 30 days |
Periods run from 1h to 90d. Parts join with and and or.
Example rules
| To alert when | Rule |
|---|---|
| An LP has withdrawn half or more | {LP now} <= 0.5 * peak({LP now}, 30d) |
| An LP has grown by half in a week | {LP now} >= 1.5 * ago({LP now}, 7d) |
| A trader’s volume falls to half its usual week | sum(Volume, 7d) < 0.5 * usual(Volume, 7d) |
| A trader stops, against its own pace | {State} == "Quiet" |
| A trader has not swapped in 48 hours | hoursSince(Swap) > 48 |
Messages
| When | Message |
|---|---|
| The rule starts to hold for a user | Warning: 0x7094…58f8 (#12): LP now $0 · LP now 30d peak $25.4k, with each figure the rule read |
| It stops holding | Recovered: LPs withdrawing · no longer holds for 0x7094…58f8 · held for 3d |
Users arriving at once share one message. Users the rule already holds for when the alert is made are not sent. A message about one user links to its page.
Give a rule whose figure moves around its line, such as a volume or a count, an again-after period (--again-after 7d): once a user has been sent, it is not sent again for that long.
Changing an alert’s rule, its top N or its again-after period keeps the same alert: what it had open closes with nothing sent. Alerts on users are listed on Alerts with every other alert, where you can pause, resume or delete them, and send to the destinations they are given.
Not enough history
A figure without enough history behind it is unknown, such as a period that starts before the workspace’s history, or usual() without one whole period before the current one. ago() and peak() read daily values, kept for the number a group of holders ranks by, and for any other number from the day an alert first names it.
A rule holds for no user it is unknown for, and an open alert does not clear while its figure is unknown. An alert that can judge none of its users shows Not enough history.
Users in a report
A weekly report can carry a group’s week. See Groups of users.
Pin to the Overview
Pin a group’s top rows to the Overview, or the group as one figure: for holders, how many are in it now; for traders and other, how many acted in the last 24 hours.
Ask your agent
Groups and alerts on users are made and changed by your coding agent, the Slack/Telegram assistant or the CLI. Describe who your users are and what you want to hear about. Your agent finds the events, makes the groups and writes the rules. See Agent Integration.
Make a group of our LPs, ranked by what each holds in dollars.Tell #growth when an LP withdraws half or more of the most it held this month.Which of our traders have gone quiet?How concentrated is our traders' volume in the top ten?From the CLI
contract-dev user create LPs --type holders --who Deposit.owner \
--column "LP now=convertToAssets(balanceOf(user())); on group:Vaults; token asset(); show usd" \
--rank "LP now"
contract-dev alert create "LPs withdrawing" --on users:LPs \
--when "{LP now} <= 0.5 * peak({LP now}, 30d)" --again-after 7d --to "#growth"