质押DAPP项目系统开发技术方案丨Defi质押挖矿系统开发技术方案

质押DAPP项目系统开发技术方案丨Defi质押挖矿系统开发技术方案

  目前DeFi的流动性挖矿,主要是发生在以太坊区块链上的产品,它通过为以太坊上DeFi产品提供流动性获得收益。简单来说,存入某些代币资产即可进行挖矿,之所以称为挖矿,也是沿用了比特币挖矿的行业说法。在Compound上进行流动性挖矿,主要是在上面进行存入代币或借出代币等操作,从而获得COMP治理代币的奖励。而COMP代币代表了Compound协议的治理权。  测试程序模板  func TestFunction(t*testing.T){  var tests=[]struct{//Test table  in string  out string  }{  {“in1”,“exp1”},  {“in2”,“exp2”},  {“in3”,“exp3”},  …  }  for i,tt:=range tests{  cache:=make([]uint32,tt.cacheSize/4)  generateCache(cache,tt.epoch,seedHash(tt.epoch*epochLength+1))  dataset:=make([]uint32,tt.datasetSize/4)  generateDataset(dataset,tt.epoch,cache)  want:=make([]uint32,tt.datasetSize/4)  prepare(want,tt.dataset)  if!reflect.DeepEqual(dataset,want){  t.Errorf("dataset%d:content mismatch:have%x,want%x",i,dataset,want)  }  }  }  测试单个函数  一个测试文件可能有多个测试函数,指定特定的测试函数运行:  go test-test.run TestXXX  1  TestXXX指的是测试函数名称,系统会自动匹配测试函数名称。如一个测试文件中有两个测试函数TestCheckSig和TestCheckSigSm2,那么执行测试命令:  $go test-test.run TestCheckSig-v  ===RUN TestCheckSig  —PASS:TestCheckSig(0.00s)  ===RUN TestCheckSigSm2  —PASS:TestCheckSigSm2(0.00s)  PASS  ok github.com/bytom/protocol/vm 0.014s  $go test-test.run TestCheckSigSm2-v  ===RUN TestCheckSigSm2  —PASS:TestCheckSigSm2(0.00s)  PASS  ok github.com/bytom/protocol/vm 0.013s

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注