Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

service_market state

Back to all declarations

Denom

untyped string

Denom is the only asset this realm accepts.

Value

"ugnot"

MaxFeeBps

int64

MaxFeeBps is the hard protocol-fee cap: 1000 bps = 10%.

Value

1000

AcceptanceBlocks

int64

AcceptanceBlocks is how long a customer has to accept a delivery before anyone may release it to the provider. It is a PROTOCOL constant on purpose — see the header. ~7 days at pearl's observed ~4.2s blocks.

Value

140000

ServiceActive

untyped string

Service status values.

Value

"active"

ServiceRetired

untyped string

Service status values.

Value

"retired"

OrderPurchased

untyped string

Order status values. Released and Refunded are terminal.

Value

"purchased"

OrderDelivered

untyped string

Order status values. Released and Refunded are terminal.

Value

"delivered"

OrderReleased

untyped string

Order status values. Released and Refunded are terminal.

Value

"released"

OrderRefunded

untyped string

Order status values. Released and Refunded are terminal.

Value

"refunded"

MaxTitleLen

untyped bigint

Input bounds.

Value

(80 <untyped> bigint)

MaxDescLen

untyped bigint

Input bounds.

Value

(2000 <untyped> bigint)

MaxURILen

untyped bigint

Input bounds.

Value

(400 <untyped> bigint)

MinPrice

int64

Input bounds.

Value

1

MinDeliveryBlocks

int64

Input bounds.

Value

850

MaxDeliveryBlocks

int64

Input bounds.

Value

1200000

MaxServicesPerProvider

untyped bigint

Input bounds.

Value

(20 <untyped> bigint)

RenderLimit

untyped bigint

Input bounds.

Value

(20 <untyped> bigint)

service

type

Value

service_market.service

order

type

Value

service_market.order

admin

.uverse.address

// may set fee, fee recipient, stage successor

Value

<gnolang.StringValue>

pendingAdmin

.uverse.address

// staged by TransferAdmin, completes via AcceptAdmin

Value

<zero>

feeRecipient

.uverse.address

// may withdraw fees and sweep surplus

Value

<gnolang.StringValue>

feeBps

int64

// fee snapshotted into NEW services

Value

500

self

.uverse.address

// this realm's address, captured at deploy

Value

<gnolang.StringValue>

nextService

int64

Value

1

nextOrder

int64

Value

2

escrowTotal

int64

// == Σ amount over Purchased and Delivered orders

Value

0

providerNum

*v0.Tree

// address -> \*int64, services per provider

Open
OID
00b940…bcd2:18
providerNum details

Inspect pointer

RegisterService

func(title string, description string, price int64, deliveryBlocks int64, maxFeeBps int64) int64

RegisterService publishes a standing offer and returns its id. No coins are accepted; the storage deposit the caller pays is the anti-spam. The current protocol fee is snapshotted into the service and must not exceed maxFeeBps, the ceiling the provider signed for — pass MaxFeeBps to accept any legal fee. Providers may be EOAs or realms, but a realm provider takes on three obligations that this realm cannot check for it. Realm bytes are immutable after addpkg, so a realm deployed without them cannot acquire them later: failing (1) means it never earns, failing (2) or (3) means what it earned is permanently stranded. 1. It must already expose a crossing entrypoint that calls MarkDelivered. That is the only transition to OrderDelivered, and both release paths require it, so a provider realm that cannot call it never earns a credit at all — every order against it runs to ClaimRefund instead. This obligation binds before the next one. 2. It must already expose a crossing entrypoint that calls Claim or ClaimAll on this realm. A credited balance is a pull, never a push; nothing here can reach into a provider realm to deliver it. 3. It must make both calls in transactions whose ORIGIN carried no -send, per the REALM-CALLER CAVEAT in the package header. The customer side is not symmetric: PurchaseService is payable and routes through coinio.Receive, which requires an EOA calling directly via MsgCall. A realm can therefore sell a service here but cannot buy one — and "can sell" is exactly as strong as the three obligations above, no stronger. A customer is structurally always an EOA, which is why the permissionless valves are always pullable.

Open
OID
00b940…bcd2:27
RegisterService details

Inspect func

RetireService

func(id int64)

RetireService stops a service accepting NEW orders. Orders already in flight keep their own copies of provider, amount and fee, and run to their own terminal states unaffected. Provider only, and terminal — there is no un-retire, so a customer reading "active" cannot have it flicker underneath them.

Open
OID
00b940…bcd2:28
RetireService details

Inspect func

