Skip to main content

API Reference

Full public function reference for the core mercatr modules plus the production mercatr_market::market_v2 layer.


mercatr::signed

Signed integer arithmetic for SAT computation. Represents signed values as (magnitude: u128, negative: bool).

new

Construct a Signed value from magnitude and sign. public fun new(magnitude: u128, negative: bool): Signed

from_u64

Lift a u64 to a non-negative Signed value. public fun from_u64(value: u64): Signed

sub_u64

Compute a - b with signed result. public fun sub_u64(a: u64, b: u64): Signed

mul

Multiply two signed values. public fun mul(a: &Signed, b: &Signed): Signed

add

Add two signed values. public fun add(a: &Signed, b: &Signed): Signed

lt

True iff a < b. public fun lt(a: &Signed, b: &Signed): bool

le

True iff a <= b. public fun le(a: &Signed, b: &Signed): bool

gt

True iff a > b. public fun gt(a: &Signed, b: &Signed): bool

ge

True iff a >= b. public fun ge(a: &Signed, b: &Signed): bool

eq

True iff a == b. public fun eq(a: &Signed, b: &Signed): bool

magnitude

Return the magnitude component. public fun magnitude(s: &Signed): u128

is_negative

Return true if the value is negative. public fun is_negative(s: &Signed): bool

cross_sign

Cross product sign for three 2D points A, B, C. Returns (B-A) x (C-A). Used for convexity verification. public fun cross_sign(ax: u64, ay: u64, bx: u64, by: u64, cx: u64, cy: u64): Signed


mercatr::morton

Morton (Z-order) codes and quadtree key operations for spatial indexing.

interleave

Interleave two u32 values into a u64 Morton code. public fun interleave(x: u32, y: u32): u64

interleave_n

Interleave the bottom bits bits of x and y. Gas-efficient for shallow depths. public fun interleave_n(x: u32, y: u32, bits: u8): u64

depth_prefix

Prefix a Morton code with a depth sentinel bit, producing a unique quadtree cell key. public fun depth_prefix(morton_code: u64, depth: u8): u64

parent_key

Return the parent key (one level up). Aborts on root key (1). public fun parent_key(key: u64): u64

max_depth

Return the maximum supported quadtree depth (31). public fun max_depth(): u8


mercatr::aabb

Axis-Aligned Bounding Box. Used for midphase collision filtering.

new

Construct an AABB from explicit min/max coordinates. public fun new(min_x: u64, min_y: u64, max_x: u64, max_y: u64): AABB

from_vertices

Compute the bounding box of a polygon given its vertex arrays. public fun from_vertices(xs: &vector<u64>, ys: &vector<u64>): AABB

intersects

True iff two AABBs overlap. public fun intersects(a: &AABB, b: &AABB): bool

min_x

Return the minimum x coordinate. public fun min_x(aabb: &AABB): u64

min_y

Return the minimum y coordinate. public fun min_y(aabb: &AABB): u64

max_x

Return the maximum x coordinate. public fun max_x(aabb: &AABB): u64

max_y

Return the maximum y coordinate. public fun max_y(aabb: &AABB): u64


mercatr::sat

Separating Axis Theorem narrowphase for convex polygon overlap.

overlaps

True iff two convex polygons (given as vertex arrays) have positive-area overlap. Pure edge or corner touching returns false. public fun overlaps(xs_a: &vector<u64>, ys_a: &vector<u64>, xs_b: &vector<u64>, ys_b: &vector<u64>): bool

overlaps_with_aabb

SAT overlap check with AABB pre-filter. public fun overlaps_with_aabb(xs_a: &vector<u64>, ys_a: &vector<u64>, xs_b: &vector<u64>, ys_b: &vector<u64>): bool

sat_intersect_parts

SAT overlap check between two convex parts (vertex arrays). public fun sat_intersect_parts(xs_a: &vector<u64>, ys_a: &vector<u64>, xs_b: &vector<u64>, ys_b: &vector<u64>): bool


