* load contract lua byte stream from thinkyoung api */
| 237 | * load contract lua byte stream from thinkyoung api |
| 238 | */ |
| 239 | std::shared_ptr<GluaModuleByteStream> GluaChainApi::open_contract(lua_State *L, const char *name) |
| 240 | { |
| 241 | // FXIME |
| 242 | thinkyoung::lua::lib::increment_lvm_instructions_executed_count(L, CHAIN_GLUA_API_EACH_INSTRUCTIONS_COUNT - 1); |
| 243 | |
| 244 | thinkyoung::blockchain::TransactionEvaluationState* eval_state_ptr = |
| 245 | (thinkyoung::blockchain::TransactionEvaluationState*) |
| 246 | (thinkyoung::lua::lib::get_lua_state_value(L, "evaluate_state").pointer_value); |
| 247 | |
| 248 | if (!eval_state_ptr) |
| 249 | return NULL; |
| 250 | |
| 251 | thinkyoung::blockchain::ChainInterface* cur_state = eval_state_ptr->_current_state; |
| 252 | |
| 253 | oContractEntry entry = cur_state->get_contract_entry(std::string(name)); |
| 254 | if (entry.valid() && (entry->code.byte_code.size() <= LUA_MODULE_BYTE_STREAM_BUF_SIZE)) |
| 255 | { |
| 256 | return get_bytestream_from_code(L, entry->code); |
| 257 | } |
| 258 | |
| 259 | return NULL; |
| 260 | } |
| 261 | |
| 262 | std::shared_ptr<GluaModuleByteStream> GluaChainApi::open_contract_by_address(lua_State *L, const char *address) |
| 263 | { |
no test coverage detected