Permalink
Browse files

Set inititial config permission to self to allow the `updateconfig` a…

…ction to be called without needing the hardcoded "dacauthority" permission.
  • Loading branch information...
dallasjohnson committed Feb 1, 2019
1 parent 27f30d8 commit 6334516bb7b4055fd40386347c166b4224427012
@@ -1,7 +1,11 @@

void daccustodian::updateconfig(contr_config new_config) {

require_auth(configs().authaccount);
if (configs().authaccount == name{0}) {
require_auth(_self);
} else {
require_auth(configs().authaccount);
}

eosio_assert(new_config.auth_threshold_high < new_config.numelected,
"ERR::UPDATECONFIG_INVALID_AUTH_HIGH_TO_NUM_ELECTED::The auth threshold can never be satisfied with a value greater than the number of elected custodians");
@@ -39,7 +39,7 @@ struct [[eosio::table("config"), eosio::contract("daccustodian")]] contr_config
// - used for pay calculations if an eary election is called and to trigger deferred `newperiod` calls.
uint32_t periodlength = 7 * 24 * 60 * 60;
// account to have active auth set with all all custodians on the newperiod.
name authaccount = "dacauthority"_n;
name authaccount = name{0};

// The contract that holds the fund for the DAC. This is used as the source for custodian pay.
name tokenholder = "eosdacthedac"_n;
@@ -1,5 +1,5 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Fri Nov 23 01:24:03 2018",
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Fri Feb 1 23:33:20 2019",
"version": "eosio::abi/1.1",
"structs": [
{
Binary file not shown.
@@ -1,5 +1,5 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Fri Nov 23 01:24:10 2018",
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Fri Feb 1 23:33:26 2019",
"version": "eosio::abi/1.1",
"structs": [
{
Binary file not shown.
@@ -1,5 +1,5 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Fri Nov 23 01:24:17 2018",
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Fri Feb 1 23:33:32 2019",
"version": "eosio::abi/1.1",
"structs": [
{
Binary file not shown.
@@ -1,5 +1,5 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Fri Nov 23 01:24:23 2018",
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Fri Feb 1 23:36:26 2019",
"version": "eosio::abi/1.1",
"structs": [
{
Binary file not shown.
@@ -227,7 +227,7 @@ def configure_contracts
end

context "with valid auth" do
command %(cleos push action daccustodian updateconfig '{"newconfig": { "lockupasset": "10.0000 EOSDAC", "maxvotes": 5, "periodlength": 604800 , "numelected": 12, "authaccount": "dacauthority", "tokenholder": "eosdacthedac", "serviceprovider": "dacocoiogmbh", "should_pay_via_service_provider": 1, "auththresh": 3, "initial_vote_quorum_percent": 15, "vote_quorum_percent": 10, "auth_threshold_high": 11, "auth_threshold_mid": 7, "auth_threshold_low": 3, "lockup_release_time_delay": 10, "requested_pay_max": "450.0000 EOS"}}' -p dacauthority), allow_error: true
command %(cleos push action daccustodian updateconfig '{"newconfig": { "lockupasset": "10.0000 EOSDAC", "maxvotes": 5, "periodlength": 604800 , "numelected": 12, "authaccount": "dacauthority", "tokenholder": "eosdacthedac", "serviceprovider": "dacocoiogmbh", "should_pay_via_service_provider": 1, "auththresh": 3, "initial_vote_quorum_percent": 15, "vote_quorum_percent": 10, "auth_threshold_high": 11, "auth_threshold_mid": 7, "auth_threshold_low": 3, "lockup_release_time_delay": 10, "requested_pay_max": "450.0000 EOS"}}' -p daccustodian), allow_error: true
its(:stdout) {is_expected.to include('daccustodian::updateconfig')}
end
end

0 comments on commit 6334516

Please sign in to comment.