mercatr::polygon

Multi-part polygon representation for land parcels. A Polygon is a union of convex Parts.

part

Construct a convex Part from vertex arrays. Rejects mismatched arrays, fewer than 3 vertices, more than 64 vertices, non-convex input, and edges shorter than 1 meter. public fun part(xs: vector<u64>, ys: vector<u64>): Part

new

Construct a Polygon from its convex parts. Multipart input is order-independent but must satisfy strict topology rules: no pairwise part overlap, adjacency only through identical shared edges, connected union, valid single boundary cycle, and minimum compactness. cells() remains empty until the registration pipeline computes coverage. public fun new(parts: vector<Part>, ctx: &mut sui::tx_context::TxContext): Polygon

intersects

True iff two polygons have positive-area overlap (per-part AABB pre-filter + sat::overlaps). Pure touching returns false. public fun intersects(a: &Polygon, b: &Polygon): bool

bounds

Return the global AABB enclosing all parts. public fun bounds(polygon: &Polygon): AABB

area

Compute the area of this polygon in square meters using the Shoelace formula with u128 arithmetic. public fun area(polygon: &Polygon): u64

parts

Return the number of convex parts. public fun parts(polygon: &Polygon): u64

vertices

Return the total vertex count across all parts. public fun vertices(polygon: &Polygon): u64

owner

Return the owner address of this parcel. public fun owner(polygon: &Polygon): address

created_epoch

Return the epoch when this parcel was created. public fun created_epoch(polygon: &Polygon): u64

cells

Return the single quadtree cell key this polygon is stored at. public fun cells(polygon: &Polygon): &vector<u64>

area_fp2

Exact polygon twice-area in fixed-point squared units (u128). Used for area conservation checks. public fun area_fp2(polygon: &Polygon): u128

contains_polygon

True iff outer polygon fully contains inner polygon (AABB + vertex containment). public fun contains_polygon(outer: &Polygon, inner: &Polygon): bool

touches_by_edge

True iff two polygons share at least one edge (multipart adjacency check). public fun touches_by_edge(a: &Polygon, b: &Polygon): bool

prepare_geometry (package)

Prepare parts from vertex arrays without creating a Polygon object. Returns (parts, global_aabb, total_vertices, part_count). Used by mutations. public(package) fun prepare_geometry(...): (vector<Part>, AABB, u64, u64)

assert_area_conserved (package)

Assert that old area equals new area (exact fixed-point). Aborts with EAreaConservationViolation. public(package) fun assert_area_conserved(old_fp2: u128, new_fp2: u128)

set_owner (package)

Set the owner of this polygon. public(package) fun set_owner(polygon: &mut Polygon, new_owner: address)

set_cells (package)

Set the quadtree cell key on this polygon. Called by index::register(). public(package) fun set_cells(polygon: &mut Polygon, cells: vector<u64>)

destroy (package)

Destroy a polygon, freeing its UID. Called by index::remove_unchecked(). public(package) fun destroy(polygon: Polygon)


mercatr::index

The shared spatial index. One Index object exists per deployment.

Capability Structs

TransferCap — authorizes forced ownership transfers (no owner check). Held by the Market object.

public struct TransferCap has key, store { id: object::UID }

LifecycleCap — authorizes lifecycle operations: register, remove, and transfer_ownership. Held by the Market object. Minted by admin::mint_lifecycle_cap.

public struct LifecycleCap has key, store { id: object::UID }

Events

Registered — emitted when a land parcel is registered.

polygon_id: sui::object::ID
owner: address
part_count: u64
cell_count: u64
depth: u8

Removed — emitted when a land parcel is removed.

polygon_id: sui::object::ID
owner: address

Transferred — emitted when a land parcel ownership is transferred.

polygon_id: sui::object::ID
from: address
to: address

new

Create a new Index with default config. public fun new(ctx: &mut sui::tx_context::TxContext): Index

new_config

Construct a Config with explicit limits. public fun new_config(max_vertices: u64, max_parts_per_polygon: u64, max_depth: u8, scaling_factor: u64): Config

with_config

Create a new Index with explicit config values. public fun with_config(cell_size: u64, max_depth: u8, max_vertices: u64, max_parts: u64, ctx: &mut sui::tx_context::TxContext): Index

share

Create a default Index and immediately share it. public fun share(ctx: &mut sui::tx_context::TxContext)

share_existing

Share an already-created owned Index. Used by the market setup flow after registering the index inside market.levels. public fun share_existing(index: Index)

share_with_config

Create an Index with custom configuration and make it a shared object. public fun share_with_config(cell_size: u64, max_depth: u8, max_vertices: u64, max_parts: u64, ctx: &mut sui::tx_context::TxContext)

register

Register a new land parcel. Requires a LifecycleCap — use market::register (which holds the cap) or obtain one via admin::mint_lifecycle_cap. Aborts with EOverlap if it intersects an existing parcel. Returns the ID of the newly registered polygon. public fun register(_cap: &LifecycleCap, index: &mut Index, parts_xs: vector<vector<u64>>, parts_ys: vector<vector<u64>>, ctx: &mut sui::tx_context::TxContext): sui::object::ID

remove

Remove a parcel. Requires a LifecycleCap and the caller must be the parcel owner. Use market::remove (canonical path) or admin::force_remove to bypass the ownership check. public fun remove(_cap: &LifecycleCap, index: &mut Index, polygon_id: sui::object::ID, ctx: &mut sui::tx_context::TxContext)

transfer_ownership

Transfer polygon ownership. Requires a LifecycleCap and the caller must be the current owner. public fun transfer_ownership(_cap: &LifecycleCap, index: &mut Index, polygon_id: sui::object::ID, new_owner: address, ctx: &sui::tx_context::TxContext)

force_transfer

Force-transfer polygon ownership. Requires TransferCap — no owner check. public fun force_transfer(_cap: &TransferCap, index: &mut Index, polygon_id: sui::object::ID, new_owner: address)

remove_unchecked (package)

Remove a parcel without ownership check. Called by admin::force_remove. public(package) fun remove_unchecked(index: &mut Index, polygon_id: sui::object::ID)

set_config (package)

Replace the current config. Called by admin::update_config. public(package) fun set_config(index: &mut Index, config: Config)

destroy_empty (package)

Destroy an empty index, freeing its UID. Aborts with EIndexNotEmpty if any parcels remain. Called by admin::destroy_index. public(package) fun destroy_empty(index: Index)

candidates

Broadphase: return IDs of parcels in overlapping quadtree cells (all depths) with query_id. public fun candidates(index: &Index, query_id: sui::object::ID): vector<sui::object::ID>

overlaps

True iff two parcels geometrically overlap (full SAT check). public fun overlaps(index: &Index, id_a: sui::object::ID, id_b: sui::object::ID): bool

overlapping

Return IDs of all parcels that overlap with query_id. public fun overlapping(index: &Index, query_id: sui::object::ID): vector<sui::object::ID>

count

Total number of registered parcels. public fun count(index: &Index): u64

cell_size

Finest-level cell size in coordinate units. public fun cell_size(index: &Index): u64

max_depth

Maximum quadtree depth. public fun max_depth(index: &Index): u8

get

Look up a registered parcel by ID. public fun get(index: &Index, polygon_id: sui::object::ID): &Polygon

outer_contains_inner

Check if a polygon in one index fully contains a polygon in another index. Used by tax collection to verify parent-child geometric containment. public fun outer_contains_inner(outer_index: &Index, outer_id: ID, inner_index: &Index, inner_id: ID): bool


mercatr::mutations

Area-conserving geometry mutations. All require a &LifecycleCap.

Events

ParcelReshaped — emitted when a parcel is reshaped.

polygon_id: sui::object::ID
old_area: u64
new_area: u64

ParcelsRepartitioned — emitted when two adjacent parcels are repartitioned.

a_id: sui::object::ID
b_id: sui::object::ID

ParcelRetired — emitted when a parcel is destroyed (split parent or merge absorb).

polygon_id: sui::object::ID

ParcelSplit — emitted when a parent is split into children.

parent_id: sui::object::ID
child_ids: vector<sui::object::ID>

ParcelsMerged — emitted when two parcels merge.

keep_id: sui::object::ID
absorb_id: sui::object::ID

reshape_unclaimed

Reshape a single parcel. New geometry must contain old geometry. Area preserved. No overlaps with other parcels. public fun reshape_unclaimed(cap: &LifecycleCap, index: &mut Index, polygon_id: sui::object::ID, new_parts_xs: vector<vector<u64>>, new_parts_ys: vector<vector<u64>>)

repartition_adjacent

Repartition two adjacent parcels. Total area conserved. Both receive new geometry. public fun repartition_adjacent(cap: &LifecycleCap, index: &mut Index, a_id: sui::object::ID, b_id: sui::object::ID, new_a_xs: vector<vector<u64>>, new_a_ys: vector<vector<u64>>, new_b_xs: vector<vector<u64>>, new_b_ys: vector<vector<u64>>)

split_replace

Split a parent into N children. Parent area equals sum of children. Children inherit parent's owner. public fun split_replace(cap: &LifecycleCap, index: &mut Index, parent_id: sui::object::ID, children_xs: vector<vector<vector<u64>>>, children_ys: vector<vector<vector<u64>>>, ctx: &mut sui::tx_context::TxContext)

merge_keep

Merge two adjacent same-owner parcels. Area conserved. Absorb is retired, keep receives merged geometry. public fun merge_keep(cap: &LifecycleCap, index: &mut Index, keep_id: sui::object::ID, absorb_id: sui::object::ID, merged_xs: vector<vector<u64>>, merged_ys: vector<vector<u64>>)


mercatr::admin

Administrative capability and package initializer.

update_config

Update the protocol config. Requires AdminCap. public fun update_config(_: &AdminCap, index: &mut Index, new_config: Config)

create_index

Create a new owned Index with the standard protocol safety limits (max_vertices = 64, max_parts = 10). Requires AdminCap. public fun create_index(_: &AdminCap, cell_size: u64, max_depth: u8, ctx: &mut sui::tx_context::TxContext): Index

force_remove

Remove a parcel regardless of owner. Requires AdminCap. public fun force_remove(_: &AdminCap, index: &mut Index, polygon_id: sui::object::ID, ctx: &sui::tx_context::TxContext)

destroy_index

Destroy an empty index. Aborts if any parcels remain. Requires AdminCap. public fun destroy_index(_: &AdminCap, index: Index)

mint_transfer_cap

Mint a TransferCap for market contracts (admin only). public fun mint_transfer_cap(_: &AdminCap, ctx: &mut sui::tx_context::TxContext): TransferCap

mint_lifecycle_cap

Mint a LifecycleCap that gates register, remove, and transfer_ownership. Admin only — the production path for issuing lifecycle authority to the market contract. public fun mint_lifecycle_cap(_: &AdminCap, ctx: &mut sui::tx_context::TxContext): LifecycleCap

mint_lifecycle_cap_with_id

Mint a LifecycleCap and return both the capability and its object ID. Requires AdminCap. public fun mint_lifecycle_cap_with_id(_: &AdminCap, ctx: &mut sui::tx_context::TxContext): (LifecycleCap, sui::object::ID)

mint_caps_with_ids

Mint both TransferCap and LifecycleCap, returning the capabilities and their object IDs. Requires AdminCap. public fun mint_caps_with_ids(_: &AdminCap, ctx: &mut sui::tx_context::TxContext): (TransferCap, LifecycleCap, sui::object::ID, sui::object::ID)

mint_lifecycle_cap_for_testing (test_only)

Test-only helper that mints a LifecycleCap without AdminCap. Not available in production. public fun mint_lifecycle_cap_for_testing(ctx: &mut sui::tx_context::TxContext): LifecycleCap

init_for_testing

Test-only initializer that calls init. Not available in production. public fun init_for_testing(ctx: &mut sui::tx_context::TxContext) (test_only)


mercatr_market::price

Price calculation logic. Used by the legacy v1 market (sale_count-based). Market V2 computes prices inline using the premium_ppm model.

calculate_price

Calculate the buyout price using the v1 sale-count formula. Uses u128 iterative escalation math and aborts with EPriceOverflow if the result exceeds u64. Formula: area_m2 × base_price_per_m2 × ((10000 + escalation_bps) / 10000)^sale_count. public fun calculate_price(area_m2: u64, base_price_per_m2: u64, escalation_bps: u64, sale_count: u64): u64


mercatr_market::market_v2

The shared object representing the production forced-sale land market. It maintains treasury state, tracks per-polygon v2 price state, hosts ordered market levels, and implements the cascading upstream tax system.

Structs

Level — one registry entry in market.levels.

index_id: sui::object::ID
base_price_per_m2: u64
min_area_m2: u64
max_area_m2: u64

PriceState — per-polygon v2 pricing state.

premium_ppm: u64

MarketV2 — the shared market object.

id: sui::object::UID
transfer_cap: TransferCap
lifecycle_cap: LifecycleCap
treasury: Balance<SUI>
price_states: Table<ID, PriceState>
levels: vector<Level>
paused: bool

MarketV2AdminCap — governance capability for market-level admin operations.

id: sui::object::UID

Events

MarketV2Registered — emitted when a polygon is registered through the market.

polygon_id: sui::object::ID
owner: address
area_m2: u64
price_paid: u64
immediate_treasury: u64
hierarchy_pool: u64

MarketV2PurchasedFull — emitted when a forced buyout occurs.

polygon_id: sui::object::ID
buyer: address
seller: address
price: u64
new_premium_ppm: u64
seller_proceeds: u64
immediate_treasury_fee: u64
hierarchy_pool: u64
sale_count: u64

ParcelExpandedUnclaimed — emitted when a polygon expands into unclaimed space.

polygon_id: sui::object::ID
old_area: u64
new_area: u64
price_paid: u64
immediate_treasury: u64
hierarchy_pool: u64

ParcelSliceAcquired — emitted when one owner acquires a slice from another polygon.

ParcelSliceRebalanced — emitted when adjacent polygons of the same owner are repartitioned.

ParcelOwnedMerged — emitted when two owned polygons merge.

keep_id: sui::object::ID
absorbed_id: sui::object::ID
premium_ppm: u64

PriceStateUpdated — emitted when per-polygon price state changes.

Tax events

  • TaxBucketOpened { polygon_id, version, bucket_id, origin_level_rank, ancestor_distance, accrual_epoch, amount }
  • TaxCollected { parent_id, child_id, child_version, bucket_id, origin_level_rank, ancestor_distance, accrual_epoch, amount, collector_fee, self_keep, forward_upstream }
  • TaxWithdrawn { polygon_id, owner, amount }
  • TaxSwept { polygon_id, version, bucket_id, origin_level_rank, ancestor_distance, accrual_epoch, remainder }
  • TaxVersionClosed { polygon_id, old_version, new_version }

new

Create a new owned MarketV2 with default global terms and an empty levels vector. public fun new(transfer_cap: TransferCap, lifecycle_cap: LifecycleCap, ctx: &mut sui::tx_context::TxContext): MarketV2

share

Share an already-created MarketV2. public fun share(market: MarketV2)

register

Register a new land parcel through the market. The passed Index must already appear in market.levels, and the parcel area must fall within that level's configured range. Price is area_m2 × price_per_km2_mist / 1_000_000 at the initial premium_ppm = 1_000_000. Payment splits into 92% immediate treasury and 8% hierarchy pool. Returns the new polygon_id. public fun register(market: &mut MarketV2, index: &mut Index, parts_xs: vector<vector<u64>>, parts_ys: vector<vector<u64>>, payment: Coin<SUI>, ctx: &mut sui::tx_context::TxContext): sui::object::ID

buy_full

Forced buyout of any polygon. Price uses the matching level's price_per_km2_mist and current polygon premium_ppm. Payment splits into 85% seller proceeds, 7% immediate treasury, and 8% hierarchy pool. If tax is initialized and the sold level has a parent, the hierarchy pool accrues into the deferred tax fund; otherwise it goes directly to treasury. The seller's accumulated self_claimable tax is auto-withdrawn before ownership transfer. Excess payment is refunded to the buyer. public fun buy_full(market: &mut MarketV2, index: &mut Index, polygon_id: sui::object::ID, payment: Coin<SUI>, ctx: &mut sui::tx_context::TxContext)

expand_unclaimed

Expand a polygon into adjacent unclaimed space. Charges only for the added area at the current premium_ppm, splits payment into 92% immediate treasury and 8% hierarchy pool, and closes the polygon's tax version if deferred tax is initialized. public fun expand_unclaimed(market: &mut MarketV2, index: &mut Index, polygon_id: sui::object::ID, new_parts_xs: vector<vector<u64>>, new_parts_ys: vector<vector<u64>>, payment: Coin<SUI>, ctx: &mut sui::tx_context::TxContext)

acquire_slice

Acquire a slice from a different owner's polygon. Both polygons must be in the same index. Prices the captured donor area at the donor's current premium_ppm, pays 85% to the donor, 7% to treasury, and 8% to the hierarchy pool. Both polygons preserve their existing premiums. Closes tax versions for both polygons because both geometries change. public fun acquire_slice(market: &mut MarketV2, index: &mut Index, receiver_id: sui::object::ID, donor_id: sui::object::ID, receiver_new_xs: vector<vector<u64>>, receiver_new_ys: vector<vector<u64>>, donor_new_xs: vector<vector<u64>>, donor_new_ys: vector<vector<u64>>, payment: Coin<SUI>, ctx: &mut sui::tx_context::TxContext)

rebalance_slice

Repartition two same-owner adjacent polygons without payment. Sets both polygons' premium_ppm and sale_count to the max of the pair and closes both tax versions when tax is initialized. public fun rebalance_slice(market: &mut MarketV2, index: &mut Index, a_id: sui::object::ID, b_id: sui::object::ID, new_a_parts_xs: vector<vector<u64>>, new_a_parts_ys: vector<vector<u64>>, new_b_parts_xs: vector<vector<u64>>, new_b_parts_ys: vector<vector<u64>>, ctx: &mut sui::tx_context::TxContext)

merge_owned

Merge two same-owner polygons. Provides the merged geometry for the survivor. Sweeps child-side tax state from the absorbed polygon, assigns the survivor the area-weighted average premium_ppm and max sale_count, and closes the survivor's tax version when tax is initialized. public fun merge_owned(market: &mut MarketV2, index: &mut Index, keep_id: sui::object::ID, absorb_id: sui::object::ID, merged_parts_xs: vector<vector<u64>>, merged_parts_ys: vector<vector<u64>>, ctx: &mut sui::tx_context::TxContext)

remove

Governance/emergency-only removal path. The market supplies its internal LifecycleCap, removes any tracked PriceState entry and, if tax is initialized, sweeps child-side tax state for that polygon. public fun remove(_admin: &MarketV2AdminCap, market: &mut MarketV2, index: &mut Index, polygon_id: sui::object::ID, ctx: &mut sui::tx_context::TxContext)

