Quipuswap
  • introduction
    • What is QuipuSwap?
    • Participants
    • QuipuSwap subprojects
      • QuipuSwap Farms
      • Quipuswap Stable DEX
      • Token to Token Swaps
      • Governance (text-only)
  • Get Started
    • Install Wallet
    • How to get TEZ
    • How to find my tokens
    • Connect wallet
    • FAQ
  • Dex Guides
    • Overview
    • Types of the exchange (Token/TEZ, Token/Token)
    • How to use the DEX
      • Trade
      • How to add liquidity to an existing liquidity pool
      • How to create a new liquidity pool
      • How to remove liquidity
      • How to vote for a baker
      • How to ban/veto a baker
  • Tezos Tokens
    • What is a Token?
    • What is the difference between FA1.2 and FA2 standards?
    • QUIPU Tokenomics
  • Smart Contracts
    • Dex token edition
      • Overview
      • Dex
      • Exceptions
    • QuipuSwap stable swap DEX
      • ๐Ÿ› ๏ธDeveloper module
        • ๐Ÿ“„Storage & action types
        • ๐Ÿ”ตDeveloper setter entrypoints
          • set_dev_address
          • set_dev_fee
      • ๐Ÿ Standalone DEX
        • ๐Ÿ“„Storage and types overview
        • ๐ŸŸกInitialization
          • set_admin_function
          • set_dev_function
          • set_dex_function
          • set_token_function
        • ๐ŸŸ Add new dex
          • add_pool
        • ๐Ÿ”ตDEX methods
          • invest
          • swap
          • ๐Ÿ“คDivesting
            • divest
            • divest_imbalanced
            • divest_one_coin
          • ๐Ÿค‘DEX rewards
            • claim_referral
            • stake
        • ๐Ÿ› ๏ธDeveloper methods
          • claim_developer
          • Dev module entrypoints
        • ๐Ÿ›‘Admin methods
          • add_rem_managers
          • ramp_A
          • set_admin
          • set_fees
          • stop_ramp_A
      • ๐ŸญFactory
        • ๐Ÿ“„Storage and types overview
        • ๐ŸŸกInitial setup
          • set_init_function
          • set_dev_function
          • DEX compiled codebase setup
            • set_admin_function
            • set_dex_function
            • set_token_function
        • ๐ŸŸ Initialize new DEX flow
          • add_pool
          • start_dex
        • ๐Ÿ’ฑDeployed from factory DEX
          • ๐Ÿ“„Storage and types overview
          • ๐ŸŸกInitialization
            • copy_dex_function
            • freeze
          • ๐Ÿ”ตDEX methods
          • ๐Ÿ› ๏ธClaim developer rewards
          • ๐Ÿ›‘Admin methods
        • ๐Ÿ›‘Developer methods
          • claim_rewards
          • ๐Ÿง‘โ€๐Ÿ’ปFactory management
            • ๐ŸŸขFactory params
              • set_burn_rate
              • set_price
              • set_whitelist
            • ๐Ÿ”ตDev module entrypoints
    • Dex 2.0
      • โ‰๏ธErrors overview
      • ๐ŸฅBakerRegistry contract
        • Storage and types overview
        • Entrypoints overview
          • validate
          • register
      • โš™๏ธFlashSwapsProxy contract
        • Storage and types overview
        • Entrypoints overview
          • default
      • ๐ŸงบBucket contract
        • Storage and types overview
        • Entrypoints overview
          • fill
          • pour_out
          • pour_over
          • withdraw_rewards
          • ban_baker
          • vote
          • default
        • On-chain views overview
          • is_banned_baker
          • get_tez_balance
          • get_user_candidate
      • โš–๏ธAuction contract
        • Storage and types overview
        • Entrypoints overview
          • Auction entrypoints
            • receive_fee
            • launch_auction
            • place_bid
            • claim
          • Admin entrypoints
            • set_admin
            • confirm_admin
            • set_baker
            • set_fees
            • set_auction_duration
            • set_min_bid
            • update_whitelist
            • withdraw_dev_fee
            • withdraw_public_fee
            • burn_bid_fee
      • ๐ŸฆDexCore contract
        • Storage and types overview
        • Entrypoints overview
          • DEX entrypoints
            • launch_exchange
            • invest_liquidity
            • divest_liquidity
            • swap
            • withdraw_profit
            • claim_interface_fee
            • claim_interface_tez_fee
            • withdraw_auction_fee
            • vote
          • Admin entrypoints
            • set_admin
            • confirm_admin
            • set_flash_swaps_proxy
            • set_auction
            • add_managers
            • set_fees
            • set_collecting_period
            • update_token_metadata
            • ban
          • Permits' entrypoints
            • permit
            • set_expiry
          • FA2 entrypoints
            • transfer
            • update_operators
            • balance_of
          • Callbacks
            • launch_callback
            • flash_swap_callback
            • close
        • On-chain views overview
          • check_is_banned_baker
          • get_reserves
          • get_total_supply
          • get_swap_min_res
          • get_toks_per_share
          • get_cumulative_prices
          • get_collecting_period
    • Trusted contracts
    • Farming
      • Referral system overview
      • Fees overview
      • Rewards precision overview
      • BakerRegistry contract
        • Storage and types overview
        • Entrypoints overview
          • validate
          • register
      • Burner contract
        • Storage and types overview
        • Entrypoints overview
          • default
          • burn_callback
      • ProxyMinter contract
        • Storage and types overview
        • Entrypoints overview
          • Admin entrypoints
            • add_minter
            • withdraw_tokens
            • set_admin
            • confirm_admin
          • Minter entrypoint
            • mint_tokens
      • QFarm contract
        • Storage and types overview
        • Entrypoints overview
          • Farming entrypoints
            • deposit
            • withdraw
            • harvest
          • FA2 entrypoints
            • transfer
            • update_operators
            • balance_of
          • Admin entrypoints
            • set_admin
            • confirm_admin
            • set_fees
            • set_reward_per_second
            • set_burner
            • set_proxy_minter
            • set_baker_registry
            • set_is_v1_lp
            • ban_bakers
            • add_new_farm
            • pause_farms
            • burn_tez_rewards
            • withdraw_farm_depo
            • update_token_metadata
          • Other entrypoints
            • burn_farm_rewards
            • default
      • TFarm contract
        • Storage and types overview
        • Entrypoints overview
          • Farming entrypoints
            • deposit
            • withdraw
            • harvest
          • FA2 entrypoints
            • transfer
            • update_operators
            • balance_of
          • Admin entrypoints
            • set_admin
            • confirm_admin
            • set_fees
            • set_reward_per_second
            • set_burner
            • set_baker_registry
            • set_is_v1_lp
            • ban_bakers
            • add_new_farm
            • pause_farms
            • burn_tez_rewards
            • claim_farm_rewards
            • withdraw_farm_depo
            • update_token_metadata
          • Other entrypoints
            • default
  • Brand and Logos