PurchaseService

func(serviceID int64) int64

PurchaseService escrows EXACTLY the listed price and opens an order. The caller must be an EOA (coinio.Receive is the receipt-guaranteed shape) and must attach exactly the price in ugnot; any mismatch aborts and the coins revert with the transaction. Self-purchase is rejected.

Open
OID
00b940…bcd2:29
PurchaseService details

Inspect func

MarkDelivered

func(orderID int64, uri string)

MarkDelivered records that the work is done and starts the acceptance window. Provider only. The uri is an opaque reference to the deliverable; this realm neither fetches nor interprets it, and it is sanitized on the way out to Render. Delivering AFTER the delivery deadline is allowed as long as nobody has yet called ClaimRefund — late work the customer still wants should not be destroyed by a deadline that exists to protect the customer. The customer's remedy is unchanged: they simply do not accept, and the refund valve stays open right up until this transition lands.

Open
OID
00b940…bcd2:30
MarkDelivered details

Inspect func

AcceptDelivery

func(orderID int64)

AcceptDelivery is THE RESOLUTION: the customer accepts the delivered work and the escrow becomes the provider's claimable balance, minus the fee snapshotted into the order at purchase. Customer only.

Open
OID
00b940…bcd2:31
AcceptDelivery details

Inspect func

ReleaseTimeout

func(orderID int64)

ReleaseTimeout releases a delivered order to the provider once the acceptance window has lapsed. Permissionless: a customer who stops responding must not be able to strand a provider's completed work. This is deemed acceptance, and it is the only path by which escrow reaches a provider without the customer's explicit act.

Open
OID
00b940…bcd2:32
ReleaseTimeout details

Inspect func

DeclineOrder

func(orderID int64)

DeclineOrder returns the escrow to the customer before delivery. Provider only, fee-free — a provider who cannot fulfil should be able to hand the money straight back rather than wait out a deadline. Safe to allow unilaterally because it only ever moves value AWAY from the caller.

Open
OID
00b940…bcd2:33
DeclineOrder details

Inspect func

ClaimRefund

func(orderID int64)

ClaimRefund returns the escrow to the customer once the provider has missed the delivery deadline. Permissionless: a provider who abandons an order must not be able to strand the customer's money. It is fee-free. Charging a protocol fee on a refund would mean the marketplace profits from provider non-performance.

Open
OID
00b940…bcd2:34
ClaimRefund details

Inspect func

Claim

func(amount int64)

Claim sends amount ugnot of the caller's claimable balance back to the caller.

Open
OID
00b940…bcd2:35
Claim details

Inspect func

ClaimAll

func()

ClaimAll sends the caller's entire claimable balance back to the caller. Fails if there is nothing to claim.

Open
OID
00b940…bcd2:36
ClaimAll details

Inspect func

WithdrawFees

func()

WithdrawFees sends the accrued fee pot to the fee recipient. Only the fee recipient may call it.

Open
OID
00b940…bcd2:37
WithdrawFees details

Inspect func

SweepDenom

func(denom string)

SweepDenom sends the surplus of a single denomination to the fee recipient. For ugnot only the excess over Liabilities() moves — which reserves live escrow as well as claimable balances and the fee pot — and other denoms move wholly. Only the fee recipient may call it.

Open
OID
00b940…bcd2:38
SweepDenom details

Inspect func

SetFeeBps

func(bps int64)

SetFeeBps sets the protocol fee snapshotted into FUTURE services. Existing services, and every order already placed against them, keep the fee they were created under. Admin only; bounded by \[0, MaxFeeBps].

Open
OID
00b940…bcd2:39
SetFeeBps details

Inspect func

SetFeeRecipient

func(next .uverse.address)

SetFeeRecipient sets the address that may withdraw fees and sweep surplus. Admin only.

Open
OID
00b940…bcd2:40
SetFeeRecipient details

Inspect func

TransferAdmin

func(next .uverse.address)

TransferAdmin stages a successor. Two-step: the successor must call AcceptAdmin, so a typo cannot orphan the realm. Admin only. Passing the zero address cancels a pending nomination; any other value must be a well-formed address, for parity with SetFeeRecipient. The two-step handover already made a malformed nominee harmless — it could never call AcceptAdmin — so this check rejects the typo at the point it is made rather than leaving it staged and readable as a real nomination.

Open
OID
00b940…bcd2:41
TransferAdmin details

Inspect func

AcceptAdmin

func()

AcceptAdmin completes a staged handover. Only the nominee may call it.

Open
OID
00b940…bcd2:42
AcceptAdmin details

Inspect func

ServiceInfo

func(id int64) (provider .uverse.address, title string, price int64, deliveryBlocks int64, feeBps int64, status string, orderCount int64)
Open
OID
00b940…bcd2:43
ServiceInfo details

Inspect func

ServiceDescription

func(id int64) string
Open
OID
00b940…bcd2:44
ServiceDescription details

Inspect func

OrderInfo

func(id int64) (serviceID int64, customer .uverse.address, provider .uverse.address, amount int64, feeBps int64, status string)
Open
OID
00b940…bcd2:45
OrderInfo details

Inspect func

OrderDeadlines

func(id int64) (deliveryDeadline int64, acceptanceDeadline int64)

OrderDeadlines returns the two absolute heights that govern an order. acceptanceDeadline is 0 until the order is delivered.

Open
OID
00b940…bcd2:46
OrderDeadlines details

Inspect func

Quote

func(id int64) (price int64, fee int64, toProvider int64)

Quote reports what a purchase of this service would cost and what the provider would receive on resolution, at the service's snapshotted fee.

Open
OID
00b940…bcd2:48
Quote details

Inspect func

PendingAdmin

func() .uverse.address
Open
OID
00b940…bcd2:50
PendingAdmin details

Inspect func

FeeRecipient

func() .uverse.address
Open
OID
00b940…bcd2:51
FeeRecipient details

Inspect func

ServicesOf

func(a .uverse.address) int64
Open
OID
00b940…bcd2:55
ServicesOf details

Inspect func

BalanceOf

func(addr .uverse.address) int64
Open
OID
00b940…bcd2:56
BalanceOf details

Inspect func

EscrowTotal

func() int64

EscrowTotal is the live escrow pool E: the sum of every order still in Purchased or Delivered.

Open
OID
00b940…bcd2:59
EscrowTotal details

Inspect func

Liabilities

func() int64

Liabilities is everything this realm owes: live escrow, claimable balances and the fee pot. SweepDenom reserves exactly this.

Open
OID
00b940…bcd2:60
Liabilities details

Inspect func

renderService

func(arg string) string
Open
OID
00b940…bcd2:66
renderService details

Inspect func

renderOrder

func(arg string) string
Open
OID
00b940…bcd2:67
renderOrder details

Inspect func

realmPath

untyped string

Value

"/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/service_market"

release

func(o *service_market.order, reason string)

release moves an order's escrow into the provider's claimable balance at the order's snapshotted fee, and drives the order terminal. The status write and the escrow decrement happen together with the credit, so no order can be released twice and E stays exactly Σ open amounts.

Open
OID
00b940…bcd2:68
release details

Inspect func

refund

func(o *service_market.order, reason string)

refund moves an order's escrow into the customer's claimable balance at ZERO fee and drives the order terminal.

Open
OID
00b940…bcd2:69
refund details

Inspect func

assertNoSend

func()

assertNoSend refuses coins on non-payable entrypoints: an accidental -send would otherwise strand at the realm as sweep-only surplus. PurchaseService is the only payable function. NOTE: this reads the ORIGIN envelope — see the realm-provider caveat in the header.

Open
OID
00b940…bcd2:70
assertNoSend details

Inspect func

assertAdmin

func(caller .uverse.address)
Open
OID
00b940…bcd2:71
assertAdmin details

Inspect func

mustGetService

func(id int64) *service_market.service
Open
OID
00b940…bcd2:72
mustGetService details

Inspect func

mustGetOrder

func(id int64) *service_market.order
Open
OID
00b940…bcd2:73
mustGetOrder details

Inspect func

countFor

func(a .uverse.address) int64

countFor reports how many ACTIVE services an address holds.

Open
OID
00b940…bcd2:74
countFor details

Inspect func

bumpFor

func(a .uverse.address, delta int64)

bumpFor adjusts the active-service counter, removing the entry at zero so a provider who retires everything stops paying for the slot.

Open
OID
00b940…bcd2:75
bumpFor details

Inspect func

assertValidTitle

func(title string)

assertValidTitle bounds length and restricts the charset so titles are list-safe in Render without escaping.

Open
OID
00b940…bcd2:76
assertValidTitle details

Inspect func

padID

func(id int64) string

padID renders an id as a fixed-width key so avl iteration order is numeric order.

Open
OID
00b940…bcd2:77
padID details

Inspect func

checkedAdd

func(a int64, b int64) (int64, bool)
Open
OID
00b940…bcd2:78
checkedAdd details

Inspect func
Denom : untyped string ="ugnot"
MaxFeeBps : int64 =1000
AcceptanceBlocks : int64 =140000
ServiceActive : untyped string ="active"
ServiceRetired : untyped string ="retired"
OrderPurchased : untyped string ="purchased"
OrderDelivered : untyped string ="delivered"
OrderReleased : untyped string ="released"
OrderRefunded : untyped string ="refunded"
MaxTitleLen : untyped bigint =(80 <untyped> bigint)
MaxDescLen : untyped bigint =(2000 <untyped> bigint)
MaxURILen : untyped bigint =(400 <untyped> bigint)
MinPrice : int64 =1
MinDeliveryBlocks : int64 =850
MaxDeliveryBlocks : int64 =1200000
MaxServicesPerProvider : untyped bigint =(20 <untyped> bigint)
RenderLimit : untyped bigint =(20 <untyped> bigint)
service : type =service_market.service
order : type =service_market.order
admin : .uverse.address =<gnolang.StringValue>
pendingAdmin : .uverse.address =<zero>
feeRecipient : .uverse.address =<gnolang.StringValue>
feeBps : int64 =500
self : .uverse.address =<gnolang.StringValue>
nextService : int64 =1
nextOrder : int64 =2
escrowTotal : int64 =0
services : *v0.Tree Inspect
orders : *v0.Tree Inspect
providerNum : *v0.Tree Inspect
ledger : *feeledger.Ledger Inspect
init.31 : func() Inspect
RegisterService : func(title string, description string, price int64, deliveryBlocks int64, maxFeeBps int64) int64 Inspect
RetireService : func(id int64) Inspect
PurchaseService : func(serviceID int64) int64 Inspect
MarkDelivered : func(orderID int64, uri string) Inspect
AcceptDelivery : func(orderID int64) Inspect
ReleaseTimeout : func(orderID int64) Inspect
DeclineOrder : func(orderID int64) Inspect
ClaimRefund : func(orderID int64) Inspect
Claim : func(amount int64) Inspect
ClaimAll : func() Inspect
WithdrawFees : func() Inspect
SweepDenom : func(denom string) Inspect
SetFeeBps : func(bps int64) Inspect
SetFeeRecipient : func(next .uverse.address) Inspect
TransferAdmin : func(next .uverse.address) Inspect
AcceptAdmin : func() Inspect
ServiceInfo : func(id int64) (provider .uverse.address, title string, price int64, deliveryBlocks int64, feeBps int64, status string, orderCount int64) Inspect
ServiceDescription : func(id int64) string Inspect
OrderInfo : func(id int64) (serviceID int64, customer .uverse.address, provider .uverse.address, amount int64, feeBps int64, status string) Inspect
OrderDeadlines : func(id int64) (deliveryDeadline int64, acceptanceDeadline int64) Inspect
OrderURI : func(id int64) string Inspect
Quote : func(id int64) (price int64, fee int64, toProvider int64) Inspect
Admin : func() .uverse.address Inspect
PendingAdmin : func() .uverse.address Inspect
FeeRecipient : func() .uverse.address Inspect
FeeBps : func() int64 Inspect
NumServices : func() int64 Inspect
NumOrders : func() int64 Inspect
ServicesOf : func(a .uverse.address) int64 Inspect
BalanceOf : func(addr .uverse.address) int64 Inspect
UsersTotal : func() int64 Inspect
FeesAccrued : func() int64 Inspect
EscrowTotal : func() int64 Inspect
Liabilities : func() int64 Inspect
Held : func() int64 Inspect
Surplus : func() int64 Inspect
Address : func() .uverse.address Inspect
Height : func() int64 Inspect
Render : func(path string) string Inspect
renderService : func(arg string) string Inspect
renderOrder : func(arg string) string Inspect
realmPath : untyped string ="/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/service_market"
release : func(o *service_market.order, reason string) Inspect
refund : func(o *service_market.order, reason string) Inspect
assertNoSend : func() Inspect
assertAdmin : func(caller .uverse.address) Inspect
mustGetService : func(id int64) *service_market.service Inspect
mustGetOrder : func(id int64) *service_market.order Inspect
countFor : func(a .uverse.address) int64 Inspect
bumpFor : func(a .uverse.address, delta int64) Inspect
assertValidTitle : func(title string) Inspect
padID : func(id int64) string Inspect
checkedAdd : func(a int64, b int64) (int64, bool) Inspect
itoa : func(n int64) string Inspect