agent-backend/contracts/GasExample/GasExample.yjs

42 lines
784 B
Plaintext
Raw Normal View History

2021-09-26 04:49:24 +00:00
@LogType("Arg")
@Permission("CM")
contract GasExample{
event abcEvent;
@Cost({"countGas":true,"extraGas":"getExecTimes"})
export function pub(arg){
a =1+1;
b =2+2;
Global.tigger=new Date();
abcEvent(arg);
if(arg.length>10){
return "done!";
}
else{
return 11;
}
}
export function log(arg){
var data=new Date().getTime()-Global.tigger.getTime();
print(data);
for(var i=0;i<arg.length;i++){
if(arg.length<i*2){
print("smaller");
pub(arg);
}
else{
print("larger");
}
}
return data;
}
function onCreate(){
Global.tigger=new Date();
}
export function getExecTimes(arg) {
var times = CMUtil.getTimesOfExecution("GasExample");
return times;
}
}