Powered by GitBook
On this page
  • token_t
  • token_metadata_t
  • account_t
  • tokens_t
  • pair_t
  • permit_info_t
  • user_permit_t
  • fees_t
  • storage_t - main contract storage
  • full_storage_t - storage root
  1. Smart Contracts
  2. Dex 2.0
  3. DexCore contract

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

Field
Type
Description

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

Field
Type
Description

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

Field
Type
Description

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

Field
Type
Description

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)

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

Field
Type
Description

created_at

timestamp

Timestamp of permit creation

expiry

option(seconds_t)

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

user_permit_t

Field
Type
Description

permits

Mapping of permits' hashes (bytes) to their info

expiry

option(seconds_t)

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

fees_t

Field
Type
Hint
Description

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

withdraw_fee_reward

nat

Float value multiplied by 1e+18

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

Field
Type
Description

token_metadata

Mapping of pools' IDs to their metadata

ledger

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

accounts

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

tokens

Mapping of pools' IDs to their tokens

token_to_id

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

pairs

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

permits

interface_fee

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

interface_tez_fee

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

auction_fee

auction_tez_fee

managers

set(address)

fees

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

flash_swaps_proxy

address

auction

address

permits_counter

counter_t (nat)

Number of permits created in this contract

default_expiry

seconds_t (nat)

entered

bool

Indicator that helps to avoid reentrancy

tokens_count

nat

Number of exchanges (pairs) launched in this contract

collecting_period

nat

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

Field
Type
Description

storage

Actual storage of the contract

dex_core_lambdas

big_map(nat, bytes)

Contract's lambda-methods

metadata

big_map(string, bytes)

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

Last updated 3 years ago

contract address (only for TOK/TEZ pools)

Permit's default expiry (see for more details)

map(blake2b_hash_t, )

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

Fee charged from exchanged amount that goes to the contract

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

big_map(, )

big_map((address * ), nat)

big_map((address * ), )

big_map(, )

big_map(bytes, )

big_map(, )

big_map(address, )

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

big_map(( * address), nat)

big_map(( * address), nat)

big_map(, nat)

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

big_map(, nat)

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

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

Fees that applies during each or operation

contract address

contract address. Can be by an administrator

contract address. Can be by an administrator

Permits default expiry (see for more details)

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

Contract's metadata according to

๐Ÿฆ
Bucket
TZIP-017
TZIP-017
Auction
withdraw_auction_fee
TZIP-017
Auction
Auction
updated
swap
flash_swap
BakerRegistry
FlashSwapsProxy
changed
Auction
changed
TZIP-017
Bucket
changed
TZIP-016
token_id_t
token_t
token_t
permit_info_t
token_id_t
token_metadata_t
token_id_t
token_id_t
account_t
token_id_t
tokens_t
token_id_t
token_id_t
pair_t
user_permits_t
token_t
token_id_t
token_t
token_id_t
fees_t
storage_t