current_price

Query the current buyout price for a polygon. public fun current_price(market: &MarketV2, index: &Index, polygon_id: sui::object::ID): u64

add_level

Append one level to the on-chain registry with price_per_km2_mist and area bounds. Rejects duplicate Index IDs and invalid area ranges. public fun add_level(_admin: &MarketV2AdminCap, market: &mut MarketV2, index: &Index, price_per_km2_mist: u64, min_area_m2: u64, max_area_m2: u64)

update_level

Update an existing level's price_per_km2_mist and area bounds. public entry fun update_level(_admin: &MarketV2AdminCap, market: &mut MarketV2, level_index: u64, price_per_km2_mist: u64, min_area_m2: u64, max_area_m2: u64)

withdraw

Withdraw from treasury (admin only). public fun withdraw(_admin: &MarketV2AdminCap, market: &mut MarketV2, amount: u64, ctx: &mut sui::tx_context::TxContext): Coin<SUI>

Deferred tax public entrypoints

init_tax

Initialize deferred tax state on an existing MarketV2. The _upstream_tax_bps argument is retained only for call-shape compatibility and is ignored by the current implementation. public fun init_tax(_admin: &MarketV2AdminCap, market: &mut MarketV2, _upstream_tax_bps: u64, ctx: &mut sui::tx_context::TxContext)

set_tax_level_cfg

Configure per-level bucket cadence and expiry. The current setter zeroes retain_upstream_ppm and collector_fee_bps, keeping them only for layout compatibility. public fun set_tax_level_cfg(_admin: &MarketV2AdminCap, market: &mut MarketV2, level_index: u64, cfg: TaxLevelCfg)

collect_batch

Collect deferred tax from direct child buckets into a parent polygon using the cascading model. Processes all matching buckets per (child_id, version, bucket_id) tuple (multi-match). Each bucket must pass the anti-retro guard (parent.created_epoch <= bucket.accrual_epoch), so same-epoch parents are eligible but later-created parents are not. Collected buckets are deleted (delete-after-collect). The parent keeps a weighted share and forwards the remainder as a cascade bucket on itself for the next ancestor. public fun collect_batch(market: &mut MarketV2, parent_index: &Index, parent_id: sui::object::ID, child_index: &Index, child_refs: vector<ChildRef>, ctx: &mut sui::tx_context::TxContext)

collect_batch_flat

SDK-friendly wrapper accepting 3 flat vectors instead of ChildRef structs. public fun collect_batch_flat(market: &mut MarketV2, parent_index: &Index, parent_id: sui::object::ID, child_index: &Index, child_ids: vector<sui::object::ID>, child_versions: vector<u64>, child_bucket_ids: vector<u64>, ctx: &mut sui::tx_context::TxContext)

withdraw_tax

Withdraw a polygon owner's accumulated self_claimable tax. public fun withdraw_tax(market: &mut MarketV2, index: &Index, polygon_id: sui::object::ID, ctx: &mut sui::tx_context::TxContext): Coin<SUI>

sweep_expired

Permissionlessly sweep an expired tax bucket remainder into treasury. public fun sweep_expired(market: &mut MarketV2, polygon_id: sui::object::ID, version: u64, bucket_id: u64, ctx: &mut sui::tx_context::TxContext)

Getters

  • public fun is_paused(market: &MarketV2): bool
  • public fun treasury_balance(market: &MarketV2): u64
  • public fun premium_ppm(market: &MarketV2, polygon_id: sui::object::ID): u64
  • public fun sale_count(market: &MarketV2, polygon_id: sui::object::ID): u64
  • public fun tax_is_initialized(market: &MarketV2): bool
  • public fun tax_fund_balance(market: &MarketV2): u64
  • public fun tax_version_counter(market: &MarketV2, polygon_id: sui::object::ID): u64
  • public fun tax_self_claimable(market: &MarketV2, polygon_id: sui::object::ID): u64