dapp/defi/ido/dao质押LP流动性挖矿分红系统开发(开发规则)丨案例源码
Liquidity mining is a process that allows cryptocurrency holders to obtain rewards by mortgaging or lending their cryptocurrency to decentralized finance(DeFi)protocols.In liquidity mining,users can earn additional cryptocurrency or tokens as rewards and contribute their digital assets to the liquidity pool to facilitate transactions on the DeFi platform.
DAPP是去中心化应用程序/分布式的应用程序,是底层区块链平台生态上衍生的各种分布式应用,也是区块链世界中的基础服务提供方。将应用程序分布在不同节点上,通过共识机制和区块链平台来完成任务的应用程序,它本身就是去中心化,不依赖于任何中心化服务器,促使用户交易更加安全。
广义来讲,开发详细唯:yy625019,区块链技术是利用块链式数据结构来验证与存储数据、利用分布式节点共识算法来生成和更新数据、利用密码学的方式保证数据传输和访问的安全、利用由自动化脚本代码组成的智能合约来编程和操作数据的一种全新的分布式基础架构与计算方式。
class DKT(Module):
def __init__(self,num_c,emb_size,dropout=0.1,emb_type='qid',emb_path="",pretrain_dim=768):
super().__init__()
self.model_name="dkt"
self.num_c=num_c
self.emb_size=emb_size
self.hidden_size=emb_size
self.emb_type=emb_type
if emb_type.startswith("qid"):
self.interaction_emb=Embedding(self.num_c*2,self.emb_size)
self.lstm_layer=LSTM(self.emb_size,self.hidden_size,batch_first=True)
self.dropout_layer=Dropout(dropout)
self.out_layer=Linear(self.hidden_size,self.num_c)
def forward(self,q,r):
#print(f"q.shape is{q.shape}")
emb_type=self.emb_type
if emb_type=="qid":
x=q+self.num_c*r
xemb=self.interaction_emb(x)
#print(f"xemb.shape is{xemb.shape}")
h,_=self.lstm_layer(xemb)
h=self.dropout_layer(h)
y=self.out_layer(h)
y=torch.sigmoid(y)
return y