MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / ExWriteOutAppOperateFunc

Function ExWriteOutAppOperateFunc

src/vm/luavm/lmylib.cpp:1939–1971  ·  view source on GitHub ↗

* 写应用操作输出到 pVmRunEnv->mapAppFundOperate[0] * @param ipara * @param pVmEvn * @return */

Source from the content-addressed store, hash-verified

1937 * @return
1938 */
1939int32_t ExWriteOutAppOperateFunc(lua_State *L) {
1940 vector<std::shared_ptr<vector<uint8_t>>> retdata;
1941
1942 CAppFundOperate temp;
1943 uint32_t size = ::GetSerializeSize(temp, SER_NETWORK, PROTOCOL_VERSION);
1944
1945 if (!GetDataTableOutAppOperate(L, retdata) || retdata.size() != 1 || (retdata.at(0).get()->size() % size) != 0)
1946 return RetFalse("ExWriteOutAppOperateFunc para err1");
1947
1948 CLuaVMRunEnv* pVmRunEnv = GetVmRunEnv(L);
1949 if (nullptr == pVmRunEnv)
1950 return RetFalse("pVmRunEnv is nullptr");
1951
1952 int32_t count = retdata.at(0).get()->size() / size;
1953 CDataStream ss(*retdata.at(0), SER_DISK, CLIENT_VERSION);
1954 LUA_BurnAccountOperate(L, count, BURN_VER_R2);
1955
1956 int64_t step =-1;
1957 while (count--) {
1958 ss >> temp;
1959 // soft fork for contract negative money
1960 if (GetFeatureForkVersion(pVmRunEnv->GetConfirmHeight()) >= MAJOR_VER_R2 &&
1961 temp.mMoney < 0) // in case contract uses negative money input
1962 return RetFalse("ExWriteOutAppOperateFunc para err2");
1963
1964 pVmRunEnv->InsertOutAPPOperte(temp.GetAppUserV(),temp);
1965 step += size;
1966 }
1967
1968 /*
1969 * 每个函数里的Lua栈是私有的,当把返回值压入Lua栈以后,该栈会自动被清空*/
1970 return RetRstBooleanToLua(L, true);
1971}
1972
1973int32_t ExGetBase58AddrFunc(lua_State *L) {
1974 vector<std::shared_ptr<vector<uint8_t>>> retdata;

Callers

nothing calls this directly

Calls 12

GetSerializeSizeFunction · 0.85
RetFalseFunction · 0.85
GetVmRunEnvFunction · 0.85
GetFeatureForkVersionFunction · 0.85
RetRstBooleanToLuaFunction · 0.85
atMethod · 0.80
GetConfirmHeightMethod · 0.80
InsertOutAPPOperteMethod · 0.80
GetAppUserVMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected