๐Ÿ“„Storage and types overview

Base types

type token_id_t        is nat

type pool_id_t         is nat

type token_pool_idx_t  is nat

type fa12_token_t      is address

type fa2_token_t       is [@layout:comb] record[ 
    token_address        : address; 
    token_id             : token_id_t; 
]

type token_t           is 
| Fa12                   of fa12_token_t 
| Fa2                    of fa2_token_t

type tokens_map_t      is map(nat, token_t);

Storage - main contract storage

FieldTypeHintDescription

dev_store

dev_storage_t

init_price

nat

Amount of QUIPU tokens to be charged when deploy of DEX called.

burn_rate

nat

Persent of QUIPU charges to be sent to zero address.

pools_count

nat

Counter

Amount of pools created by current contract.

pool_to_address

big_map(bytes, address)

Bytes - packed by Bytes.pack(key) where key is record[ tokens=tokens; deployer=deployer] where tokens is valid tokens_map_t (sorted tokens) and deployer is address of user that deployed DEX contract.

Mapping that allows finding pool address by packed bytes of record with fields tokens of tokens_map_t type and deployer of address.

quipu_token

fa2_token_t

QUIPU token address and token ID

quipu_rewards

nat

Collected QUIPU tokens from deploy (without sent to zero address).

whitelist

set(address)

set of addresses that allowed to deploy without QUIPU charges.

type inner_store_t      is [@layout:comb] record[
  dev_store               : dev_storage_t;
  init_price              : nat; (* Pool creation price in QUIPU token *)
  burn_rate               : nat; (* Percent of QUIPU tokens to be burned *)
  pools_count             : nat;
  pool_to_address         : big_map(bytes, address);
  quipu_token             : fa2_token_t;
  quipu_rewards           : nat;
  whitelist               : set(address);
]

Full storage type - storage root

FieldTypeHintDescription

storage

inner_store_t

Main configuration and contract values of factory

admin_lambdas

big_map(nat, bytes)

Administrative lambda-methods storage

dex_lambdas

big_map(nat, bytes)

DEX stable swap protocol lambda-methods storage

token_lambdas

big_map(nat, bytes)

FA2 lambda-methods storage

init_func

option(bytes)

lambda function for deploying new DEX

type full_storage_t     is [@layout:comb] record [
  storage                 : inner_store_t;
  admin_lambdas           : big_map(nat, bytes); (* map with admin-related functions code *)
  dex_lambdas             : big_map(nat, bytes); (* map with exchange-related functions code *)
  token_lambdas           : big_map(nat, bytes); (* map with token-related functions code *)
  init_func               : option(bytes); (* lambda function for deploying new DEX *)
]

Last updated