Skip to content

Commit 5f58651

Browse files
committed
docs: document get-pox-addr and the signer-calldata a manager must accept
1 parent 66e2848 commit 5f58651

1 file changed

Lines changed: 26 additions & 7 deletions

File tree

docs/operate/deploy-a-signer-manager-contract.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,37 @@ The reference manager uses it to let a staker elect a native BTC payout. It dese
7878
(map-set pox-addrs staker pox-addr)
7979
```
8080

81-
At claim time `claim-staker-rewards` reads that entry back. With a record it calls `sbtc-withdrawal::initiate-withdrawal-request`, and without one it transfers sBTC directly.
81+
At claim time `claim-staker-rewards` reads that entry back. With a record it calls `sbtc-withdrawal::initiate-withdrawal-request`, and without one it transfers sBTC directly. `max-fee` is the fee ceiling it passes to that withdrawal, not a fee the manager takes.
82+
83+
Clients read the same entry through `get-pox-addr`, which answers `none` for a staker who has not elected an address:
84+
85+
```clarity
86+
(define-read-only (get-pox-addr (staker principal))
87+
(map-get? pox-addrs staker)
88+
)
89+
```
90+
91+
It returns `(optional { pox-addr: { version: (buff 1), hashbytes: (buff 32) }, max-fee: uint })`. This is how an app shows a staker where their rewards will land, and how it tells whether a manager keeps an election at all.
92+
93+
**What your manager has to accept**
94+
95+
A client builds this calldata once and sends it to whichever manager the staker picked. A manager stricter than the buffer it receives fails the staking transaction outright, so whatever you go on to do with the value, accept all of it:
96+
97+
* Both `none` and `(some buffer)` arrive, depending on which reward asset the staker chose. Requiring either one breaks the stakers who chose the other.
98+
* Deserialize `hashbytes` as `(buff 32)`. A 20-byte value fits that type and a 32-byte value does not fit `(buff 20)`, and `from-consensus-buff?` answers a type mismatch with `none`, which surfaces as `ERR_INVALID_CALLDATA`.
99+
* Accept the two-field `{ pox-addr, max-fee }` shape even if you add fields of your own, the way `fastpool-max500-signer-manager` accepts it alongside its own three-field tuple.
100+
* Accept the full PoX address version range rather than the versions you have seen. Clients paying out to a Bitcoin lock send `0x04` with 20 bytes and `0x05` with 32; `check-pox-addr` already covers all of them.
82101

83102
**What the deployed managers do with it**
84103

85104
The convention is per contract, so calldata built for one manager is not portable to another. Read the contract you are staking to.
86105

87-
| Contract | Shape it deserializes | Stored in | Changeable without a staking transaction |
88-
| -------------------------------- | ----------------------------------------------------------------------------------- | ---------------- | ---------------------------------------- |
89-
| `fastpool-1-signer-manager` | `{ pox-addr, max-fee }` | `pox-addrs` | No |
90-
| `xverse-signer-manager-1` | `{ pox-addr, max-fee }` | `pox-addrs` | No |
91-
| `fastpool-max500-signer-manager` | `{ pox-addr, max-fee, min-claim }`, and the two-field shape above is still accepted | `payout-configs` | Yes, via `set-payout-config` |
92-
| `native-pool-signer-manager` | None. The buffer is ignored entirely | Nothing | Not applicable |
106+
| Contract | Shape it deserializes | Stored in | Read back with | Changeable without a staking transaction |
107+
| -------------------------------- | ----------------------------------------------------------------------------------- | ---------------- | ------------------- | ---------------------------------------- |
108+
| `fastpool-1-signer-manager` | `{ pox-addr, max-fee }` | `pox-addrs` | `get-pox-addr` | No |
109+
| `xverse-signer-manager-1` | `{ pox-addr, max-fee }` | `pox-addrs` | `get-pox-addr` | No |
110+
| `fastpool-max500-signer-manager` | `{ pox-addr, max-fee, min-claim }`, and the two-field shape above is still accepted | `payout-configs` | `get-payout-config` | Yes, via `set-payout-config` |
111+
| `native-pool-signer-manager` | None. The buffer is ignored entirely | Nothing | Nothing | Not applicable |
93112

94113
Three consequences follow from that table.
95114

0 commit comments

Comments
 (0)