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

Function ExGetBase58AddrFunc

src/vm/luavm/lmylib.cpp:1973–2009  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1971}
1972
1973int32_t ExGetBase58AddrFunc(lua_State *L) {
1974 vector<std::shared_ptr<vector<uint8_t>>> retdata;
1975
1976 if (!GetArray(L, retdata) || retdata.size() != 1 || retdata.at(0).get()->size() != 6)
1977 return RetFalse("ExGetBase58AddrFunc para err0");
1978
1979 CLuaVMRunEnv* pVmRunEnv = GetVmRunEnv(L);
1980 if (nullptr == pVmRunEnv)
1981 return RetFalse("pVmRunEnv is nullptr");
1982/*
1983 vector<uint8_t> recvKey;
1984 recvKey.assign(retdata.at(0).get()->begin(), retdata.at(0).get()->end());
1985
1986 std::string recvaddr( recvKey.begin(), recvKey.end() );
1987
1988 for(int32_t i = 0; i < recvKey.size(); i++)
1989 LogPrint(BCLog::LUAVM, "==============%02X\n", recvKey[i]);
1990
1991 vector<uint8_t> tmp;
1992 for(int32_t i = recvKey.size() - 1; i >=0; i--)
1993 tmp.push_back(recvKey[i]);
1994*/
1995
1996 LUA_BurnFuncCall(L, FUEL_CALL_GetBase58Addr, BURN_VER_R2);
1997 CKeyID addrKeyId;
1998 auto pAddr = retdata.at(0).get();
1999 if (!GetKeyId(pVmRunEnv, *pAddr, addrKeyId)) {
2000 string sAddr(pAddr->begin(), pAddr->end());
2001 return RetFalse(strprintf("ExGetBase58AddrFunc para (%s)", sAddr));
2002 }
2003
2004 string addr = addrKeyId.ToAddress();
2005
2006 vector<uint8_t> vTemp;
2007 vTemp.assign(addr.c_str(), addr.c_str() + addr.length());
2008 return RetRstToLua(L, vTemp);
2009}
2010
2011int32_t ExTransferContractAsset(lua_State *L) {
2012 vector<std::shared_ptr<vector<uint8_t>>> retdata;

Callers

nothing calls this directly

Calls 12

GetArrayFunction · 0.85
RetFalseFunction · 0.85
GetVmRunEnvFunction · 0.85
GetKeyIdFunction · 0.85
RetRstToLuaFunction · 0.85
atMethod · 0.80
ToAddressMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected