fix syntax
This commit is contained in:
@@ -9,15 +9,16 @@ pragma solidity 0.6.9;
|
||||
|
||||
import {SafeMath} from "../lib/SafeMath.sol";
|
||||
import {SafeERC20} from "../lib/SafeERC20.sol";
|
||||
import {DecimalMath} from "../../lib/DecimalMath.sol";
|
||||
import {DecimalMath} from "../lib/DecimalMath.sol";
|
||||
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
|
||||
import {IDVM} from "../DODOVendingMachine/intf/IDVM.sol";
|
||||
import {ICloneFactory} from "../lib/CloneFactory.sol";
|
||||
import {IERC20} from "../intf/IERC20.sol";
|
||||
import {InitializableMintableERC20} from "../external/ERC20/InitializableMintableERC20.sol";
|
||||
|
||||
contract Fragment is InitializableMintableERC20 {
|
||||
using SafeMath for uint256;
|
||||
using SafeTransfer for IERC20;
|
||||
using SafeERC20 for IERC20;
|
||||
|
||||
uint256 _BUYOUT_TIMESTAMP_;
|
||||
|
||||
@@ -39,12 +40,12 @@ contract Fragment is InitializableMintableERC20 {
|
||||
initOwner(owner);
|
||||
_DVM_ = dvm;
|
||||
_COLLATERAL_VAULT_ = collateralVault;
|
||||
_QUOTE_ = IDVM(DVM)._QUOTE_TOKEN_();
|
||||
_QUOTE_ = IDVM(_DVM_)._QUOTE_TOKEN_();
|
||||
_BUYOUT_TIMESTAMP_ = buyoutTimestamp;
|
||||
|
||||
// init FRAG meta data
|
||||
string memory suffix = "FRAG_";
|
||||
name = string(abi.encodePacked(suffix, IDVM(_DVM_).addressToShortString(_COLLATERAL_VAULT_));
|
||||
name = string(abi.encodePacked(suffix, IDVM(_DVM_).addressToShortString(_COLLATERAL_VAULT_)));
|
||||
symbol = "FRAG";
|
||||
decimals = 18;
|
||||
|
||||
@@ -56,7 +57,8 @@ contract Fragment is InitializableMintableERC20 {
|
||||
emit Transfer(address(0), dvm, balances[dvm]);
|
||||
|
||||
// init DVM liquidity
|
||||
IDVM(DVM).buyShares(address(this));
|
||||
//TODO?: transfer FRAG to DVM
|
||||
IDVM(_DVM_).buyShares(address(this));
|
||||
}
|
||||
|
||||
function buyout() external {
|
||||
@@ -75,20 +77,21 @@ contract Fragment is InitializableMintableERC20 {
|
||||
uint256(-1)
|
||||
);
|
||||
|
||||
uint256 ownerQuote = DecimalMath.mulFloor(_BUYOUT_PRICE_, balances[address(this)])
|
||||
uint256 ownerQuote = DecimalMath.mulFloor(_BUYOUT_PRICE_, balances[address(this)]);
|
||||
_clearSelfBalance();
|
||||
|
||||
IERC20(_QUOTE_).safeTransfer(ownerQuote, _OWNER_);
|
||||
IERC20(_QUOTE_).safeTransfer(_OWNER_, ownerQuote);
|
||||
}
|
||||
|
||||
// buyout之后的恒定兑换
|
||||
function redeem(address to) external {
|
||||
require(_IS_BUYOUT_, "NEED BUYOUT");
|
||||
IERC20(_QUOTE_).safeTransfer(DecimalMath.mulFloor(_BUYOUT_PRICE_, balances[address(this)]), to);
|
||||
//TODO? amount
|
||||
IERC20(_QUOTE_).safeTransfer(to, DecimalMath.mulFloor(_BUYOUT_PRICE_, balances[address(this)]));
|
||||
_clearSelfBalance();
|
||||
}
|
||||
|
||||
function getBuyoutRequirement() view return (uint256 requireQuote){
|
||||
function getBuyoutRequirement() external view returns (uint256 requireQuote){
|
||||
require(!_IS_BUYOUT_, "ALREADY BUYOUT");
|
||||
uint256 price = IDVM(_DVM_).getMidPrice();
|
||||
requireQuote = DecimalMath.mulCeil(price, totalSupply);
|
||||
|
||||
Reference in New Issue
Block a user