diff --git a/src/masternodes/govvariables/attributes.cpp b/src/masternodes/govvariables/attributes.cpp index b7bb71f71b..97473b5933 100644 --- a/src/masternodes/govvariables/attributes.cpp +++ b/src/masternodes/govvariables/attributes.cpp @@ -79,6 +79,8 @@ const std::map& ATTRIBUTES::allowedParamIDs() { {"dfip2201", ParamIDs::DFIP2201}, {"dfip2203", ParamIDs::DFIP2203}, {"dfip2206a", ParamIDs::DFIP2206A}, + // Note: DFIP2206F is currently in beta testing + // for testnet. May not be enabled on mainnet until testing is complete. {"dfip2206f", ParamIDs::DFIP2206F}, }; return params; @@ -96,6 +98,8 @@ const std::map& ATTRIBUTES::displayParamsIDs() { {ParamIDs::DFIP2201, "dfip2201"}, {ParamIDs::DFIP2203, "dfip2203"}, {ParamIDs::DFIP2206A, "dfip2206a"}, + // Note: DFIP2206F is currently in beta testing + // for testnet. May not be enabled on mainnet until testing is complete. {ParamIDs::DFIP2206F, "dfip2206f"}, {ParamIDs::TokenID, "token"}, {ParamIDs::Economy, "economy"}, @@ -478,6 +482,11 @@ Res ATTRIBUTES::ProcessVariable(const std::string& key, const std::string& value return Res::Err("Unsupported type {%d}", type); } + // Alias of reward_pct in Export. + if (keys[3] == "fee_pct") { + return Res::Ok(); + } + itype = ikey->second.find(keys[3]); if (itype == ikey->second.end()) { return ::ShowError("key", ikey->second); @@ -793,6 +802,15 @@ UniValue ATTRIBUTES::ExportFiltered(GovVarsFilter filter, const std::string &pre decimalStr.pop_back(); } ret.pushKV(key, decimalStr); + + // Create fee_pct alias of reward_pct. + if (v0Key == "reward_pct") { + const auto newKey = KeyBuilder(displayVersions().at(VersionTypes::v0), + displayTypes().at(attrV0->type), + id, + "fee_pct"); + ret.pushKV(newKey, decimalStr); + } } } else if (const auto balances = std::get_if(&attribute.second)) { ret.pushKV(key, AmountsToJSON(balances->balances)); diff --git a/test/functional/feature_futures.py b/test/functional/feature_futures.py index e08fc619da..f9cb2805b4 100755 --- a/test/functional/feature_futures.py +++ b/test/functional/feature_futures.py @@ -243,6 +243,7 @@ def futures_setup(self): result = self.nodes[0].getgov('ATTRIBUTES')['ATTRIBUTES'] assert_equal(result['v0/params/dfip2203/active'], 'true') assert_equal(result['v0/params/dfip2203/reward_pct'], '0.05') + assert_equal(result['v0/params/dfip2203/fee_pct'], '0.05') assert_equal(result['v0/params/dfip2203/block_period'], str(self.futures_interval)) # Disable DUSD @@ -1129,7 +1130,7 @@ def dfi_to_dusd(self): # Set DFI-to-DUSD Gov vars self.nodes[0].setgov({"ATTRIBUTES":{ 'v0/params/dfip2206f/reward_pct': '0.01', - 'v0/params/dfip2206f/block_period': str(self.futures_interval_dusd), + 'v0/params/dfip2206f/block_period': f'{self.futures_interval_dusd}', 'v0/params/dfip2206f/start_block': f'{self.start_block_dusd}' }}) self.nodes[0].generate(1) @@ -1138,6 +1139,14 @@ def dfi_to_dusd(self): self.nodes[0].setgov({"ATTRIBUTES":{'v0/params/dfip2206f/active':'true'}}) self.nodes[0].generate(1) + # Verify Gov vars + result = self.nodes[0].getgov('ATTRIBUTES')['ATTRIBUTES'] + assert_equal(result['v0/params/dfip2206f/active'], 'true') + assert_equal(result['v0/params/dfip2206f/reward_pct'], '0.01') + assert_equal(result['v0/params/dfip2206f/fee_pct'], '0.01') + assert_equal(result['v0/params/dfip2206f/block_period'], f'{self.futures_interval_dusd}') + assert_equal(result['v0/params/dfip2206f/start_block'], f'{self.start_block_dusd}') + # Test cannot create a future swap until active assert_raises_rpc_error(-32600, f'DFIP2206F not active until block {self.start_block_dusd}', self.nodes[0].futureswap, address, f'1@{self.symbolDFI}', f'{self.symbolDUSD}') diff --git a/test/functional/feature_loan_get_interest.py b/test/functional/feature_loan_get_interest.py old mode 100644 new mode 100755 diff --git a/test/functional/feature_rpcstats.py b/test/functional/feature_rpcstats.py old mode 100644 new mode 100755 diff --git a/test/functional/feature_setgov.py b/test/functional/feature_setgov.py index 3960f78297..0b4517e53e 100755 --- a/test/functional/feature_setgov.py +++ b/test/functional/feature_setgov.py @@ -628,7 +628,7 @@ def run_test(self): assert_equal(result, result_27) assert_equal(result, result_all) - assert_equal(result, [[{'ICX_TAKERFEE_PER_BTC': Decimal('0.00200000')}], [{'LP_DAILY_LOAN_TOKEN_REWARD': Decimal('13020.86331792')}], [{'LP_LOAN_TOKEN_SPLITS': {'1': Decimal('0.10000000'), '2': Decimal('0.20000000'), '3': Decimal('0.70000000')}}], [{'LP_DAILY_DFI_REWARD': Decimal('13427.10581184')}], [{'LOAN_LIQUIDATION_PENALTY': Decimal('0.01000000')}], [{'LP_SPLITS': {'1': Decimal('0.70000000'), '2': Decimal('0.20000000'), '3': Decimal('0.10000000')}}], [{'ORACLE_BLOCK_INTERVAL': 30}], [{'ORACLE_DEVIATION': Decimal('0.07000000')}], [{'ATTRIBUTES': {'v0/params/dfip2201/active': 'true', 'v0/params/dfip2201/premium': '0.025', 'v0/params/dfip2201/minswap': '0.001', 'v0/params/dfip2203/active': 'true', 'v0/params/dfip2203/reward_pct': '0.05', 'v0/params/dfip2203/block_period': '20160', 'v0/token/5/payback_dfi': 'true', 'v0/token/5/payback_dfi_fee_pct': '0.33', 'v0/token/5/loan_payback/1': 'true', 'v0/token/5/loan_payback/2': 'true', 'v0/token/5/loan_payback_fee_pct/1': '0.25', 'v0/token/5/dex_in_fee_pct': '0.6', 'v0/token/5/dex_out_fee_pct': '0.12', 'v0/token/5/dfip2203': 'true'}}]]) + assert_equal(result, [[{'ICX_TAKERFEE_PER_BTC': Decimal('0.00200000')}], [{'LP_DAILY_LOAN_TOKEN_REWARD': Decimal('13020.86331792')}], [{'LP_LOAN_TOKEN_SPLITS': {'1': Decimal('0.10000000'), '2': Decimal('0.20000000'), '3': Decimal('0.70000000')}}], [{'LP_DAILY_DFI_REWARD': Decimal('13427.10581184')}], [{'LOAN_LIQUIDATION_PENALTY': Decimal('0.01000000')}], [{'LP_SPLITS': {'1': Decimal('0.70000000'), '2': Decimal('0.20000000'), '3': Decimal('0.10000000')}}], [{'ORACLE_BLOCK_INTERVAL': 30}], [{'ORACLE_DEVIATION': Decimal('0.07000000')}], [{'ATTRIBUTES': {'v0/params/dfip2201/active': 'true', 'v0/params/dfip2201/premium': '0.025', 'v0/params/dfip2201/minswap': '0.001', 'v0/params/dfip2203/active': 'true', 'v0/params/dfip2203/reward_pct': '0.05', 'v0/params/dfip2203/fee_pct': '0.05', 'v0/params/dfip2203/block_period': '20160', 'v0/token/5/payback_dfi': 'true', 'v0/token/5/payback_dfi_fee_pct': '0.33', 'v0/token/5/loan_payback/1': 'true', 'v0/token/5/loan_payback/2': 'true', 'v0/token/5/loan_payback_fee_pct/1': '0.25', 'v0/token/5/dex_in_fee_pct': '0.6', 'v0/token/5/dex_out_fee_pct': '0.12', 'v0/token/5/dfip2203': 'true'}}]]) # Check errors assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningCrunch", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/locks/token/5':'true'}})