From 4da82328d8c125b08cc2fd30d4cfa4010d739723 Mon Sep 17 00:00:00 2001 From: Peter Bushnell Date: Fri, 24 Jun 2022 15:52:32 +0100 Subject: [PATCH] Rename interest burn attribute keys --- src/masternodes/govvariables/attributes.cpp | 16 ++++++++-------- src/masternodes/govvariables/attributes.h | 4 ++-- src/masternodes/mn_checks.cpp | 4 ++-- test/functional/feature_loan_payback_dfi.py | 4 ++-- test/functional/feature_setgov.py | 10 +++++----- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/masternodes/govvariables/attributes.cpp b/src/masternodes/govvariables/attributes.cpp index 286e42f967..dccf51f7ca 100644 --- a/src/masternodes/govvariables/attributes.cpp +++ b/src/masternodes/govvariables/attributes.cpp @@ -149,8 +149,8 @@ const std::map>& ATTRIBUTES::allowedKeys {"premium", DFIPKeys::Premium}, {"reward_pct", DFIPKeys::RewardPct}, {"block_period", DFIPKeys::BlockPeriod}, - {"direct_interest_dusd_burn", DFIPKeys::DirectInterestDUSDBurn}, - {"direct_loan_dusd_burn", DFIPKeys::DirectLoanDUSDBurn}, + {"dusd_interest_burn", DFIPKeys::DUSDInterestBurn}, + {"dusd_loan_burn", DFIPKeys::DUSDLoanBurn}, {"start_block", DFIPKeys::StartBlock}, } }, @@ -194,8 +194,8 @@ const std::map>& ATTRIBUTES::displayKeys {DFIPKeys::MinSwap, "minswap"}, {DFIPKeys::RewardPct, "reward_pct"}, {DFIPKeys::BlockPeriod, "block_period"}, - {DFIPKeys::DirectInterestDUSDBurn, "direct_interest_dusd_burn"}, - {DFIPKeys::DirectLoanDUSDBurn, "direct_loan_dusd_burn"}, + {DFIPKeys::DUSDInterestBurn, "dusd_interest_burn"}, + {DFIPKeys::DUSDLoanBurn, "dusd_loan_burn"}, {DFIPKeys::StartBlock, "start_block"}, } }, @@ -356,8 +356,8 @@ const std::mapsymbol, subLoan + subInterest, subInToken, paybackToken->symbol, height); - CDataStructureV0 directBurnKey{AttributeTypes::Param, ParamIDs::DFIP2206A, DFIPKeys::DirectLoanDUSDBurn}; + CDataStructureV0 directBurnKey{AttributeTypes::Param, ParamIDs::DFIP2206A, DFIPKeys::DUSDLoanBurn}; auto directLoanBurn = attributes->GetValue(directBurnKey, false); res = SwapToDFIorDUSD(mnview, paybackTokenId, subInToken, obj.from, consensus.burnAddress, height, !directLoanBurn); @@ -4145,7 +4145,7 @@ Res SwapToDFIorDUSD(CCustomCSView & mnview, DCT_ID tokenId, CAmount amount, CSc if (!attributes) { return Res::Err("Attributes unavailable"); } - CDataStructureV0 directBurnKey{AttributeTypes::Param, ParamIDs::DFIP2206A, DFIPKeys::DirectInterestDUSDBurn}; + CDataStructureV0 directBurnKey{AttributeTypes::Param, ParamIDs::DFIP2206A, DFIPKeys::DUSDInterestBurn}; // Direct swap from DUSD to DFI as defined in the CPoolSwapMessage. if (tokenId == dUsdToken->first) { diff --git a/test/functional/feature_loan_payback_dfi.py b/test/functional/feature_loan_payback_dfi.py index d41fcaeefa..aef885be61 100755 --- a/test/functional/feature_loan_payback_dfi.py +++ b/test/functional/feature_loan_payback_dfi.py @@ -377,7 +377,7 @@ def run_test(self): {account0: ["100@" + symbolBTC, "1000@" + symboldUSD]}, account0) self.nodes[0].generate(1) - self.nodes[0].setgov({"ATTRIBUTES":{'v0/params/dfip2206a/direct_interest_dusd_burn':'true', 'v0/token/'+idTSLA+'/loan_payback/'+idBTC: 'true', 'v0/token/'+idTSLA+'/loan_payback/'+iddUSD: 'true'}}) + self.nodes[0].setgov({"ATTRIBUTES":{'v0/params/dfip2206a/dusd_interest_burn':'true', 'v0/token/'+idTSLA+'/loan_payback/'+idBTC: 'true', 'v0/token/'+idTSLA+'/loan_payback/'+iddUSD: 'true'}}) self.nodes[0].generate(1) burnAddress = "mfburnZSAM7Gs1hpDeNaMotJXSGA7edosG" @@ -436,7 +436,7 @@ def run_test(self): balanceDFIBefore = balanceDFIAfter burn_before = burn_after - self.nodes[0].setgov({"ATTRIBUTES":{'v0/params/dfip2206a/direct_loan_dusd_burn':'true'}}) + self.nodes[0].setgov({"ATTRIBUTES":{'v0/params/dfip2206a/dusd_loan_burn':'true'}}) self.nodes[0].generate(1) self.nodes[0].paybackloan({ diff --git a/test/functional/feature_setgov.py b/test/functional/feature_setgov.py index 774855e2f5..75d8ea98af 100755 --- a/test/functional/feature_setgov.py +++ b/test/functional/feature_setgov.py @@ -784,16 +784,16 @@ def run_test(self): assert_raises_rpc_error(-5, "Unsupported type for this DFIP", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/params/dfip2206f/premium': '0.025'}}) assert_raises_rpc_error(-5, "Unsupported type for this DFIP", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/params/dfip2206f/minswap': '0.025'}}) assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot set block period while DFIP2203 is active", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/params/dfip2203/start_block':'0'}}) - assert_raises_rpc_error(-5, "Boolean value must be either \"true\" or \"false\"", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/params/dfip2206a/direct_interest_dusd_burn':'not_a_bool'}}) - assert_raises_rpc_error(-5, "Boolean value must be either \"true\" or \"false\"", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/params/dfip2206a/direct_loan_dusd_burn':'not_a_bool'}}) + assert_raises_rpc_error(-5, "Boolean value must be either \"true\" or \"false\"", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/params/dfip2206a/dusd_interest_burn':'not_a_bool'}}) + assert_raises_rpc_error(-5, "Boolean value must be either \"true\" or \"false\"", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/params/dfip2206a/dusd_loan_burn':'not_a_bool'}}) - self.nodes[0].setgov({"ATTRIBUTES":{'v0/params/dfip2206a/direct_interest_dusd_burn':'true', 'v0/params/dfip2206a/direct_loan_dusd_burn':'true'}}) + self.nodes[0].setgov({"ATTRIBUTES":{'v0/params/dfip2206a/dusd_interest_burn':'true', 'v0/params/dfip2206a/dusd_loan_burn':'true'}}) self.nodes[0].generate(1) # Verify FCR results result = self.nodes[0].getgov('ATTRIBUTES')['ATTRIBUTES'] - assert_equal(result['v0/params/dfip2206a/direct_interest_dusd_burn'], 'true') - assert_equal(result['v0/params/dfip2206a/direct_loan_dusd_burn'], 'true') + assert_equal(result['v0/params/dfip2206a/dusd_interest_burn'], 'true') + assert_equal(result['v0/params/dfip2206a/dusd_loan_burn'], 'true') # Set fee direction Gov vars self.nodes[0].setgov({"ATTRIBUTES":{