当前位置:首页 > 资讯 > 区块链新闻 > 正文

qqqdfsdfsdf

发布:中币网   时间:2020-08-13 00:00:00   加入收藏 打赏

function rebase( uint256 epoch, uint256 indexDelta, bool positive ) external returns (uint256) { epoch; indexDelta; positive; delegateAndReturn(); } function rebase() public { // EOA only require(msg.sender == tx.origin); // ensure rebasing

function rebase(

uint256 epoch,

uint256 indexDelta,

bool positive

)

external

returns (uint256)

{

epoch; indexDelta; positive;

delegateAndReturn();

}


function rebase()

public

{

// EOA only

require(msg.sender == tx.origin);

// ensure rebasing at correct time

_inRebaseWindow();

// This comparison also ensures there is no reentrancy.

require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now);

// Snap the rebase time to the start of this window.

lastRebaseTimestampSec = now.sub(

now.mod(minRebaseTimeIntervalSec)).add(rebaseWindowOffsetSec);

epoch = epoch.add(1);

// get twap from uniswap v2;

uint256 exchangeRate = getTWAP();

// calculates % change to supply

(uint256 offPegPerc, bool positive) = computeOffPegPerc(exchangeRate);

uint256 indexDelta = offPegPerc;

// Apply the Dampening factor.

indexDelta = indexDelta.div(rebaseLag);

YAMTokenInterface yam = YAMTokenInterface(yamAddress);

if (positive) {

require(yam.yamsScalingFactor().mul(uint256(10**18).add(indexDelta)).div(10**18) < yam.maxScalingFactor(), "new scaling factor will be too big");

}

//SlowMist// 取当前 YAM 代币的供应量

uint256 currSupply = yam.totalSupply();

uint256 mintAmount;

// reduce indexDelta to account for minting

//SlowMist// 计算要调整的供应量

if (positive) {

uint256 mintPerc = indexDelta.mul(rebaseMintPerc).div(10**18);

indexDelta = indexDelta.sub(mintPerc);

mintAmount = currSupply.mul(mintPerc).div(10**18);

}

// rebase

//SlowMist// 调用 YAM 的rebase 逻辑

uint256 supplyAfterRebase = yam.rebase(epoch, indexDelta, positive);

assert(yam.yamsScalingFactor() <= yam.maxScalingFactor());

// perform actions after rebase

//SlowMist// 进入调整逻辑

afterRebase(mintAmount, offPegPerc);

}



来源:




来源:中币网  https://www.zhongbi.net/news/blocknews/230815.html
声明:登载此文仅出于分享区块链知识,并不意味着赞同其观点或证实其描述。文章内容仅供参考,不构成投资建议。投资者据此操作,风险自担。 此文如侵犯到您的合法权益,请联系我们3111859717@qq.com,我们将第一时间处理。