2021-02-08 15:18:32 +00:00
|
|
|
pragma solidity ^0.7.0;
|
|
|
|
|
|
|
|
import { Helpers } from "./helpers.sol";
|
|
|
|
import { Events } from "./events.sol";
|
|
|
|
|
|
|
|
abstract contract ChiResolver is Events, Helpers {
|
|
|
|
/**
|
|
|
|
* @dev Mint CHI token.
|
|
|
|
* @param amt token amount to mint.
|
|
|
|
*/
|
2021-03-15 17:22:47 +00:00
|
|
|
function mint(uint amt) public payable returns (string memory _eventName, bytes memory _eventParam) {
|
2021-02-08 15:18:32 +00:00
|
|
|
uint _amt = amt == uint(-1) ? 140 : amt;
|
|
|
|
require(_amt <= 140, "Max minting is 140 chi");
|
|
|
|
chi.mint(_amt);
|
2021-03-15 17:22:47 +00:00
|
|
|
|
|
|
|
_eventName = "LogMint(uint256)";
|
|
|
|
_eventParam = abi.encode(_amt);
|
2021-02-08 15:18:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev burn CHI token.
|
|
|
|
* @param amt token amount to burn.
|
|
|
|
*/
|
2021-03-15 17:22:47 +00:00
|
|
|
function burn(uint amt) public payable returns (string memory _eventName, bytes memory _eventParam) {
|
2021-02-08 15:18:32 +00:00
|
|
|
uint _amt = amt == uint(-1) ? chi.balanceOf(address(this)) : amt;
|
|
|
|
chi.approve(address(chi), _amt);
|
|
|
|
chi.free(_amt);
|
2021-03-15 17:22:47 +00:00
|
|
|
|
|
|
|
_eventName = "LogBurn(uint256)";
|
|
|
|
_eventParam = abi.encode(_amt);
|
2021-02-08 15:18:32 +00:00
|
|
|
}
|
|
|
|
}
|
2021-03-15 12:26:22 +00:00
|
|
|
contract ConnectV2CHI is ChiResolver {
|
2021-02-08 15:18:32 +00:00
|
|
|
string public name = "CHI-v1";
|
|
|
|
}
|