Skip to content

Commit

Permalink
Fix existing peg token check
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerard097 committed Sep 11, 2023
1 parent 6c7fe87 commit 7c255ce
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/dao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3263,27 +3263,20 @@ void dao::pushPegTokenSettings(name dao, ContentGroup& settingsGroup, ContentWra

pegMultiplier->getAs<int64_t>();

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));
ContentWrapper::insertOrReplace(settingsGroup, *pegMultiplier);

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<asset>(common::PEG_TOKEN),
"DAO has a peg token already"
)

auto dhoSettings = getSettingsDocument();

createToken(
Expand Down

0 comments on commit 7c255ce

Please sign in to comment.