From 0cd4b616f3b6c436c5c671707e0013504d2ebe11 Mon Sep 17 00:00:00 2001 From: Mihailo Milenkovic Date: Thu, 24 Nov 2022 15:52:45 +0100 Subject: [PATCH] Rename daliyMintLimit to mintLimitDaily in consortium members --- src/masternodes/govvariables/attributes.cpp | 4 +-- test/functional/feature_consortium.py | 36 ++++++++++----------- test/functional/feature_setgov.py | 13 ++++---- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/masternodes/govvariables/attributes.cpp b/src/masternodes/govvariables/attributes.cpp index 983c74874d..13b8c1b6da 100644 --- a/src/masternodes/govvariables/attributes.cpp +++ b/src/masternodes/govvariables/attributes.cpp @@ -507,7 +507,7 @@ static ResVal VerifyConsortiumMember(const UniValue &values) { return Res::Err("Mint limit is an invalid amount"); } - if (!AmountFromValue(value["dailyMintLimit"], member.dailyMintLimit) || !member.dailyMintLimit) { + if (!AmountFromValue(value["mintLimitDaily"], member.dailyMintLimit) || !member.dailyMintLimit) { return Res::Err("Daily mint limit is an invalid amount"); } @@ -1219,7 +1219,7 @@ UniValue ATTRIBUTES::ExportFiltered(GovVarsFilter filter, const std::string &pre elem.pushKV("ownerAddress", ScriptToString(member.ownerAddress)); elem.pushKV("backingId", member.backingId); elem.pushKV("mintLimit", ValueFromAmount(member.mintLimit)); - elem.pushKV("dailyMintLimit", ValueFromAmount(member.dailyMintLimit)); + elem.pushKV("mintLimitDaily", ValueFromAmount(member.dailyMintLimit)); elem.pushKV("status", member.status); result.pushKV(id, elem); } diff --git a/test/functional/feature_consortium.py b/test/functional/feature_consortium.py index 75961876dd..4682fe6ddd 100755 --- a/test/functional/feature_consortium.py +++ b/test/functional/feature_consortium.py @@ -117,26 +117,26 @@ def run_test(self): assert_raises_rpc_error(-32600, "Mint limit higher than global mint limit", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/consortium/' + idBTC + '/members' : {"01":{"name":"account2BTC", "ownerAddress": account2, "backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf", - "dailyMintLimit":10.00000000, + "mintLimitDaily":10.00000000, "mintLimit":11.00000000}}}}) # Test setting member mint limit hight than global mint assert_raises_rpc_error(-32600, "Daily mint limit higher than daily global mint limit", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/consortium/' + idBTC + '/members' : {"01":{"name":"account2BTC", "ownerAddress": account2, "backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf", - "dailyMintLimit":11.00000000, + "mintLimitDaily":11.00000000, "mintLimit":10.00000000}}}}) # Set consortium members self.nodes[0].setgov({"ATTRIBUTES":{'v0/consortium/' + idBTC + '/members' : {"01":{"name":"account2BTC", "ownerAddress": account2, "backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf", - "dailyMintLimit":10.00000000, + "mintLimitDaily":10.00000000, "mintLimit":10.00000000}, "02":{"name":"account3BTC", "ownerAddress": account3, "backingId":"6c67fe93cad3d6a4982469a9b6708cdde2364f183d3698d3745f86eeb8ba99d5", - "dailyMintLimit":4.00000000, + "mintLimitDaily":4.00000000, "mintLimit":4.00000000}}}}) self.nodes[0].generate(1) self.sync_blocks() @@ -144,11 +144,11 @@ def run_test(self): assert_raises_rpc_error(-32600, "Cannot add a member with an owner address of a existing consortium member", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/consortium/' + idBTC + '/members' : {"03":{"name":"test", "ownerAddress": account2, "backingId":"7cb2f6954291d81d2270c9a6a52442b3f8c637b1ec793c731cb5f5a8f7fb9b9d", - "dailyMintLimit":10.00000000, + "mintLimitDaily":10.00000000, "mintLimit":10.00000000}}}}) attribs = self.nodes[2].getgov('ATTRIBUTES')['ATTRIBUTES'] - assert_equal(attribs['v0/consortium/' + idBTC + '/members'], {"01":{"name":"account2BTC","ownerAddress": account2,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit": Decimal('10.00000000'),"dailyMintLimit":Decimal('10.00000000'),"status":0},"02":{"name":"account3BTC","ownerAddress": account3,"backingId":"6c67fe93cad3d6a4982469a9b6708cdde2364f183d3698d3745f86eeb8ba99d5","mintLimit":Decimal('4.00000000'),"dailyMintLimit":Decimal('4.00000000'),"status":0}}) + assert_equal(attribs['v0/consortium/' + idBTC + '/members'], {"01":{"name":"account2BTC","ownerAddress": account2,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit": Decimal('10.00000000'),"mintLimitDaily":Decimal('10.00000000'),"status":0},"02":{"name":"account3BTC","ownerAddress": account3,"backingId":"6c67fe93cad3d6a4982469a9b6708cdde2364f183d3698d3745f86eeb8ba99d5","mintLimit":Decimal('4.00000000'),"mintLimitDaily":Decimal('4.00000000'),"status":0}}) assert_equal(attribs['v0/consortium/' + idBTC + '/mint_limit'], '10') assert_raises_rpc_error(-32600, "You are not a foundation member or token owner and cannot mint this token", self.nodes[2].minttokens, ["1@" + symbolDOGE]) @@ -172,22 +172,22 @@ def run_test(self): self.nodes[0].setgov({"ATTRIBUTES":{'v0/consortium/' + idDOGE + '/members' : {"01":{"name":"account2DOGE", "ownerAddress": account2, "backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf", - "dailyMintLimit":5.00000000, + "mintLimitDaily":5.00000000, "mintLimit":5.00000000}}}}) self.nodes[0].setgov({"ATTRIBUTES":{'v0/consortium/' + idDOGE + '/members' : {"02":{"name":"account1DOGE", "ownerAddress": account1, "backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf", - "dailyMintLimit":5.00000000, + "mintLimitDaily":5.00000000, "mintLimit":5.00000000}}}}) self.nodes[0].setgov({"ATTRIBUTES":{'v0/consortium/' + idDOGE + '/mint_limit' : '6', 'v0/consortium/' + idDOGE + '/mint_limit_daily' : '6'}}) self.nodes[0].generate(1) self.sync_blocks() attribs = self.nodes[2].getgov('ATTRIBUTES')['ATTRIBUTES'] - assert_equal(attribs['v0/consortium/' + idBTC + '/members'], {"01":{"name":"account2BTC","ownerAddress": account2,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit":Decimal('10.00000000'),"dailyMintLimit":Decimal('10.00000000'),"status":0},"02":{"name":"account3BTC","ownerAddress": account3,"backingId":"6c67fe93cad3d6a4982469a9b6708cdde2364f183d3698d3745f86eeb8ba99d5","mintLimit":Decimal('4.00000000'),"dailyMintLimit":Decimal('4.00000000'),"status":0}}) + assert_equal(attribs['v0/consortium/' + idBTC + '/members'], {"01":{"name":"account2BTC","ownerAddress": account2,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit":Decimal('10.00000000'),"mintLimitDaily":Decimal('10.00000000'),"status":0},"02":{"name":"account3BTC","ownerAddress": account3,"backingId":"6c67fe93cad3d6a4982469a9b6708cdde2364f183d3698d3745f86eeb8ba99d5","mintLimit":Decimal('4.00000000'),"mintLimitDaily":Decimal('4.00000000'),"status":0}}) assert_equal(attribs['v0/consortium/' + idBTC + '/mint_limit'], '10') - assert_equal(attribs['v0/consortium/' + idDOGE + '/members'], {"01":{"name":"account2DOGE","ownerAddress": account2,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit":Decimal('5.00000000'),"dailyMintLimit":Decimal('5.00000000'),"status":0},"02":{"name":"account1DOGE","ownerAddress": account1,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit":Decimal('5.00000000'),"dailyMintLimit":Decimal('5.00000000'),"status":0}}) + assert_equal(attribs['v0/consortium/' + idDOGE + '/members'], {"01":{"name":"account2DOGE","ownerAddress": account2,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit":Decimal('5.00000000'),"mintLimitDaily":Decimal('5.00000000'),"status":0},"02":{"name":"account1DOGE","ownerAddress": account1,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit":Decimal('5.00000000'),"mintLimitDaily":Decimal('5.00000000'),"status":0}}) assert_equal(attribs['v0/consortium/' + idDOGE + '/mint_limit'], '6') assert_equal(attribs['v0/consortium/' + idDOGE + '/mint_limit_daily'], '6') @@ -306,13 +306,13 @@ def run_test(self): "ownerAddress": account2, "backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf", "mintLimit":5.00000000, - "dailyMintLimit":5.00000000, + "mintLimitDaily":5.00000000, "status":1}}}}) self.nodes[0].generate(1) self.sync_blocks() attribs = self.nodes[0].getgov('ATTRIBUTES')['ATTRIBUTES'] - assert_equal(attribs['v0/consortium/' + idDOGE + '/members'], {"01":{"name":"account2DOGE","ownerAddress": account2,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit":Decimal('5.00000000'),"dailyMintLimit":Decimal('5.00000000'),"status":1},"02":{"name":"account1DOGE","ownerAddress": account1,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit":Decimal('5.00000000'),"dailyMintLimit":Decimal('5.00000000'),"status":0}}) + assert_equal(attribs['v0/consortium/' + idDOGE + '/members'], {"01":{"name":"account2DOGE","ownerAddress": account2,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit":Decimal('5.00000000'),"mintLimitDaily":Decimal('5.00000000'),"status":1},"02":{"name":"account1DOGE","ownerAddress": account1,"backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf","mintLimit":Decimal('5.00000000'),"mintLimitDaily":Decimal('5.00000000'),"status":0}}) assert_equal(self.nodes[0].getburninfo(), {'address': 'mfburnZSAM7Gs1hpDeNaMotJXSGA7edosG', 'amount': Decimal('0E-8'), 'tokens': [], 'consortiumtokens': ['2.00000000@DOGE'], 'feeburn': Decimal('2.00000000'), 'auctionburn': Decimal('0E-8'), 'paybackburn': [], 'dexfeetokens': [], 'dfipaybackfee': Decimal('0E-8'), 'dfipaybacktokens': [], 'paybackfees': [], 'paybacktokens': [], 'emissionburn': Decimal('4923.76500000'), 'dfip2203': [], 'dfip2206f': []}) assert_raises_rpc_error(-32600, "Cannot mint token, not an active member of consortium for DOGE!", self.nodes[2].minttokens, ["1@" + symbolDOGE]) @@ -364,7 +364,7 @@ def run_test(self): self.nodes[0].setgov({"ATTRIBUTES":{'v0/consortium/' + idBTC + '/members' : {"02":{"name":"account3BTC", "ownerAddress": account3, "backingId":"6c67fe93cad3d6a4982469a9b6708cdde2364f183d3698d3745f86eeb8ba99d5", - "dailyMintLimit":4.00000000, + "mintLimitDaily":4.00000000, "mintLimit":6.00000000}}}}) self.nodes[0].setgov({"ATTRIBUTES":{'v0/consortium/' + idBTC + '/mint_limit' : '20'}}) self.nodes[0].generate(1) @@ -407,7 +407,7 @@ def run_test(self): self.nodes[0].setgov({"ATTRIBUTES":{'v0/consortium/' + idBTC + '/members' : {"02":{"name":"account3BTC", "ownerAddress": account3, "backingId":"6c67fe93cad3d6a4982469a9b6708cdde2364f183d3698d3745f86eeb8ba99d5", - "dailyMintLimit":2.00000000, + "mintLimitDaily":2.00000000, "mintLimit":8.00000000}}}}) self.nodes[0].generate(1) @@ -499,12 +499,12 @@ def run_test(self): self.nodes[0].setgov({"ATTRIBUTES": {'v0/consortium/' + idBTC + '/members': {"01":{"name":"account2BTC", "ownerAddress": account2, "backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf", - "dailyMintLimit":100000.00000000, + "mintLimitDaily":100000.00000000, "mintLimit":100000.00000000}, "02":{"name":"account3BTC", "ownerAddress": account3, "backingId":"6c67fe93cad3d6a4982469a9b6708cdde2364f183d3698d3745f86eeb8ba99d5", - "dailyMintLimit":400000.00000000, + "mintLimitDaily":400000.00000000, "mintLimit":400000.00000000}}}}) self.nodes[0].generate(1) @@ -512,12 +512,12 @@ def run_test(self): self.nodes[0].setgov({"ATTRIBUTES": {'v0/consortium/' + idBTC + '/members': {"01":{"name":"account2BTC", "ownerAddress": account2, "backingId":"ebf634ef7143bc5466995a385b842649b2037ea89d04d469bfa5ec29daf7d1cf", - "dailyMintLimit":1.00000000, + "mintLimitDaily":1.00000000, "mintLimit":1.00000000}, "02":{"name":"account3BTC", "ownerAddress": account3, "backingId":"6c67fe93cad3d6a4982469a9b6708cdde2364f183d3698d3745f86eeb8ba99d5", - "dailyMintLimit":1.00000000, + "mintLimitDaily":1.00000000, "mintLimit":1.00000000}}}}) self.nodes[0].generate(1) diff --git a/test/functional/feature_setgov.py b/test/functional/feature_setgov.py index d9b8b7972b..ffad9ace6e 100755 --- a/test/functional/feature_setgov.py +++ b/test/functional/feature_setgov.py @@ -790,7 +790,7 @@ def run_test(self): "ownerAddress": owner, "backingId":"blablabla", "mintLimit": "10.00000000", - "dailyMintLimit": "1.0000000"}}}}) + "mintLimitDaily": "1.0000000"}}}}) assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GrandCentral", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/params/feature/consortium':'true'}}) assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GrandCentral", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/consortium/4/mint_limit':'1000000000'}}) @@ -896,14 +896,14 @@ def run_test(self): "ownerAddress": owner, "backingId":"blablabla", "mintLimit":10.00000000, - "dailyMintLimit":-10.00000000}}}}) + "mintLimitDaily":-10.00000000}}}}) assert_raises_rpc_error(-5, "Status must be a positive number", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/consortium/4/members' : {"01":{"name":"test", "ownerAddress": owner, "backingId":"blablabla", "mintLimit":10.00000000, - "dailyMintLimit":1.00000000, + "mintLimitDaily":1.00000000, "status":-1}}}}) - assert_raises_rpc_error(-5, "Status can be either 0 or 1", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/consortium/4/members' : {"01":{"name":"test", "ownerAddress": owner, "backingId":"blablabla", "mintLimit":10.00000000, "dailyMintLimit":1.00000000, "status":2}}}}) + assert_raises_rpc_error(-5, "Status can be either 0 or 1", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/consortium/4/members' : {"01":{"name":"test", "ownerAddress": owner, "backingId":"blablabla", "mintLimit":10.00000000, "mintLimitDaily":1.00000000, "status":2}}}}) self.nodes[0].setgov({"ATTRIBUTES":{'v0/consortium/4/mint_limit' : '10', 'v0/consortium/4/mint_limit_daily' : '1'}}) self.nodes[0].generate(1) @@ -912,17 +912,16 @@ def run_test(self): "ownerAddress": owner, "backingId":"blablabla", "mintLimit": 10, - "dailyMintLimit": 1}}}}) + "mintLimitDaily": 1}}}}) self.nodes[0].generate(1) # Check result result = self.nodes[0].getgov('ATTRIBUTES')['ATTRIBUTES'] - print(result['v0/consortium/4/members']) assert_equal(result['v0/consortium/4/members'], {"01":{"name":"test", "ownerAddress": owner, "backingId":"blablabla", "mintLimit": Decimal('10.00000000'), - "dailyMintLimit": Decimal('1.00000000'), + "mintLimitDaily": Decimal('1.00000000'), "status": 0}}) assert_raises_rpc_error(-5, "Percentage exceeds 100%", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/gov/proposals/fee_burn_pct':'1.23'}})