From 7c255cef5b643e327616466c0bf0b2145f2006b4 Mon Sep 17 00:00:00 2001 From: Gerard097 Date: Mon, 11 Sep 2023 09:21:09 -0600 Subject: [PATCH] Fix existing peg token check --- src/dao.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/dao.cpp b/src/dao.cpp index 819df71..7878805 100644 --- a/src/dao.cpp +++ b/src/dao.cpp @@ -3263,6 +3263,13 @@ void dao::pushPegTokenSettings(name dao, ContentGroup& settingsGroup, ContentWra pegMultiplier->getAs(); + EOS_CHECK( + std::count_if(settingsGroup.begin(), settingsGroup.end(), [](Content& c){ + return c.label == common::PEG_TOKEN; + }) == 0, + "DAO has a peg token already" + ) + //Don't move the token as it it will be used later on settingsGroup.push_back(*pegToken); settingsGroup.push_back(std::move(pegTokenName)); @@ -3270,20 +3277,6 @@ void dao::pushPegTokenSettings(name dao, ContentGroup& settingsGroup, ContentWra if (create) { - auto daoId = getDAOID(dao); - - EOS_CHECK( - daoId, - to_str(dao, " is not registered with the ID: ", *daoId) - ); - - auto daoSettings = getSettingsDocument(*daoId); - - EOS_CHECK( - !daoSettings->getSettingOpt(common::PEG_TOKEN), - "DAO has a peg token already" - ) - auto dhoSettings = getSettingsDocument(); createToken(