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

escrow_v3 source realm

Constants 3

const PlatformFeePct, CancelFeePct, AutoRefundBlks, AutoResolveBlks, MaxTitleLen, MaxDescLen, MaxMilestones, MaxContracts, MinMilestoneAmount

 1const (
 2	// No authority address is compiled in. admin.gno seeds the live `admin` and
 3	// the fee fail-safe `feeFallback` from the publishing transaction's signer at
 4	// package load (on gnoland-1 the samcrew namespace multisig, the stamped
 5	// creator at enable time); admin is rotated via TransferOwnership/
 6	// AcceptOwnership. Do not compare a caller against a constant: on mainnet a
 7	// compile-time authority is unrecoverable (immutable realm, no faucet).
 8	// PlatformFeePct is now only the FAIL-SAFE fallback bps source (see resolveFee) —
 9	// the live path reads cfg.GetFeeBPS(laneService). Kept as a 0-100 percent (not bps)
10	// for backward-compat readability; resolveFee converts it.
11	PlatformFeePct = 2 // 2% fallback only
12	CancelFeePct   = 5 // 5% cancellation fee — escrow-internal, NOT on the fee spine
13	// (paid to the freelancer as compensation, not a protocol fee)
14	AutoRefundBlks     = int64(864000) // ~30 days at 3s/block
15	AutoResolveBlks    = int64(806400) // ~28 days at 3s/block
16	MaxTitleLen        = 200
17	MaxDescLen         = 5000
18	MaxMilestones      = 20
19	MaxContracts       = 500
20	MinMilestoneAmount = int64(1000) // 0.001 GNOT — prevents fee evasion via truncation
21)
source

Functions 22

func AcceptOwnership

crossing Action
1func AcceptOwnership(cur realm)
source

AcceptOwnership completes the handoff. Only the staged pendingAdmin may call it — including against the outgoing admin, so the two steps cannot be collapsed into one by the party giving up the role.

func CancelContract

crossing Action
1func CancelContract(cur realm, contractId string)
source

CancelContract cancels an active contract. Client only. Funded milestones are refunded minus cancellation fee.

func CancelOwnershipTransfer

crossing Action
1func CancelOwnershipTransfer(cur realm)
source

CancelOwnershipTransfer clears a staged handoff. Admin only — the outgoing admin must be able to abort a proposal it no longer wants, without needing the proposed address to cooperate.

func ClaimDisputeTimeout

crossing Action
1func ClaimDisputeTimeout(cur realm, contractId string, milestoneIdx int)
source

ClaimDisputeTimeout auto-resolves a dispute that admin hasn't acted on after AutoResolveBlks (~28 days). Resolution follows the pre-dispute status:

  • If the milestone was MsCompleted (freelancer delivered work) before dispute, funds go to freelancer (minus platform fee). This prevents griefing where a client disputes after delivery and simply waits out the clock.
  • If the milestone was MsFunded (work not yet delivered) before dispute, funds are refunded to client.

Anyone can call (permissionless safety valve).

func ClaimRefund

crossing Action
1func ClaimRefund(cur realm, contractId string, milestoneIdx int)
source

ClaimRefund refunds a funded milestone that has timed out. Anyone can call — permissionless, prevents fund locking.

func CompleteMilestone

crossing Action
1func CompleteMilestone(cur realm, contractId string, milestoneIdx int)
source

CompleteMilestone marks a milestone as completed. Freelancer only.

func CreateContract

crossing Action
1func CreateContract(cur realm, freelancer address, title, description, milestones string) string
source

CreateContract creates a new escrow contract with milestones. Milestones format: "title1:amount1,title2:amount2"

func FundMilestone

crossing Action
1func FundMilestone(cur realm, contractId string, milestoneIdx int)
source

FundMilestone deposits funds for a specific milestone. Client only.

func GetAdmin

Action
1func GetAdmin() string
source

GetAdmin returns the address that currently holds admin.

func Pause

crossing Action
1func Pause(cur realm)
source

Pause halts all write operations. Admin only.

func RaiseDispute

crossing Action
1func RaiseDispute(cur realm, contractId string, milestoneIdx int)
source

RaiseDispute escalates a milestone to admin arbitration. Client or Freelancer.

func RealmAddress

Action
1func RealmAddress() string
source

RealmAddress is the NF-2 canonical name for the realm's own address (the solvency monitor pairs it with TotalLiabilities).

func ReleaseFunds

crossing Action
1func ReleaseFunds(cur realm, contractId string, milestoneIdx int)
source

ReleaseFunds releases funds to freelancer after client approves. Client or Admin.

func ResolveDispute

crossing Action
1func ResolveDispute(cur realm, contractId string, milestoneIdx int, refundClient bool)
source

ResolveDispute resolves a dispute. Admin only. refundClient=true refunds to client, false pays freelancer.

func TotalLiabilities

Action
1func TotalLiabilities() int64
source

TotalLiabilities returns the total ugnot the realm owes across all funded and disputed milestones (funds that have arrived but not yet left the realm).

func TransferOwnership

crossing Action
1func TransferOwnership(cur realm, newAdmin address)
source

TransferOwnership stages a handoff to newAdmin. Admin only. The transfer does not take effect until newAdmin calls AcceptOwnership, so admin is never moved to an address that has not demonstrated it can transact.

Calling it again before acceptance replaces the staged address, which is how a mistyped proposal is corrected.

func Unpause

crossing Action
1func Unpause(cur realm)
source

Unpause resumes normal operations. Admin only.

Types 7

type Contract

struct
 1type Contract struct {
 2	ID          string
 3	Client      address
 4	Freelancer  address
 5	Title       string
 6	Description string
 7	Status      ContractStatus
 8	CreatedAt   int64 // block height
 9	Milestones  []Milestone
10}
source

type GovernanceContract

struct
1type GovernanceContract struct {
2	Exists                  bool
3	ID, ContentHash, Status string
4	Client, Freelancer      address
5	Count                   int
6	Milestones              [20]GovernanceMilestone
7}
source

type GovernanceFeeTerms

struct
1type GovernanceFeeTerms struct {
2	RawBPS, EffectiveBPS                             int64
3	RawTreasury, FallbackTreasury, EffectiveTreasury address
4}
source

type GovernanceMilestone

struct
1type GovernanceMilestone struct {
2	ID                                int
3	Amount                            int64
4	Status                            string
5	FundedAt, CompletedAt, DisputedAt int64
6	PreDisputeStatus                  string
7}
source

Value-only copies: no Contract pointer or persistent milestone slice escapes.

type Milestone

struct
 1type Milestone struct {
 2	ID               int
 3	Title            string
 4	Amount           int64 // ugnot
 5	Status           MilestoneStatus
 6	FundedAt         int64           // block height (0 if not funded)
 7	CompletedAt      int64           // block height (0 if not completed)
 8	DisputedAt       int64           // block height (0 if not disputed)
 9	PreDisputeStatus MilestoneStatus // status before dispute (MsFunded or MsCompleted)
10}
source

Imports 11

Source Files 7