Skip to content
Merged
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
8 changes: 3 additions & 5 deletions contracts/ore.instrument/ore.instrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ ACTION instrument::checkright(name minter, name issuer, string rightname, uint64
bool minter_owns_right = rightitr.owner == minter;
if (!minter_owns_right)
{
auto position_in_whitelist = std::find(rightitr.issuer_whitelist.begin(), rightitr.issuer_whitelist.end(), minter);

auto position_in_whitelist = std::find(rightitr.issuer_whitelist.begin(), rightitr.issuer_whitelist.end(), minter);
//if minter is not in whitelist, cancel the entire mint transaction
if (position_in_whitelist == rightitr.issuer_whitelist.end())
{
Expand All @@ -245,13 +244,12 @@ ACTION instrument::checkright(name minter, name issuer, string rightname, uint64
cancel_deferred(deferred_transaction_id);
}
msg = "Attempt to create instrument with right: " + rightname + " by minter: " + minter.to_string() + " who isn't whitelisted or owner of right";
eosio_assert(position_in_whitelist != rightitr.issuer_whitelist.end(), msg.c_str());
eosio_assert(false, msg.c_str());
}
}

// check if the issuer of the instrument is the owner of the right
bool issuer_owns_right = rightitr.owner == issuer;

if (!issuer_owns_right)
{
auto issuer_in_whitelist = std::find(rightitr.issuer_whitelist.begin(), rightitr.issuer_whitelist.end(), issuer);
Expand All @@ -263,7 +261,7 @@ ACTION instrument::checkright(name minter, name issuer, string rightname, uint64
cancel_deferred(deferred_transaction_id);
}
msg = "Attempt to create instrument with right: " + rightname + " by issuer: " + issuer.to_string() + " who isn't whitelisted or owner of right";
eosio_assert(issuer_in_whitelist != rightitr.issuer_whitelist.end(), msg.c_str());
eosio_assert(false, msg.c_str());
}
}
}
Expand Down