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

Start abstracting dfi into it's own lib #2560

Merged
merged 11 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ fmt_cpp() {
exit 1
fi

find src/masternodes \( -iname "*.cpp" -o -iname "*.h" \) \
find src/dfi \( -iname "*.cpp" -o -iname "*.h" \) \
-exec "${clang_formatters[$index]}" -i -style=file {} +;
}

Expand Down
220 changes: 110 additions & 110 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -159,59 +159,59 @@ DEFI_CORE_H = \
logging.h \
ffi/ffiexports.h \
ffi/ffihelpers.h \
masternodes/accounts.h \
masternodes/accountshistory.h \
masternodes/anchors.h \
masternodes/auctionhistory.h \
masternodes/balances.h \
masternodes/coinselect.h \
masternodes/communityaccounttypes.h \
masternodes/consensus/accounts.h \
masternodes/consensus/governance.h \
masternodes/consensus/icxorders.h \
masternodes/consensus/loans.h \
masternodes/consensus/masternodes.h \
masternodes/consensus/oracles.h \
masternodes/consensus/poolpairs.h \
masternodes/consensus/proposals.h \
masternodes/consensus/smartcontracts.h \
masternodes/consensus/tokens.h \
masternodes/consensus/txvisitor.h \
masternodes/consensus/vaults.h \
masternodes/consensus/xvm.h \
masternodes/customtx.h \
masternodes/errors.h \
masternodes/evm.h \
masternodes/factory.h \
masternodes/govvariables/attributes.h \
masternodes/govvariables/icx_takerfee_per_btc.h \
masternodes/govvariables/loan_daily_reward.h \
masternodes/govvariables/loan_liquidation_penalty.h \
masternodes/govvariables/loan_splits.h \
masternodes/govvariables/lp_daily_dfi_reward.h \
masternodes/govvariables/lp_splits.h \
masternodes/govvariables/oracle_block_interval.h \
masternodes/govvariables/oracle_deviation.h \
masternodes/gv.h \
masternodes/historywriter.h \
masternodes/icxorder.h \
masternodes/incentivefunding.h \
masternodes/loan.h \
masternodes/masternodes.h \
masternodes/mn_checks.h \
masternodes/mn_rpc.h \
masternodes/res.h \
masternodes/oracles.h \
masternodes/poolpairs.h \
masternodes/proposals.h \
masternodes/tokens.h \
masternodes/threadpool.h \
masternodes/coinselect.h \
masternodes/undo.h \
masternodes/undos.h \
masternodes/validation.h \
masternodes/vault.h \
masternodes/vaulthistory.h \
dfi/accounts.h \
dfi/accountshistory.h \
dfi/anchors.h \
dfi/auctionhistory.h \
dfi/balances.h \
dfi/coinselect.h \
dfi/communityaccounttypes.h \
dfi/consensus/accounts.h \
dfi/consensus/governance.h \
dfi/consensus/icxorders.h \
dfi/consensus/loans.h \
dfi/consensus/masternodes.h \
dfi/consensus/oracles.h \
dfi/consensus/poolpairs.h \
dfi/consensus/proposals.h \
dfi/consensus/smartcontracts.h \
dfi/consensus/tokens.h \
dfi/consensus/txvisitor.h \
dfi/consensus/vaults.h \
dfi/consensus/xvm.h \
dfi/customtx.h \
dfi/errors.h \
dfi/evm.h \
dfi/factory.h \
dfi/govvariables/attributes.h \
dfi/govvariables/icx_takerfee_per_btc.h \
dfi/govvariables/loan_daily_reward.h \
dfi/govvariables/loan_liquidation_penalty.h \
dfi/govvariables/loan_splits.h \
dfi/govvariables/lp_daily_dfi_reward.h \
dfi/govvariables/lp_splits.h \
dfi/govvariables/oracle_block_interval.h \
dfi/govvariables/oracle_deviation.h \
dfi/gv.h \
dfi/historywriter.h \
dfi/icxorder.h \
dfi/incentivefunding.h \
dfi/loan.h \
dfi/masternodes.h \
dfi/mn_checks.h \
dfi/mn_rpc.h \
dfi/res.h \
dfi/oracles.h \
dfi/poolpairs.h \
dfi/proposals.h \
dfi/tokens.h \
dfi/threadpool.h \
dfi/coinselect.h \
dfi/undo.h \
dfi/undos.h \
dfi/validation.h \
dfi/vault.h \
dfi/vaulthistory.h \
memusage.h \
merkleblock.h \
miner.h \
Expand Down Expand Up @@ -410,62 +410,62 @@ libdefi_server_a_SOURCES = \
init.cpp \
dbwrapper.cpp \
ffi/ffiexports.cpp \
masternodes/accounts.cpp \
masternodes/accountshistory.cpp \
masternodes/anchors.cpp \
masternodes/auctionhistory.cpp \
masternodes/consensus/accounts.cpp \
masternodes/consensus/governance.cpp \
masternodes/consensus/icxorders.cpp \
masternodes/consensus/loans.cpp \
masternodes/consensus/masternodes.cpp \
masternodes/consensus/oracles.cpp \
masternodes/consensus/poolpairs.cpp \
masternodes/consensus/proposals.cpp \
masternodes/consensus/smartcontracts.cpp \
masternodes/consensus/tokens.cpp \
masternodes/consensus/txvisitor.cpp \
masternodes/consensus/vaults.cpp \
masternodes/consensus/xvm.cpp \
masternodes/evm.cpp \
masternodes/govvariables/attributes.cpp \
masternodes/govvariables/icx_takerfee_per_btc.cpp \
masternodes/govvariables/loan_daily_reward.cpp \
masternodes/govvariables/loan_liquidation_penalty.cpp \
masternodes/govvariables/loan_splits.cpp \
masternodes/govvariables/lp_daily_dfi_reward.cpp \
masternodes/govvariables/lp_splits.cpp \
masternodes/govvariables/oracle_block_interval.cpp \
masternodes/govvariables/oracle_deviation.cpp \
masternodes/gv.cpp \
masternodes/historywriter.cpp \
masternodes/icxorder.cpp \
masternodes/incentivefunding.cpp \
masternodes/loan.cpp \
masternodes/masternodes.cpp \
masternodes/mn_checks.cpp \
masternodes/mn_rpc.cpp \
masternodes/oracles.cpp \
masternodes/poolpairs.cpp \
masternodes/proposals.cpp \
masternodes/rpc_accounts.cpp \
masternodes/rpc_customtx.cpp \
masternodes/rpc_evm.cpp \
masternodes/rpc_masternodes.cpp \
masternodes/rpc_icxorderbook.cpp \
masternodes/rpc_loan.cpp \
masternodes/rpc_oracles.cpp \
masternodes/rpc_poolpair.cpp \
masternodes/rpc_proposals.cpp \
masternodes/rpc_tokens.cpp \
masternodes/rpc_vault.cpp \
masternodes/skipped_txs.cpp \
masternodes/tokens.cpp \
masternodes/threadpool.cpp \
masternodes/undos.cpp \
masternodes/validation.cpp \
masternodes/vault.cpp \
masternodes/vaulthistory.cpp \
dfi/accounts.cpp \
dfi/accountshistory.cpp \
dfi/anchors.cpp \
dfi/auctionhistory.cpp \
dfi/consensus/accounts.cpp \
dfi/consensus/governance.cpp \
dfi/consensus/icxorders.cpp \
dfi/consensus/loans.cpp \
dfi/consensus/masternodes.cpp \
dfi/consensus/oracles.cpp \
dfi/consensus/poolpairs.cpp \
dfi/consensus/proposals.cpp \
dfi/consensus/smartcontracts.cpp \
dfi/consensus/tokens.cpp \
dfi/consensus/txvisitor.cpp \
dfi/consensus/vaults.cpp \
dfi/consensus/xvm.cpp \
dfi/evm.cpp \
dfi/govvariables/attributes.cpp \
dfi/govvariables/icx_takerfee_per_btc.cpp \
dfi/govvariables/loan_daily_reward.cpp \
dfi/govvariables/loan_liquidation_penalty.cpp \
dfi/govvariables/loan_splits.cpp \
dfi/govvariables/lp_daily_dfi_reward.cpp \
dfi/govvariables/lp_splits.cpp \
dfi/govvariables/oracle_block_interval.cpp \
dfi/govvariables/oracle_deviation.cpp \
dfi/gv.cpp \
dfi/historywriter.cpp \
dfi/icxorder.cpp \
dfi/incentivefunding.cpp \
dfi/loan.cpp \
dfi/masternodes.cpp \
dfi/mn_checks.cpp \
dfi/mn_rpc.cpp \
dfi/oracles.cpp \
dfi/poolpairs.cpp \
dfi/proposals.cpp \
dfi/rpc_accounts.cpp \
dfi/rpc_customtx.cpp \
dfi/rpc_evm.cpp \
dfi/rpc_masternodes.cpp \
dfi/rpc_icxorderbook.cpp \
dfi/rpc_loan.cpp \
dfi/rpc_oracles.cpp \
dfi/rpc_poolpair.cpp \
dfi/rpc_proposals.cpp \
dfi/rpc_tokens.cpp \
dfi/rpc_vault.cpp \
dfi/skipped_txs.cpp \
dfi/tokens.cpp \
dfi/threadpool.cpp \
dfi/undos.cpp \
dfi/validation.cpp \
dfi/vault.cpp \
dfi/vaulthistory.cpp \
miner.cpp \
net.cpp \
net_processing.cpp \
Expand Down Expand Up @@ -653,7 +653,7 @@ libdefi_common_a_SOURCES = \
core_write.cpp \
key.cpp \
key_io.cpp \
masternodes/customtx.cpp \
dfi/customtx.cpp \
merkleblock.cpp \
netaddress.cpp \
netbase.cpp \
Expand Down
2 changes: 1 addition & 1 deletion src/amount.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define DEFI_AMOUNT_H

