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

ICX Orderbook #335

Merged
merged 32 commits into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
476c878
Initial ICX orderbook development
Mixa84 Apr 21, 2021
0533cd0
Fix searching HTLCs.
Mixa84 Apr 21, 2021
387645a
Refactor data structures and flow, fixed PR issues
Mixa84 Apr 26, 2021
19b622b
Refactor data structures and flow, fixed PR issues
Mixa84 Apr 28, 2021
1b9563d
Fix issues.
Mixa84 Apr 28, 2021
88f0e52
Added incentives and fees. Fixed issue with CAmount multiply overflow…
Mixa84 Apr 29, 2021
5c3b860
Add poolpair id to governance variable for DFI/BTC price used in take…
Mixa84 May 4, 2021
39b77cb
Added takerFeePerBTC gov var, adapted timeouts for htlcs, check in rp…
Mixa84 May 5, 2021
f5fb2dc
Added key for ext htlc closed, addapted test and rpcs.
Mixa84 May 6, 2021
13342f8
Fill partial offer to complete order
Bushstar May 7, 2021
1c6c4ae
Test burn. Wip burn map in ConnectBlock. Tally tokens.
Bushstar May 9, 2021
ed6ce22
Merge branch '1.7.x' of github.com:DeFiCh/ain into feature/icxorderbook
monstrobishi May 10, 2021
468b487
ICX Set order owner on creation
Bushstar May 10, 2021
147be8e
Fix regressions, reproducible crashes
bvbfan May 10, 2021
e6a67fa
Remove chain data from DB, refactor address storing only in order/off…
Mixa84 May 12, 2021
4cd7105
Add warning disclaimer
Mixa84 May 12, 2021
a4d7909
Add creation fee for devnet
monstrobishi May 14, 2021
4176d50
Merge branch 'fix/devnet_token_creation' of github.com:DeFiCh/ain int…
monstrobishi May 14, 2021
b1d2d05
Fixed HTLC timout check, refund partial takerFee on partial offer acc…
Mixa84 May 14, 2021
3010a4b
Fixed expiration of offer and htlcs, added check for open offer on s…
Mixa84 May 14, 2021
f914207
Fix order expiration refund, add checkin rpc for htlc if order expire…
Mixa84 May 14, 2021
97dfeb7
Fix findng poolpair and calculating DFI per BTC, adapted test, rpc fix.
Mixa84 May 15, 2021
798e4a1
Remove unnecessary check in GetBTCDFIPoolPair(), make BTC isDAT in er…
Mixa84 May 15, 2021
f2b7077
Masternode creation requires authorization (#386)
bvbfan May 15, 2021
1afe7da
Polish correct offer prices in blockchain layer
bvbfan May 17, 2021
ee2a1c4
Merge branch '1.7.x' into feature/icxorderbook
Bushstar May 17, 2021
b902aaf
Moving more checks from RPC to mn_checks, cleanup code
Mixa84 May 17, 2021
587b0de
Small fixes.
Mixa84 May 17, 2021
3bed26c
Follow getburninfo at all steps. Set correct amounts.
Bushstar May 17, 2021
17eb9a2
Fix lint
Mixa84 May 17, 2021
ce38bb7
Fix lint
Mixa84 May 17, 2021
935b0f9
Fix typo.
Mixa84 May 17, 2021
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,6 @@ dist/

# spv
!src/spv/Makefile

# VSCode extension LocalHistory
.history
9 changes: 7 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,11 @@ DEFI_CORE_H = \
masternodes/communityaccounttypes.h \
masternodes/criminals.h \
masternodes/factory.h \
masternodes/govvariables/icx_takerfee_per_btc.h \
masternodes/govvariables/lp_daily_dfi_reward.h \
masternodes/govvariables/lp_splits.h \
masternodes/gv.h \
masternodes/icxorder.h \
masternodes/incentivefunding.h \
masternodes/masternodes.h \
masternodes/mn_checks.h \
Expand Down Expand Up @@ -366,19 +368,22 @@ libdefi_server_a_SOURCES = \
masternodes/anchors.cpp \
masternodes/criminals.cpp \
masternodes/oracles.cpp \
masternodes/govvariables/icx_takerfee_per_btc.cpp \
masternodes/govvariables/lp_daily_dfi_reward.cpp \
masternodes/govvariables/lp_splits.cpp \
masternodes/gv.cpp \
masternodes/icxorder.cpp \
masternodes/incentivefunding.cpp \
masternodes/masternodes.cpp \
masternodes/mn_checks.cpp \
masternodes/mn_rpc.cpp \
masternodes/rpc_accounts.cpp \
masternodes/rpc_customtx.cpp \
masternodes/rpc_masternodes.cpp \
masternodes/rpc_tokens.cpp \
masternodes/rpc_poolpair.cpp \
masternodes/rpc_icxorderbook.cpp \
masternodes/rpc_oracles.cpp \
masternodes/rpc_poolpair.cpp \
masternodes/rpc_tokens.cpp \
masternodes/tokens.cpp \
masternodes/poolpairs.cpp \
masternodes/undos.cpp \
Expand Down
3 changes: 3 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,9 @@ class CDevNetParams : public CChainParams {
consensus.mn.anchoringTimeDepth = 3 * 60 * 60; // 3 hours
consensus.mn.anchoringTeamChange = 120; // Number of blocks

consensus.token.creationFee = 100 * COIN;
consensus.token.collateralAmount = 1 * COIN;

consensus.spv.creationFee = 100000; // should be > bitcoin's dust
consensus.spv.wallet_xpub = "tpubD9RkyYW1ixvD9vXVpYB1ka8rPZJaEQoKraYN7YnxbBxxsRYEMZgRTDRGEo1MzQd7r5KWxH8eRaQDVDaDuT4GnWgGd17xbk6An6JMdN4dwsY"; /// @note devnet matter
consensus.spv.anchors_address = "mpAkq2LyaUvKrJm2agbswrkn3QG9febnqL"; /// @note devnet matter
Expand Down
31 changes: 31 additions & 0 deletions src/masternodes/govvariables/icx_takerfee_per_btc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) 2020 The DeFi Foundation
// Distributed under the MIT software license, see the accompanying
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.

#include <masternodes/govvariables/icx_takerfee_per_btc.h>
#include <core_io.h> /// ValueFromAmount
#include <masternodes/masternodes.h> /// CCustomCSView
#include <rpc/util.h> /// AmountFromValue

Res ICX_TAKERFEE_PER_BTC::Import(const UniValue & val) {
takerFeePerBTC = AmountFromValue(val);
return Res::Ok();
}

UniValue ICX_TAKERFEE_PER_BTC::Export() const {
UniValue res(UniValue::VOBJ);

return ValueFromAmount(takerFeePerBTC);
}

Res ICX_TAKERFEE_PER_BTC::Validate(const CCustomCSView &mnview) const
{
if (takerFeePerBTC <= 0)
return Res::Err("takerFeePerBTC cannot be 0 or less");
return Res::Ok();
}

Res ICX_TAKERFEE_PER_BTC::Apply(CCustomCSView & mnview, uint32_t)
{
return mnview.ICXSetTakerFeePerBTC(takerFeePerBTC);
}
35 changes: 35 additions & 0 deletions src/masternodes/govvariables/icx_takerfee_per_btc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef DEFI_MASTERNODES_GOVVARIABLES_ICX_TAKERFEE_PER_BTC_H
#define DEFI_MASTERNODES_GOVVARIABLES_ICX_TAKERFEE_PER_BTC_H

#include <masternodes/gv.h>
#include <amount.h>

class ICX_TAKERFEE_PER_BTC : public GovVariable, public AutoRegistrator<GovVariable, ICX_TAKERFEE_PER_BTC>
{
public:
virtual ~ICX_TAKERFEE_PER_BTC() override {}

std::string GetName() const override {
return TypeName();
}

Res Import(UniValue const &val) override;
UniValue Export() const override;
Res Validate(CCustomCSView const &mnview) const override;
Res Apply(CCustomCSView &mnview, uint32_t height) override;

static constexpr char const * TypeName() { return "ICX_TAKERFEE_PER_BTC"; }
static GovVariable * Create() { return new ICX_TAKERFEE_PER_BTC(); }

ADD_OVERRIDE_VECTOR_SERIALIZE_METHODS
ADD_OVERRIDE_SERIALIZE_METHODS(CDataStream)

template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(takerFeePerBTC);
}

CAmount takerFeePerBTC;
};

#endif // DEFI_MASTERNODES_GOVVARIABLES_ICX_TAKERFEE_PER_BTC_H
1 change: 1 addition & 0 deletions src/masternodes/gv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.

#include <masternodes/gv.h>
#include <masternodes/govvariables/icx_takerfee_per_btc.h>
#include <masternodes/govvariables/lp_daily_dfi_reward.h>
#include <masternodes/govvariables/lp_splits.h>

Expand Down
Loading