1
0
forked from circlecloud/tera

feat: first commit

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-07-10 12:01:15 +08:00
commit cbc0ed72c4
134 changed files with 47644 additions and 0 deletions

61
src/system/dapp.ts Normal file
View File

@@ -0,0 +1,61 @@
/*
* @project: TERA
* @version: Development (beta)
* @license: MIT (not for evil)
* @copyright: Yuriy Ivanov (Vtools) 2017-2019 [progr76@gmail.com]
* Web: https://terafoundation.org
* Twitter: https://twitter.com/terafoundation
* Telegram: https://t.me/terafoundation
*/
"use strict";
import * as fs from 'fs'
class DApp {
constructor() {
}
Name() {
return "";
}
SendMessage(Body, ToAddr) {
global.SERVER.SendMessage(Body, ToAddr)
}
AddTransaction(Tr) {
global.SERVER.AddTransaction(Tr)
}
GetScriptTransaction(Body) {
return "";
}
GetVerifyTransaction(Block, BlockNum, TrNum, Body) {
return 1;
}
ClearDataBase() {
}
GetSenderNum(BlockNum, Body) {
return 0;
}
OnWriteBlockStart(Block) {
}
OnWriteBlockFinish(Block) {
}
OnDeleteBlock(Block) {
}
OnWriteTransaction(Block, Body, BlockNum, TrNum) {
}
OnMessage(Msg) {
}
};
module.exports = DApp;
function ReqDir(Path) {
if (fs.existsSync(Path)) {
var arr = fs.readdirSync(Path);
for (var i = 0; i < arr.length; i++) {
var name = arr[i];
global.ToLog("Reg: " + name);
var name2 = Path + "/" + arr[i];
require(name2);
}
}
};
global.DApps = {};
global.DAppByType = {};