#include <arith_uint256.h>
#include <masternodes/res.h>
#include <dfi/res.h>
#include <serialize.h>
#include <stdint.h>
#include <util/strencodings.h>
Expand Down
2 changes: 1 addition & 1 deletion src/bench/duplicate_inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <consensus/merkle.h>
#include <consensus/validation.h>
#include <pos.h>
#include <masternodes/masternodes.h>
#include <dfi/masternodes.h>

#include <txmempool.h>
#include <validation.h>
Expand Down
2 changes: 1 addition & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <chainparams.h>
#include <chainparamsseeds.h>
#include <consensus/merkle.h>
#include <masternodes/mn_checks.h>
#include <dfi/mn_checks.h>
#include <streams.h>
#include <tinyformat.h>
#include <util/system.h>
Expand Down
2 changes: 1 addition & 1 deletion src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define DEFI_CONSENSUS_PARAMS_H

#include <amount.h>
#include <masternodes/communityaccounttypes.h>
#include <dfi/communityaccounttypes.h>
#include <script/standard.h>
#include <uint256.h>
#include <limits>
Expand Down
4 changes: 2 additions & 2 deletions src/consensus/tx_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <chainparams.h>
#include <masternodes/masternodes.h>
#include <masternodes/mn_checks.h>
#include <dfi/masternodes.h>
#include <dfi/mn_checks.h>
#include <primitives/transaction.h>
#include <script/interpreter.h>

