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

Disable updatetoken for DAT and splits #2683

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions src/dfi/mn_rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ UniValue setgov(const JSONRPCRequest &request) {
throw JSONRPCError(RPC_INVALID_REQUEST,
"Cannot set consortium on DFI, loan tokens and non-DAT tokens");
}
} else if (Params().NetworkIDString() != CBaseChainParams::REGTEST &&
attrV0->type == AttributeTypes::Oracles && attrV0->typeId == OracleIDs::Splits) {
throw JSONRPCError(RPC_INVALID_REQUEST, "Token splits disabled");
}
}
}
Expand Down Expand Up @@ -867,6 +870,9 @@ UniValue setgovheight(const JSONRPCRequest &request) {
throw JSONRPCError(RPC_INVALID_REQUEST,
"Cannot set consortium on DFI, loan tokens and non-DAT tokens");
}
} else if (Params().NetworkIDString() != CBaseChainParams::REGTEST &&
attrV0->type == AttributeTypes::Oracles && attrV0->typeId == OracleIDs::Splits) {
throw JSONRPCError(RPC_INVALID_REQUEST, "Token splits disabled");
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/dfi/rpc_tokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ UniValue updatetoken(const JSONRPCRequest &request) {
if (!token) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Token %s does not exist!", tokenStr));
}
if (Params().NetworkIDString() != CBaseChainParams::REGTEST && token->IsDAT()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot update DAT token");
}
tokenImpl = static_cast<const CTokenImplementation &>(*token);
if (tokenImpl.IsPoolShare()) {
throw JSONRPCError(RPC_INVALID_PARAMETER,
Expand Down
Loading