...run?during?commit?stages????uint?playerIndex;????if(stage?==?Stage.FirstCommit)?playerIndex?=?0;????else?if(stage?==?Stage.SecondCommit)?playerIndex?=?1;????else?revert("both?players?have?already?played");?????uint?commitAmount?=?bet?+?deposit;????require(commitAmount?>=?bet,?"overflow?error");????require(msg.value?>=?commitAmount,?"value?must?be?greater?than?commit?amount");?????//?Return?additio...
知识:以太坊,合约,区块链技术,公共区块链
...tio"] == 0: Log(symbolDetail) raise Exception("合约信息异常") else : Log("合约", symbolDetail["InstrumentName"], "一手", symbolDetail["VolumeMultiple"], "份,最大下单量", symbolDetail["MaxLimitOrderVolume"], "保证金率:", _N(symbolDetail["LongMarginRatio"]), _N(symbolDetail["ShortMarginRatio"]), "交割日期", symbolDetail["StartDe...
知识:交易策略,期货,量化交易
...le {// Only run during commit stagesuint playerIndex;if(stage == Stage.FirstCommit) playerIndex = 0;else if(stage == Stage.SecondCommit) playerIndex = 1;else revert("both players have already played");uint commitAmount = bet + deposit;require(commitAmount >= bet, "overflow error");require(msg.value >= commitAmount, "value must be greater than commit amount");// Return additional funds transf...
知识:COMMITMENT SCHEMES,以太坊,火星号精选,火
...client,?err?:=?client.Connect("http://10.0.0.42:8546");?err?!=?n?il?{fmt.Printf(err.Error())return}?else?{if?privKey,?err?:=?crypto.HexToECDSA("9ee905a8b9afcdc23a33d6f2d?a3cdae63a0e873bf24f27b99e97f6acc034af9a");?err?!=?nil?{fmt.Printf(err.Error())return}?else?{nodeID?:=?discover.PubkeyID(&privKey.PublicKey)fmt.Printf("nodeID:%s?\n",?nodeID.String())from?:=?crypto.PubkeyToAddress(privKey.Publi...
知识:共识,节点,账户,金额
...。block指令必须以end指令(操作码0x0B)结尾。由于end指令和后面将要介绍的else指令(操作码0x05)只起到标记作用,没有任何执行效果,所以没有把这两条指令计入控制指令。Wasm1.0规范规定block指令的结果不能超过一个,所以rt可以用一个字节表示:0x40表示没有结果、0x7F表示i32类型、0x7E表示i64类型、0x7...
知识:控制指令,WASM
...ore DAG$route = $newaddress; // ROUTE TO NEW ADDRESS// actual ownership transfer done in app state} else {bounce( 'Trigger address does not match with var[ authors ] in ' || $currentaddress || ' which is require to make newaddress transfer' );}} else {$route = $currentaddress; // ROUTE TO LATEST ADDRESS}}else{$route = $checkaddress; // registration will be done at app state , ROUTE TO CHECK ADRESS...
知识:想法,我认为,功能,结构
...环中采用python三目运算计算TrendUpTrendUp = MAX(Up,TrendUp[-1]) if close[-1]>TrendUp[-1] else Up大致意思是 如果 上一个close>上一个TrendUp,成立取Up和上一个TrendUp当中最大的值,不成立取Up值,并传递给当前TrendUp同理,计算TrendDownTrendDown=min(Dn,TrendDown[-1]) if close[-1]<TrendDown[-1] else Dn大致意思是 如果 上一个close<上一...
知识:合约,代码,趋势,算法
...sed = isDefined(getString(this, gameId))if (betNotInWaves)then throw ("Bet amount must be in Waves")else if (feeNotInWaves)then throw ("Transaction's fee must be in Waves")else if (txIdUsed)then throw ("Passed txId had been used before. Game aborted.")else {let playerPubKey58 = toBase58String(i.callerPublicKey)let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height...
知识:智能合约,公钥,私钥,区块
...(!positive) { yamsScalingFactor = yamsScalingFactor.mul(BASE.sub(indexDelta)).div(BASE); } else { uint256 newScalingFactor = yamsScalingFactor.mul(BASE.add(indexDelta)).div(BASE); if (newScalingFactor < _maxScalingFactor()) { yamsScalingFactor = newScalingFactor; } else { yamsScalingFactor = _maxScalingFactor(); } } //SlowMist// 问题代码 ...
知识:合约,代币,函数,代码
...ncoin/commit/d23f862a6afc17092ae31b67d96bc2738fe917d2感兴趣可以去瞅瞅简单说在代码里ifelse语句是成对出现的。看下面问题代码,第一个红框if后面跟的是条件,满足即执行,否则跳到else里,此时else也就是第二个红框,也有个if,但是在这个if{}里明显少了个else,这样逻辑就有了漏洞。接下来的操作大家都明白,攻...
知识:代币,币安,市值,代码
...) { yamsScalingFactor = yamsScalingFactor.mul(BASE.sub(indexDelta)).div(BASE); } else { uint256 newScalingFactor = yamsScalingFactor.mul(BASE.add(indexDelta)).div(BASE); if (newScalingFactor <_maxScalingFactor()) { yamsScalingFactor = newScalingFactor; } else { yamsScalingFactor =_maxScalingFactor(); ...
知识:以太坊,安全,智能合约,DeFi,流动性挖矿,YAM
...ker) var needOpen = opAmount; if (isFirst) { isFirst = false; } else { nowPosition = GetPosition(e, contractType, direction); if (nowPosition) { needOpen = opAmount - (nowPosition.Amount - initAmount); } // 检测directBreak 并且持仓未变的情况 if (preNeedOpen == needOpen &&a...
知识:数字货币,期货,量化交易
... = vaults[vaultOwner]; if (oTokensToExercise == 0) { return; } else if (vault.oTokensIssued >= oTokensToExercise) { _exercise(oTokensToExercise, vaultOwner); return; } else { oTokensToExercise = oTokensToExercise.sub(vault.oTokensIssued); _exercise(vault.oTokensIssued, vaultOwner); ...
知识:合约,合约地址,函数,攻击者
...vaults[vaultOwner]; if (oTokensToExercise == 0) { return; } else if (vault.oTokensIssued >= oTokensToExercise) { _exercise(oTokensToExercise, vaultOwner); return; } else { oTokensToExercise = oTokensToExercise.sub(vault.oTokensIssued); _exercise(vault.oTokensIssued, vaultOwner); ...
知识:安全,智能合约,DeFi,Opyn,期权
...多单 position = i['Amount'] # 赋值持仓数量为正数 else: position = -i['Amount'] # 赋值持仓数量为负数 return position # 返回持仓量因为在这个策略中,只使用了实时的持仓数量,为了方便维护,这里使用get_position封装了持仓量,如果当前持有多单就返回正数,如果当...
知识:交易策略,期货,量化交易