BasisCash and BasisDollar

Created Diff never expires
31 removals
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
53 lines
32 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
53 lines
pragma solidity ^0.6.0;
// SPDX-License-Identifier: MIT


import '@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol';
pragma solidity 0.6.12;
import './owner/Operator.sol';


contract Cash is ERC20Burnable, Operator {
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";

import "./owner/Operator.sol";

contract Dollar is ERC20Burnable, Operator {
uint256 public constant STABLES_POOL_REWARD_ALLOCATION = 500000 ether;

bool public rewardPoolDistributed = false;

/**
/**
* @notice Constructs the Basis Cash ERC-20 contract.
* @notice Constructs the Basis Dollar ERC-20 contract.
*/
*/
constructor() public ERC20('BAC', 'BAC') {
constructor() public ERC20("Basis Dollar", "BSD") {
// Mints 1 Basis Cash to contract creator for initial Uniswap oracle deployment.
// Mints 1 Basis Dollar to contract creator for initial pool setup
// Will be burned after oracle deployment
_mint(msg.sender, 1 ether);
_mint(msg.sender, 1 * 10**18);
}
}


// function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
// super._beforeTokenTransfer(from, to, amount);
// require(
// to != operator(),
// "basis.cash: operator as a recipient is not allowed"
// );
// }

/**
/**
* @notice Operator mints basis cash to a recipient
* @notice Operator mints basis dollar to a recipient
* @param recipient_ The address of recipient
* @param recipient_ The address of recipient
* @param amount_ The amount of basis cash to mint to
* @param amount_ The amount of basis dollar to mint to
* @return whether the process has been done
* @return whether the process has been done
*/
*/
function mint(address recipient_, uint256 amount_)
function mint(address recipient_, uint256 amount_) public onlyOperator returns (bool) {
public
onlyOperator
returns (bool)
{
uint256 balanceBefore = balanceOf(recipient_);
uint256 balanceBefore = balanceOf(recipient_);
_mint(recipient_, amount_);
_mint(recipient_, amount_);
uint256 balanceAfter = balanceOf(recipient_);
uint256 balanceAfter = balanceOf(recipient_);


return balanceAfter > balanceBefore;
return balanceAfter > balanceBefore;
}
}


function burn(uint256 amount) public override onlyOperator {
function burn(uint256 amount) public override onlyOperator {
super.burn(amount);
super.burn(amount);
}
}


function burnFrom(address account, uint256 amount)
function burnFrom(address account, uint256 amount) public override onlyOperator {
public
override
onlyOperator
{
super.burnFrom(account, amount);
super.burnFrom(account, amount);
}
}

/**
* @notice distribute to reward pool (only once)
*/
function distributeReward(address _stablesPool) external onlyOperator {
require(!rewardPoolDistributed, "only can distribute once");
require(_stablesPool != address(0), "!_stablesPool");
rewardPoolDistributed = true;
_mint(_stablesPool, STABLES_POOL_REWARD_ALLOCATION);
}
}
}