Storage and types overview

token_t

type token_id_t         is nat

type tez_t              is unit

type fa12_token_t       is address

type fa2_token_t        is [@layout:comb] record [
  token                   : address;
  id                      : nat;
]

type token_t            is
| Tez                     of tez_t
| Fa12                    of fa12_token_t
| Fa2                     of fa2_token_t

token_metadata_t

FieldTypeDescription

token_id

Token's ID

token_info

map(string, bytes)

Mapping of token's keys to token's info

type token_metadata_t   is [@layout:comb] record [
  token_id                : token_id_t;
  token_info              : map(string, bytes);
]

account_t

FieldTypeDescription

allowances

set(address)

Set of accounts who can transfer user's LP tokens

type account_t          is [@layout:comb] record [
  allowances              : set(address);
]

tokens_t

FieldTypeDescription

token_a

Token A

token_b

Token B

type tokens_t           is [@layout:comb] record [
  token_a                 : token_t;
  token_b                 : token_t;
]

pair_t

FieldTypeDescription

token_a_pool

nat

Supply of token A in the pool

token_b_pool

nat

Supply of token B in the pool

token_a_price_cml

nat

Cumulative price of token A

token_b_price_cml

nat

Cumulative price of token B

total_supply

nat

Total supply of LP token

last_block_timestamp

timestamp

Timestamp of the last block that is used for cumulative prices calculation

bucket

option(address)

Bucket contract address (only for TOK/TEZ pools)

type pair_t             is [@layout:comb] record [
  token_a_pool            : nat;
  token_b_pool            : nat;
  token_a_price_cml       : nat;
  token_b_price_cml       : nat;
  total_supply            : nat;
  last_block_timestamp    : timestamp;
  bucket                  : option(address);
]

permit_info_t

FieldTypeDescription

created_at

timestamp

Timestamp of permit creation

expiry

option(seconds_t)

Permit's default expiry (see TZIP-017 for more details)

type permit_info_t      is [@layout:comb] record [
  created_at              : timestamp;
  expiry                  : option(seconds_t);
]

user_permit_t

FieldTypeDescription

permits

map(blake2b_hash_t, permit_info_t)

Mapping of permits' hashes (bytes) to their info

expiry

option(seconds_t)

User's permits default expiry (see TZIP-017 for more details)

type user_permits_t     is [@layout:comb] record [
  permits                 : map(blake2b_hash_t, permit_info_t);
  expiry                  : option(seconds_t);
]

fees_t

FieldTypeHintDescription

interface_fee

nat

Float value multiplied by 1e+18

Fee that goes to referrers or UI/UX providers charged from exchanged amount

swap_fee

nat

Float value multiplied by 1e+18

Fee charged from exchanged amount that goes to the liquidity pool (for liquidity providers)

auction_fee

nat

Float value multiplied by 1e+18

Fee charged from exchanged amount that goes to the Auction contract

withdraw_fee_reward

nat

Float value multiplied by 1e+18

The % of the rewards that will be transferred to the transaction sender when he calls withdraw_auction_fee entrypoint

type fees_t             is [@layout:comb] record [
  interface_fee           : nat;
  swap_fee                : nat;
  auction_fee             : nat;
  withdraw_fee_reward     : nat;
]

storage_t - main contract storage

FieldTypeDescription

token_metadata

Mapping of pools' IDs to their metadata

ledger

big_map((address * token_id_t), nat)

Mapping of accounts' addresses and pools' IDs to their LP tokens' balances

accounts

big_map((address * token_id_t), account_t)

Mapping of accounts' addresses and pools' IDs to their accounts

tokens

Mapping of pools' IDs to their tokens

token_to_id

big_map(bytes, token_id_t)

Mapping of tokens (packed to bytes) to their pool IDs

pairs

big_map(token_id_t, pair_t)

Mapping of tokens' IDs to information about the pools of these tokens

permits

big_map(address, user_permits_t)

Mapping of accounts to created by them permits (see TZIP-017 for more details)

interface_fee

big_map((token_t * address), nat)

Mapping of FA1.2/FA2 tokens and referrers or UI/UX providers to their fees balances in these tokens

interface_tez_fee

big_map((token_id_t * address), nat)

Mapping of pair IDs and referrers or UI/UX providers to their fees balances in TEZ tokens

auction_fee

big_map(token_t, nat)

Mapping of FA1.2/FA2 tokens to their fees balances in these tokens that will go to the Auction contract

auction_tez_fee

big_map(token_id_t, nat)

Mapping of pair IDs to their fees balances in TEZ tokens that will go to the Auction contract

managers

set(address)

A set of addresses who can update tokens metadata. Can be updated by an administrator

fees

Fees that applies during each swap or flash_swap operation

admin

address

Administrator of the contract

pending_admin

option(address)

Pending administrator that should accept his new administrator role (if he is not None)

baker_registry

address

BakerRegistry contract address

flash_swaps_proxy

address

FlashSwapsProxy contract address. Can be changed by an administrator

auction

address

Auction contract address. Can be changed by an administrator

permits_counter

counter_t (nat)

Number of permits created in this contract

default_expiry

seconds_t (nat)

Permits default expiry (see TZIP-017 for more details)

entered

bool

Indicator that helps to avoid reentrancy

tokens_count

nat

Number of exchanges (pairs) launched in this contract

collecting_period

nat

Period in blocks during which bakers' rewards are collected and not distributed between voters in Bucket contracts. Can be changed by an administrator

type storage_t          is [@layout:comb] record [
  token_metadata          : big_map(token_id_t, token_metadata_t);
  ledger                  : big_map((address * token_id_t), nat);
  accounts                : big_map((address * token_id_t), account_t);
  tokens                  : big_map(token_id_t, tokens_t);
  token_to_id             : big_map(bytes, token_id_t);
  pairs                   : big_map(token_id_t, pair_t);
  permits                 : big_map(address, user_permits_t);
  interface_fee           : big_map((token_t * address), nat);
  interface_tez_fee       : big_map((token_id_t * address), nat);
  auction_fee             : big_map(token_t, nat);
  auction_tez_fee         : big_map(token_id_t, nat);
  managers                : set(address);
  fees                    : fees_t;
  admin                   : address;
  pending_admin           : option(address);
  baker_registry          : address;
  flash_swaps_proxy       : address;
  auction                 : address;
  permits_counter         : counter_t;
  default_expiry          : seconds_t;
  entered                 : bool;
  tokens_count            : nat;
  collecting_period       : nat;
]

full_storage_t - storage root

FieldTypeDescription

storage

Actual storage of the contract

dex_core_lambdas

big_map(nat, bytes)

Contract's lambda-methods

metadata

big_map(string, bytes)

Contract's metadata according to TZIP-016

type full_storage_t     is [@layout:comb] record [
  storage                 : storage_t;
  dex_core_lambdas        : big_map(nat, bytes);
  metadata                : big_map(string, bytes);
]

Last updated