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

Rename daliyMintLimit to mintLimitDaily in consortium members #1595

Merged
merged 1 commit into from
Nov 25, 2022
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
4 changes: 2 additions & 2 deletions src/masternodes/govvariables/attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ static ResVal<CAttributeValue> 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");
}

Expand Down Expand Up @@ -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);
}
Expand Down
36 changes: 18 additions & 18 deletions test/functional/feature_consortium.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,38 +117,38 @@ 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()

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])
Expand All @@ -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')

Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -499,25 +499,25 @@ 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)

# Decrease limit
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)

Expand Down
Loading