BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
liquidity_pool.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Abit More, and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 #pragma once
27 
28 namespace graphene { namespace protocol {
29 
35  {
37 
39  account_id_type account;
40  asset_id_type asset_a;
41  asset_id_type asset_b;
42  asset_id_type share_asset;
43  uint16_t taker_fee_percent = 0;
44  uint16_t withdrawal_fee_percent = 0;
45 
47 
48  account_id_type fee_payer()const { return account; }
49  void validate()const;
50  };
51 
57  {
58  struct fee_parameters_type { uint64_t fee = 0; };
59 
61  account_id_type account;
62  liquidity_pool_id_type pool;
63 
65 
66  account_id_type fee_payer()const { return account; }
67  void validate()const;
68  };
69 
75  {
77 
79  account_id_type account;
80  liquidity_pool_id_type pool;
83 
85 
86  account_id_type fee_payer()const { return account; }
87  void validate()const;
88  };
89 
95  {
97 
99  account_id_type account;
100  liquidity_pool_id_type pool;
102 
104 
105  account_id_type fee_payer()const { return account; }
106  void validate()const;
107  };
108 
114  {
116 
118  account_id_type account;
119  liquidity_pool_id_type pool;
122 
124 
125  account_id_type fee_payer()const { return account; }
126  void validate()const;
127  };
128 
129 } } // graphene::protocol
130 
136 
141  (fee)(account)(pool)(extensions) )
143  (fee)(account)(pool)(amount_a)(amount_b)(extensions) )
145  (fee)(account)(pool)(share_amount)(extensions) )
147  (fee)(account)(pool)(amount_to_sell)(min_to_receive)(extensions) )
148 
154 
future_extensions::flat_set_type extensions_type
Definition: base.hpp:141
asset share_amount
The amount of the share asset to use.
liquidity_pool_id_type pool
ID of the liquidity pool.
liquidity_pool_id_type pool
ID of the liquidity pool.
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition: reflect.hpp:386
account_id_type account
The account who withdraws from the liquidity pool.
Definition: api.cpp:56
asset min_to_receive
The minimum amount of the other asset type to receive.
uint16_t withdrawal_fee_percent
Withdrawal fee percent.
extensions_type extensions
Unused. Reserved for future use.
liquidity_pool_id_type pool
ID of the liquidity pool.
extensions_type extensions
Unused. Reserved for future use.
extensions_type extensions
Unused. Reserved for future use.
asset_id_type asset_a
Type of the first asset in the pool.
account_id_type account
The account who exchanges with the liquidity pool.
#define GRAPHENE_DECLARE_EXTERNAL_SERIALIZATION(type)
Definition: types.hpp:73
liquidity_pool_id_type pool
ID of the liquidity pool.
extensions_type extensions
Unused. Reserved for future use.
#define GRAPHENE_BLOCKCHAIN_PRECISION
Definition: config.hpp:29
asset_id_type share_asset
Type of the share asset aka the LP token.
account_id_type account
The account who creates the liquidity pool.
asset amount_to_sell
The amount of one asset type to sell.
extensions_type extensions
Unused. Reserved for future use.
account_id_type account
The account who deposits to the liquidity pool.
asset amount_b
The amount of the second asset to deposit.
account_id_type account
The account who owns the liquidity pool.
asset amount_a
The amount of the first asset to deposit.
asset_id_type asset_b
Type of the second asset in the pool.