Expand Down
2 changes: 1 addition & 1 deletion src/defi-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <support/events.h>

#include <univalue.h>
#include <masternodes/coinselect.h>
#include <dfi/coinselect.h>

const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/masternodes/accounts.cpp → src/dfi/accounts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Distributed under the MIT software license, see the accompanying
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.

#include <masternodes/accounts.h>
#include <masternodes/errors.h>
#include <dfi/accounts.h>
#include <dfi/errors.h>

void CAccountsView::ForEachBalance(std::function<bool(const CScript &, const CTokenAmount &)> callback,
const BalanceKey &start) {
Expand Down
10 changes: 5 additions & 5 deletions src/masternodes/accounts.h → src/dfi/accounts.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Distributed under the MIT software license, see the accompanying
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.

#ifndef DEFI_MASTERNODES_ACCOUNTS_H
#define DEFI_MASTERNODES_ACCOUNTS_H
#ifndef DEFI_DFI_ACCOUNTS_H
#define DEFI_DFI_ACCOUNTS_H

#include <amount.h>
#include <dfi/balances.h>
#include <dfi/res.h>
#include <flushablestorage.h>
#include <masternodes/balances.h>
#include <masternodes/res.h>
#include <script/script.h>

struct CAccountToUtxosMessage {
Expand Down Expand Up @@ -215,4 +215,4 @@ class CAccountsView : public virtual CStorageView {
Res SetBalance(const CScript &owner, CTokenAmount amount);
};

#endif // DEFI_MASTERNODES_ACCOUNTS_H
#endif // DEFI_DFI_ACCOUNTS_H
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Distributed under the MIT software license, see the accompanying
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.

#include <dfi/accounts.h>
#include <dfi/accountshistory.h>
#include <dfi/historywriter.h>
#include <dfi/vaulthistory.h>
#include <key_io.h>
#include <masternodes/accounts.h>
#include <masternodes/accountshistory.h>
#include <masternodes/historywriter.h>
#include <masternodes/vaulthistory.h>

static AccountHistoryKeyNew Convert(const AccountHistoryKey &key) {
return {key.blockHeight, key.owner, key.txn};
Expand Down
10 changes: 5 additions & 5 deletions src/masternodes/accountshistory.h → src/dfi/accountshistory.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Distributed under the MIT software license, see the accompanying
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.

#ifndef DEFI_MASTERNODES_ACCOUNTSHISTORY_H
#define DEFI_MASTERNODES_ACCOUNTSHISTORY_H
#ifndef DEFI_DFI_ACCOUNTSHISTORY_H
#define DEFI_DFI_ACCOUNTSHISTORY_H

#include <amount.h>
#include <dfi/auctionhistory.h>
#include <dfi/masternodes.h>
#include <flushablestorage.h>
#include <masternodes/auctionhistory.h>
#include <masternodes/masternodes.h>
#include <script/script.h>
#include <uint256.h>

Expand Down Expand Up @@ -76,4 +76,4 @@ extern std::unique_ptr<CBurnHistoryStorage> pburnHistoryDB;

static constexpr bool DEFAULT_ACINDEX = true;

#endif // DEFI_MASTERNODES_ACCOUNTSHISTORY_H
#endif // DEFI_DFI_ACCOUNTSHISTORY_H
4 changes: 2 additions & 2 deletions src/masternodes/anchors.cpp → src/dfi/anchors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Distributed under the MIT software license, see the accompanying
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.

#include <masternodes/anchors.h>
#include <dfi/anchors.h>

#include <chainparams.h>
#include <consensus/validation.h>
#include <dfi/masternodes.h>
#include <key.h>
#include <logging.h>
#include <masternodes/masternodes.h>
#include <script/standard.h>
#include <spv/spv_wrapper.h>
#include <streams.h>
Expand Down
Loading