MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / get_bytestream_from_code

Method get_bytestream_from_code

src/Chain/libraries/glua/thinkyoung_lua_api.cpp:212–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210 }
211
212 std::shared_ptr<GluaModuleByteStream> GluaChainApi::get_bytestream_from_code(lua_State *L, const Code& code)
213 {
214 if (code.byte_code.size() > LUA_MODULE_BYTE_STREAM_BUF_SIZE)
215 return NULL;
216 auto p_luamodule = std::make_shared<GluaModuleByteStream>();
217 p_luamodule->is_bytes = true;
218 p_luamodule->buff.resize(code.byte_code.size());
219 memcpy(p_luamodule->buff.data(), code.byte_code.data(), code.byte_code.size());
220 p_luamodule->contract_name = "";
221
222 p_luamodule->contract_apis.clear();
223 std::copy(code.abi.begin(), code.abi.end(), std::back_inserter(p_luamodule->contract_apis));
224
225 p_luamodule->contract_emit_events.clear();
226 std::copy(code.offline_abi.begin(), code.offline_abi.end(), std::back_inserter(p_luamodule->offline_apis));
227
228 p_luamodule->contract_emit_events.clear();
229 std::copy(code.events.begin(), code.events.end(), std::back_inserter(p_luamodule->contract_emit_events));
230
231 p_luamodule->contract_storage_properties.clear();
232 std::copy(code.storage_properties.begin(), code.storage_properties.end(), std::inserter(p_luamodule->contract_storage_properties, p_luamodule->contract_storage_properties.begin()));
233
234 return p_luamodule;
235 }
236 /**
237 * load contract lua byte stream from thinkyoung api
238 */

Callers 1

handle_eventsMethod · 0.45

Calls 9

copyFunction · 0.50
back_inserterClass · 0.50
inserterFunction · 0.50
sizeMethod · 0.45
resizeMethod · 0.45
dataMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected