The Treasury Contract determines the expansion and contraction status of the round and plays a central role like the central bank, such as the issuance of new KAI and redemption of bKAI.
[Main role]
Determination of expansion/contraction status according to the price of KAI provided by PriceOracle
Determination of airdrop ratio based on expansion/contraction/boost result
New issuance and distribution of KAI in the expanded state
bHolding and paying KAI for bKAI redemption
The following is the code to mint for additional KAI issuance in the expanded state.
Boardroom Contract acts like a general bank that manages sKAI deposit(Stake) and distributes KAI received from Treasury Contract to sKAI deposit users in the expanded state.
[Main role]
Stake sKAI
Distribution of additional minted KAI
Distributed minted vKAI
BBFund Contract - Buyback Fund
0x451033434Fb739a538DA0a77d3DcA23Bf0801255
A complementary device to KAI's $1 pegging algorithm through bKAI can stabilize the price by backing up KAI when the estimated price (TWAP) for the next round is less than $1. Depending on KAI distribution and the status of buyback funds, buyback KAI may be incinerated.
The creation of the buyback fund will be carried out through KAI and vKAI, and it will be converted into KUSDT and KDAI and accumulated.
[Main role]
KAI -> KUSDT or KAI -> KDAI exchange when KAI price is over $1
KUSDT -> KAI or KDAI -> KAI exchange when KAI price is less than $1
The Buyback Fund Contract does not have a transfer function and consists only of Sell, Buy, and Burn functions to maintain the KAI price.
function setKAIPriceToSell(uint256 _priceToSell) external onlyStrategist {
require(_priceToSell > 1.0 ether, "out of range"); // 1๋ถ์ ์ด๊ณผํด์ผ ๋งค๋ ๊ฐ๋ฅ
kaiPriceToSell = _priceToSell;
}
function setKAIPriceToBuy(uint256 _priceToBuy) external onlyStrategist {
require(_priceToBuy < 1.0 ether, "out of range"); // 1 ๋ถ ๋ฏธ๋ง์ผ ๋ ๋งค์ ๊ฐ๋ฅ
kaiPriceToBuy = _priceToBuy;
}
function forceSell(address _buyingToken, uint256 _amount) external onlyStrategist {
require(getKAIUpdatedPrice() >= kaiPriceToSell, "price is too low to sell");
_swapToken(kai, _buyingToken, _amount);
}
function forceBuy(address _sellingToken, uint256 _amount) external onlyStrategist {
require(getKAIUpdatedPrice() <= kaiPriceToBuy, "price is too high to buy");
_swapToken(_sellingToken, kai, _amount);
}
function _swapToken(address _inputToken, address _outputToken, uint256 _amount) internal {
if (_amount == 0) return;
uint256 _maxAmount = maxAmountToTrade[_inputToken];
if (_maxAmount > 0 && _maxAmount < _amount) {
_amount = _maxAmount;
}
address[] memory _path;
IERC20(_inputToken).safeIncreaseAllowance(address(klayswapFactory), _amount);
IKlayswapFactory(klayswapFactory).exchangeKctPos(_inputToken, _amount, _outputToken, 1, _path);
}