Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement no-collateral funding #2469

Merged
merged 25 commits into from Jun 14, 2021
Merged

Implement no-collateral funding #2469

merged 25 commits into from Jun 14, 2021

Conversation

abitmore
Copy link
Member

@abitmore abitmore commented Jun 5, 2021

Resolves #2351.

Contents

1 new object type

  • samet_fund_object

5 new operations

  • samet_fund_create_operation
  • samet_fund_delete_operation
  • samet_fund_update_operation
  • samet_fund_borrow_operation
  • samet_fund_repay_operation

1 new program startup option

  • api-limit-get-samet-funds

3 new database APIs

  • list_samet_funds( limit, start_id )
  • get_samet_funds_by_owner( account_name_or_id, limit, start_id )
  • get_samet_funds_by_asset( asset_symbol_or_id, limit, start_id )

P.S. Refactored some code to fix build issues and code smells.

Code:

/////////////////////
/// SameT Funds
/// @{
/**
* @brief Get a list of SameT Funds
* @param limit The limitation of items each query can fetch, not greater than a configured value
* @param start_id Start SameT Fund id, fetch items whose IDs are greater than or equal to this ID
* @return The SameT Funds
*
* @note
* 1. @p limit can be omitted or be null, if so the default value 101 will be used
* 2. @p start_id can be omitted or be null, if so the api will return the "first page" of data
* 3. can only omit one or more arguments in the end of the list, but not one or more in the middle
*/
vector<samet_fund_object> list_samet_funds(
const optional<uint32_t>& limit = 101,
const optional<samet_fund_id_type>& start_id = optional<samet_fund_id_type>() )const;
/**
* @brief Get a list of SameT Funds by the name or ID of the owner account
* @param account_name_or_id name or ID of the owner account
* @param limit The limitation of items each query can fetch, not greater than a configured value
* @param start_id Start SameT Fund id, fetch items whose IDs are greater than or equal to this ID
* @return The SameT Funds
*
* @note
* 1. if @p account_name_or_id cannot be tied to an account, an error will be returned
* 2. @p limit can be omitted or be null, if so the default value 101 will be used
* 3. @p start_id can be omitted or be null, if so the api will return the "first page" of data
* 4. can only omit one or more arguments in the end of the list, but not one or more in the middle
*/
vector<samet_fund_object> get_samet_funds_by_owner(
const std::string& account_name_or_id,
const optional<uint32_t>& limit = 101,
const optional<samet_fund_id_type>& start_id = optional<samet_fund_id_type>() )const;
/**
* @brief Get a list of SameT Funds by the symbol or ID of the asset type
* @param asset_symbol_or_id symbol or ID of the asset type
* @param limit The limitation of items each query can fetch, not greater than a configured value
* @param start_id Start SameT Fund id, fetch items whose IDs are greater than or equal to this ID
* @return The SameT Funds
*
* @note
* 1. if @p asset_symbol_or_id cannot be tied to an asset, an error will be returned
* 2. @p limit can be omitted or be null, if so the default value 101 will be used
* 3. @p start_id can be omitted or be null, if so the api will return the "first page" of data
* 4. can only omit one or more arguments in the end of the list, but not one or more in the middle
*/
vector<samet_fund_object> get_samet_funds_by_asset(
const std::string& asset_symbol_or_id,
const optional<uint32_t>& limit = 101,
const optional<samet_fund_id_type>& start_id = optional<samet_fund_id_type>() )const;
/// @}

@abitmore abitmore added this to In Development in Protocol Upgrade Release (6.0.0) via automation Jun 5, 2021
@abitmore abitmore linked an issue Jun 5, 2021 that may be closed by this pull request
17 tasks
@abitmore abitmore marked this pull request as ready for review June 12, 2021 16:33
@sonarcloud
Copy link

sonarcloud bot commented Jun 12, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 27 Code Smells

77.1% 77.1% Coverage
2.2% 2.2% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

No-collateral Funding
1 participant