github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/token/keeper.md (about)

     1  ## StoreKey
     2  
     3  ### 1. accountStoreKey
     4  
     5  KVStoreKey的name是"acc"
     6  
     7  |         key          |     value      | number(key)  |     value details     |               Value size               | Clean up | 备注                    |
     8  | :------------------: | :------------: | :----------: | :-------------------: | :------------------------------------: | :------: | ----------------------- |
     9  | prefix(0x01)+address | struct Account | 账户数量 | Account具体结构体如下 | 可能会超过1K,取决于用户下面的币的数量 |    无    | 存用户账号下的token信息 |
    10  
    11  value经过Codec.MustMarshalBinaryBare序列化后的[]byte,Account的结构体如下:
    12  
    13  ```go
    14  type BaseAccount struct {
    15  	Address       sdk.AccAddress `json:"address"`
    16  	Coins         sdk.SysCoins      `json:"coins"`
    17  	PubKey        crypto.PubKey  `json:"public_key"`
    18  	AccountNumber uint64         `json:"account_number"`
    19  	Sequence      uint64         `json:"sequence"`
    20  }
    21  ```
    22  
    23  ### 2. tokenStoreKey 
    24  
    25  KVStoreKey的name是"token"
    26  
    27  |key                              | value                      | number(key)          | value details | Value size | Clean up |  备注   |
    28  |:-------------------------------:|:-------------------------:|:------:|:------:|:------:|:------:|:------:|
    29  | symbol | struct x/token.Token | 发行币的数量 | Token具体结构体如下 | <1k | 无 | 存的token的信息 |
    30  
    31  token的value是经过Codec.MustMarshalBinaryBare序列化后的[]byte,token的结构体如下:
    32  
    33  ```go
    34  type Token struct {
    35  	Name           string         `json:"name"`							// token的名字
    36  	Symbol         string         `json:"symbol"`						// token的唯一标识
    37  	OriginalSymbol string         `json:"original_symbol"`	// token的原始标识
    38  	TotalSupply    int64          `json:"total_supply"`			// token的总量
    39  	Owner          sdk.AccAddress `json:"owner"`						// token的所有者
    40  	Mintable       bool           `json:"mintable"`					// token是否可以增发
    41  }
    42  ```
    43  
    44  ### 3. freezeStoreKey 
    45  
    46  KVStoreKey的name是"freeze"
    47  
    48  |   key   |      value       |   number(key)    | value details |               Value size               | Clean up |      备注       |
    49  | :-----: | :--------------: | :--------------: | :-----------: | :------------------------------------: | :------: | :-------------: |
    50  | address | struct sdk.DecCoins | 有冻结币的用户数 |  Coins结构体  | 可能会超过1K,取决于用户冻结的币的数量 |    无    | 存的token的信息 |
    51  
    52  token的value是Coins经过Codec.MustMarshalBinaryBare序列化后的[]byte.
    53  
    54  ## 4. lockStoreKey
    55  
    56  KVStoreKey的name是"lock"
    57  
    58  |   key   |      value       |    number(key)     | value details |               Value size               | Clean up |      备注       |
    59  | :-----: | :--------------: | :----------------: | :-----------: | :------------------------------------: | :------: | :-------------: |
    60  | address | struct sdk.DecCoins | 有锁定的币的用户数 |  Coins结构体  | 可能会超过1K,取决于用户锁定的币的数量 |    无    | 存的token的信息 |
    61  
    62  token的value是Coins经过Codec.MustMarshalBinaryBare序列化后的[]byte.
    63  
    64  ## 5. tokenPairStoreKey
    65  
    66  KVStoreKey的name是"token_pair"
    67  
    68  |                 key                  |          value           |   number(key)    |    value details    | Value size |         Clean up         |      备注       |
    69  | :----------------------------------: | :----------------------: | :--------------: | :-----------------: | :--------: | :----------------------: | :-------------: |
    70  | BaseAssetSymbol+"_"+QuoteAssetSymbol | struct x/token.TokenPair | 上交易所的币对数 | TokenPair结构体如下 |    <1k     | 有接口删除上交易所的币对 | 存的token的信息 |
    71  
    72  tokenPair的value是经过Codec.MustMarshalBinaryBare序列化后的[]byte,tokenPair的结构体如下:
    73  
    74  ```go
    75  type TokenPair struct {
    76  	BaseAssetSymbol  string  `json:"base_asset_symbol"`		// 基础货币
    77  	QuoteAssetSymbol string  `json:"quote_asset_symbol"`	// 报价货币
    78  	InitPrice        sdk.Dec `json:"price"`							  // 价格
    79  	MaxPriceDigit    int64   `json:"max_price_digit"`	 	  // 最大交易价格的小数点位数
    80  	MaxQuantityDigit int64   `json:"max_size_digit"`		  // 最大交易数量的小数点位数
    81  	MinQuantity      sdk.Dec `json:"min_trade_size"`		  // 最小交易数量
    82  }
    83  ```
    84  
    85  ## Http api
    86  
    87  |       Url       | Method |      读key       |
    88  | :-------------: | :----: | :--------------: |
    89  |     /products     |  GET   | token_pair(遍历) |
    90  |     /tokens      |  GET   |   token(遍历)    |
    91  | /token/{symbol} |  GET   |  token: symbol   |
    92