备忘录模式
2017-03-20 13:29:16 0 举报
备忘录模式(Memento Pattern)是一种行为型设计模式,它通过在不破坏封装的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。这样,以后就可以将该对象恢复到原先保存的状态。这种模式适用于需要保存和恢复数据的场景,例如文本编辑器的撤销功能、游戏存档等。备忘录模式的主要优点是提供了一种可恢复的状态,使得用户可以方便地回到之前的操作状态,同时也支持实现多个版本的备忘录。
作者其他创作
大纲/内容
activate 激活游戏
getFastGap
getNameFee
keysRec
只有团队能激活,激活前必须有setOtherFomo
addMeToAllGames允许我玩所有游戏
JIincForwarderInterface
compressedIDs
getPlayerVaultsHelper
P3DAmount
SafeMath
Player
registerNameXIDFromDapp
eth计算多少key能换多少eth
compressedData
gen 常规收益
reLoadCore
mul 乘
startMigration
addGame注册游戏(关联游戏合约地址)
mask
keys 玩家此周期的key
ico
Round
eth如果大于0.1
onEndTx事件
team 此周期最新的投入团队id
TeamFee
isHuman 不让其他合约与此合约交互
getPlayerVaults获取玩家收益情况
keys
onReLoadAndDistribute
如果买的keys大于1
receivePlayerNameList
winnerName
getCurrentRoundInfo获取当前周期相关信息
registerNameXnameFromDapp
interface TeamJustInterface { function requiredSignatures() external view returns(uint256); function requiredDevSignatures() external view returns(uint256); function adminCount() external view returns(uint256); function devCount() external view returns(uint256); function adminName(address _who) external view returns(bytes32); function isAdmin(address _who) external view returns(bool); function isDev(address _who) external view returns(bool);}
deposit
strt 开始时间
继承
keys计算多少eth能换多少key
createMemento(){ // 创建备忘录 return new Memento(state)}
F3DexternalSettingsInterface外部配置合约地址 0x32967D6c142c2F38AB39235994e2DDF11c37d590
默认选择团队2买key
onNewName事件
potSwapFoMo3D short获取到的收益
updateTimer 每个key增加30s
withdrawEarnings获取赚取的常规收益并清空win gen aff
提现
判断周期是否结束
EventReturns
nameFilter校验名字合法性
potAmount
buyXname
eth 玩家投入此周期的eth
status
getFastExtra
PlayerBookInterface
getTimeLeft获取剩余时间
laff 邀请的最后一个人的id
接受直接打eth的方法
类
Memento(state){ this.state = state}
PlayerBookReceiverInterface
cancelMigration
Memento
show(){...}
iWantXKeys公共方法,keys换多少eth
addMeToGame允许我玩某游戏
onWithdrawAndDistribute
storeMemento(memento){ // 恢复备忘录 state = memento.state}
potSwap设置下周期奖金池为接受的eth数量、供合约调用
getPlayerName获取玩家名
onAffiliatePayout
Originator o = new Originator()o.state = 'on'o.show()// 创建备忘Memento m = o.createMemento()o.state = 'off'o.show()// 恢复备忘o.setMemento(m)o.show()
endRound 结束周期
verifyTeam 校验team
如果没有中奖空投更新周期总的keys和eth,更新玩家的keys和eth、外部分发eth(2%给社区、1%给FoMo3D、10%给推荐者、8%(3团队属性)给了p3d持有者、内部分发(1%给空投池、47%(3团队属性)分发常规收益、剩余的放入周期奖金池)
p3d
registerNameXaddrFromDapp
NameFilter
getLongExtra
getPlayerLAff获取某用户的最后邀请的人
checkIfNameValid检查名字是否可用
amountWon
addr 玩家地址
useMyOldName修改名字为以前用过的名字
getPlayerLAff
receivePlayerInfo
aff 邀请收益
pwr x的y次方
win 赢家收益
otherFoMo3D otherF3D_DiviesInterface Divies = DiviesInterface(0xc7029Ed9EBa97A096e72607f4340c34049C7AF48)JIincForwarderInterface Jekyll_Island_Inc = JIincForwarderInterface(0xdd4950F977EE28D2C132f1353D1595035Db444EE)PlayerBookInterface PlayerBook = PlayerBookInterface(0xD60d353610D9a5Ca478769D371b53CEfAA7B6E4c)F3DexternalSettingsInterface extSettings = F3DexternalSettingsInterface(0x32967D6c142c2F38AB39235994e2DDF11c37d590)// 游戏设置string name = \"FoMo3D Long Official\";string symbol = \"F3D\
sq 平方
gen
modularLong
onWithdraw
Originator
getPlayerAddr获取玩家地址
buyXid购买keys
mask 已经提现的收益
setOtherFomo设置fomo short的合约地址
gen 分配给key持有者的百分比
DiviesInterface
sqrt 平方根
setRegistrationFee设置注册费用
getPlayerName
初始化了4个玩家
setup
PotSplit赢的团队怎么分配最终的奖金池(第二次分红)
赢得的:资金池*48%
constructor
构造函数
getPlayerID获取玩家id
buyXaddr
isHuman
周期未结束
isActivated 确保合约没激活前不能被使用
F3Ddatasets
calcKeysReceived公共方法,eth换算多少keys
registerNameXID
接口
onBuyAndDistribute
注册用户且添加到所有游戏
genAmount
determinePID根据地址设置玩家id(递增)
getNameFee获取注册费用10 finney
FoMo3Dlong
airdrop随机决定是否空投
reLoadXname
withdraw
清算各方收益、p3d直接转账
add 加
finishMigration
plyr 此周期最新的投入者id
getBuyPrice一个key多少eth
calcUnMaskedEarnings计算可以提现的收益
newPot
isRegisteredGame 要求游戏id存在
reLoadXaddr
周期结束
设置全局变量为下一轮
PlayerBook
end 结束时间,投入触发增加
otherFoMo3D
name 玩家名
reLoadXid使用未提取的收益再次投入
佣金收益
getPlayerAddr
sub 减
如果是新用户,判断是否之前玩过
receivePlayerInfo receivePlayerNameList接受玩家信息(其他合约调用)
onlyDevs 限制只有开发者才能访问
determinePID根据地址设置玩家id
state
icoGen
备忘录模式,多用于撤销功能。当角色状态改变后发现无效,需要恢复。此时用备忘录模式
F3Devents
getPlayerID
iocAvg
eth 总共的eth
修饰器
core
F3DKeysCalcLong
onPotSwapDeposit
结束周期并提现
库
winnerAddr
buyCore检查是否周期被激活,是否应该结束周期
PlayerRounds
常规收益
updateGenVault将之前玩过的收益加到这个周期上
getLongGap
ended 周期是否已结束
周期总eth在100个之前,限制每个用户投入1个eth,多的放入常规收益中
0 条评论
下一页