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 AdminAddress, FeeRecipient, PlatformFeePct, CancelFeePct, AutoRefundBlks, AutoResolveBlks, MaxTitleLen, MaxDescLen, MaxMilestones, MaxContracts, MinMilestoneAmount

 1const (
 2	AdminAddress = "g1x7k4628w93a7wzdhqc06atzx0v50rnshweuxu0" // samcrew-core-test1 multisig
 3	// FeeRecipient is now only the FAIL-SAFE fallback (see resolveFee below) for when
 4	// memba_market_config is unreachable — the live path reads cfg.GetTreasury().
 5	FeeRecipient = "g1x7k4628w93a7wzdhqc06atzx0v50rnshweuxu0" // Samourai Coop multisig
 6	// PlatformFeePct is now only the FAIL-SAFE fallback bps source (see resolveFee) —
 7	// the live path reads cfg.GetFeeBPS(laneService). Kept as a 0-100 percent (not bps)
 8	// for backward-compat readability; resolveFee converts it.
 9	PlatformFeePct = 2 // 2% fallback only
10	CancelFeePct   = 5 // 5% cancellation fee — escrow-internal, NOT on the fee spine
11	// (paid to the freelancer as compensation, not a protocol fee)
12	AutoRefundBlks     = int64(864000) // ~30 days at 3s/block
13	AutoResolveBlks    = int64(806400) // ~28 days at 3s/block
14	MaxTitleLen        = 200
15	MaxDescLen         = 5000
16	MaxMilestones      = 20
17	MaxContracts       = 500
18	MinMilestoneAmount = int64(1000) // 0.001 GNOT — prevents fee evasion via truncation
19)
source

Functions 15

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 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 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 Unpause

crossing Action
1func Unpause(cur realm)
source

Unpause resumes normal operations. Admin only.

Types 4

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 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 9

Source Files 3