MCPcopy Create free account
hub / github.com/ElementsProject/elements / SetHex

Method SetHex

src/assetsdir.cpp:26–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26void CAssetsDir::SetHex(const std::string& assetHex, const std::string& label)
27{
28 if (!IsHex(assetHex) || assetHex.size() != 64)
29 throw std::runtime_error("The asset must be hex string of length 64");
30
31 const std::vector<std::string> protectedLabels = {"", "*", "bitcoin", "Bitcoin", "btc"};
32 for (std::string proLabel : protectedLabels) {
33 if (label == proLabel) {
34 throw std::runtime_error(strprintf("'%s' label is protected", proLabel));
35 }
36 }
37 Set(CAsset(uint256S(assetHex)), AssetMetadata(label));
38}
39
40void CAssetsDir::InitFromStrings(const std::vector<std::string>& assetsToInit, const std::string& pegged_asset_name)
41{

Callers

nothing calls this directly

Calls 5

IsHexFunction · 0.85
CAssetClass · 0.85
uint256SFunction · 0.85
AssetMetadataClass · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected