Skip to content

For House of Stake engineers

What moves when a berth changes hands.

Read in source at commit d85860a8cc, then reproduced in a local sandbox against the real House of Stake wasm. This is a design detail, not a vulnerability: it is why Berthright pays wages in a token, signs off before the hand-over, and empties the berth in the same approval.

What happensSourceSandbox test and output
Native NEAR above the storage reserve goes to the seller's payout account at transferhos-wallet/src/lib.rs:791

tla_transfer_sweeps_native_near_to_the_seller_but_leaves_tokens

swept_near {"payout_account":"arjun.test.near","amount":"5191552346517347000000000"}

NEP-141 balances stay in the account and pass to the buyerhos-wallet/src/lib.rs:752

tla_transfer_sweeps_native_near_to_the_seller_but_leaves_tokens

100 tUSD in the berth before and after; the relief controls them

Unless the registry allowlists the token: then the transfer is refused while the name holds ittla-registry/src/nft.rs:161

an_allowlisted_token_blocks_the_transfer_until_the_berth_is_empty

SubAccountHoldsTokens; transfer passes once emptied

Every grant and extension except the authority is wipedhos-wallet/src/lib.rs:786

tla_transfer_wipes_the_allotment_grant

hos_spend_grant(allotment) = null; extensions = [authority, relief]

A failed sweep leaves the NEAR for the new ownerhos-wallet/src/lib.rs:917

a_failed_sweep_leaves_the_near_for_the_new_owner

sweep_failed {"payout_account":"ghost.test.near","amount":"3191552346517347000000000"}

rotation_seq goes up on every hand-overhos-wallet/src/lib.rs:794

tla_transfer_sweeps_native_near_to_the_seller_but_leaves_tokens

0 then 1

Full write-up: docs/FINDINGS.md and docs/FRICTION.md. Reproduce: fleet/build-hos.sh then cargo test -p portage --test tla_transfer.