nftproxy&&register&&fix

This commit is contained in:
owen05
2021-04-04 01:05:08 +08:00
parent 8ce872f4de
commit da5e9dd8e3
12 changed files with 515 additions and 148 deletions

View File

@@ -7,17 +7,14 @@
pragma solidity 0.6.9;
import {SafeMath} from "../lib/SafeMath.sol";
import {SafeERC20} from "../lib/SafeERC20.sol";
import {DecimalMath} from "../lib/DecimalMath.sol";
import {IDVM} from "../DODOVendingMachine/intf/IDVM.sol";
import {IERC20} from "../intf/IERC20.sol";
import {InitializableERC20} from "../external/ERC20/InitializableERC20.sol";
interface ICollateralVault {
function directTransferOwnership(address newOwner) external;
}
import {SafeMath} from "../../lib/SafeMath.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {DecimalMath} from "../../lib/DecimalMath.sol";
import {IDVM} from "../../DODOVendingMachine/intf/IDVM.sol";
import {IDODOCallee} from "../../intf/IDODOCallee.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {InitializableERC20} from "../../external/ERC20/InitializableERC20.sol";
import {ICollateralVault} from "../../CollateralVault/intf/ICollateralVault.sol";
contract Fragment is InitializableERC20 {
using SafeMath for uint256;
@@ -105,11 +102,20 @@ contract Fragment is InitializableERC20 {
}
function redeem(address to) external {
function redeem(address to, bytes calldata data) external {
require(_IS_BUYOUT_, "DODOFragment: NEED_BUYOUT");
IERC20(_QUOTE_).safeTransfer(to, DecimalMath.mulFloor(_BUYOUT_PRICE_, balances[to]));
_clearBalance(to);
uint256 quoteAmount = DecimalMath.mulFloor(_BUYOUT_PRICE_, balances[msg.sender]);
IERC20(_QUOTE_).safeTransfer(to, quoteAmount);
_clearBalance(msg.sender);
if (data.length > 0) {
IDODOCallee(to).NFTRedeemCall(
msg.sender,
quoteAmount,
data
);
}
}
function getBuyoutRequirement() external view returns (uint256 requireQuote){

View File

@@ -0,0 +1,28 @@
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
interface IFragment {
function init(
address dvm,
address vaultPreOwner,
address collateralVault,
uint256 totalSupply,
uint256 ownerRatio,
uint256 buyoutTimestamp,
bool isOpenBuyout
) external;
function buyout(address newVaultOwner) external;
function redeem(address to) external;
function _QUOTE_() external view returns (address);
}