编译器
0.8.20+commit.a1b79de6
文件 1 的 9:ERC20.sol
pragma solidity ^0.8.0;
import "../interface/IERC20.sol";
import "../interface/IERC677Receiver.sol";
abstract contract ERC20 is IERC20 {
mapping(address account => uint256 balance) private _balances;
mapping(address account => mapping(address spender => uint256 allowance)) private _allowances;
uint256 internal constant INFINITY = (1 << 255);
uint256 private _totalSupply;
uint8 public immutable override decimals;
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
constructor(uint8 _decimals) {
decimals = _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowance(owner, spender);
}
function _allowance(address owner, address spender) internal view virtual returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 value) external override returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_transfer(sender, recipient, amount);
_useAllowance(sender, msg.sender, amount);
return true;
}
function _useAllowance(address owner, address spender, uint256 amount) internal {
uint256 currentAllowance = _allowance(owner, spender);
if (currentAllowance < INFINITY) {
if (currentAllowance < amount) revert ERC20InsufficientAllowance(owner, currentAllowance, amount);
_approve(owner, spender, currentAllowance - amount);
}
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(recipient != address(0));
_beforeTokenTransfer(sender, recipient, amount);
if (_balances[sender] < amount) revert ERC20InsufficientBalance(sender, _balances[sender], amount);
_balances[sender] -= amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
function _mint(address recipient, uint256 amount) internal virtual {
require(recipient != address(0));
_beforeTokenTransfer(address(0), recipient, amount);
_totalSupply += amount;
_balances[recipient] += amount;
emit Transfer(address(0), recipient, amount);
}
function _burn(address account, uint256 amount) internal virtual {
_beforeTokenTransfer(account, address(0), amount);
_totalSupply -= amount;
_balances[account] -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 value) internal {
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}
文件 2 的 9:ERC20PermitLight.sol
pragma solidity ^0.8.0;
import "./ERC20.sol";
abstract contract ERC20PermitLight is ERC20 {
mapping(address account => uint256 nonce) public nonces;
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");
unchecked {
address recoveredAddress = ecrecover(
keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
bytes32(0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9),
owner,
spender,
value,
nonces[owner]++,
deadline
)
)
)
),
v,
r,
s
);
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");
_approve(recoveredAddress, spender, value);
}
}
function DOMAIN_SEPARATOR() public view returns (bytes32) {
return
keccak256(
abi.encode(
bytes32(0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218),
block.chainid,
address(this)
)
);
}
}
文件 3 的 9:Equity.sol
pragma solidity ^0.8.0;
import "./Frankencoin.sol";
import "./utils/MathUtil.sol";
import "./interface/IReserve.sol";
import "./interface/IERC677Receiver.sol";
contract Equity is ERC20PermitLight, MathUtil, IReserve {
uint32 public constant VALUATION_FACTOR = 3;
uint256 private constant MINIMUM_EQUITY = 1000 * ONE_DEC18;
uint32 private constant QUORUM = 200;
uint8 private constant TIME_RESOLUTION_BITS = 20;
uint256 public constant MIN_HOLDING_DURATION = 90 days << TIME_RESOLUTION_BITS;
Frankencoin public immutable zchf;
uint192 private totalVotesAtAnchor;
uint64 private totalVotesAnchorTime;
mapping(address owner => address delegate) public delegates;
mapping(address owner => uint64 timestamp) private voteAnchor;
event Delegation(address indexed from, address indexed to);
event Trade(address who, int amount, uint totPrice, uint newprice);
constructor(Frankencoin zchf_) ERC20(18) {
zchf = zchf_;
}
function name() external pure override returns (string memory) {
return "Frankencoin Pool Share";
}
function symbol() external pure override returns (string memory) {
return "FPS";
}
function price() public view returns (uint256) {
uint256 equity = zchf.equity();
if (equity == 0 || totalSupply() == 0) {
return ONE_DEC18;
} else {
return (VALUATION_FACTOR * zchf.equity() * ONE_DEC18) / totalSupply();
}
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override {
super._beforeTokenTransfer(from, to, amount);
if (amount > 0) {
uint256 roundingLoss = _adjustRecipientVoteAnchor(to, amount);
_adjustTotalVotes(from, amount, roundingLoss);
}
}
function canRedeem(address owner) public view returns (bool) {
return _anchorTime() - voteAnchor[owner] >= MIN_HOLDING_DURATION;
}
function _adjustTotalVotes(address from, uint256 amount, uint256 roundingLoss) internal {
uint64 time = _anchorTime();
uint256 lostVotes = from == address(0x0) ? 0 : (time - voteAnchor[from]) * amount;
totalVotesAtAnchor = uint192(totalVotes() - roundingLoss - lostVotes);
totalVotesAnchorTime = time;
}
function _adjustRecipientVoteAnchor(address to, uint256 amount) internal returns (uint256) {
if (to != address(0x0)) {
uint256 recipientVotes = votes(to);
uint256 newbalance = balanceOf(to) + amount;
voteAnchor[to] = uint64(_anchorTime() - recipientVotes / newbalance);
return recipientVotes % newbalance;
} else {
return 0;
}
}
function _anchorTime() internal view returns (uint64) {
return uint64(block.timestamp << TIME_RESOLUTION_BITS);
}
function relativeVotes(address holder) external view returns (uint256) {
return (ONE_DEC18 * votes(holder)) / totalVotes();
}
function votes(address holder) public view returns (uint256) {
return balanceOf(holder) * (_anchorTime() - voteAnchor[holder]);
}
function holdingDuration(address holder) public view returns (uint256) {
return (_anchorTime() - voteAnchor[holder]) >> TIME_RESOLUTION_BITS;
}
function totalVotes() public view returns (uint256) {
return totalVotesAtAnchor + totalSupply() * (_anchorTime() - totalVotesAnchorTime);
}
function votesDelegated(address sender, address[] calldata helpers) public view returns (uint256) {
uint256 _votes = votes(sender);
require(_checkDuplicatesAndSorted(helpers));
for (uint i = 0; i < helpers.length; i++) {
address current = helpers[i];
require(current != sender);
require(_canVoteFor(sender, current));
_votes += votes(current);
}
return _votes;
}
function _checkDuplicatesAndSorted(address[] calldata helpers) internal pure returns (bool ok) {
if (helpers.length <= 1) {
return true;
} else {
address prevAddress = helpers[0];
for (uint i = 1; i < helpers.length; i++) {
if (helpers[i] <= prevAddress) {
return false;
}
prevAddress = helpers[i];
}
return true;
}
}
function checkQualified(address sender, address[] calldata helpers) public view override {
uint256 _votes = votesDelegated(sender, helpers);
if (_votes * 10000 < QUORUM * totalVotes()) revert NotQualified();
}
error NotQualified();
function delegateVoteTo(address delegate) external {
delegates[msg.sender] = delegate;
emit Delegation(msg.sender, delegate);
}
function _canVoteFor(address delegate, address owner) internal view returns (bool) {
if (owner == delegate) {
return true;
} else if (owner == address(0x0)) {
return false;
} else {
return _canVoteFor(delegate, delegates[owner]);
}
}
function kamikaze(address[] calldata targets, uint256 votesToDestroy) external {
uint256 budget = _reduceVotes(msg.sender, votesToDestroy);
uint256 destroyedVotes = 0;
for (uint256 i = 0; i < targets.length && destroyedVotes < budget; i++) {
destroyedVotes += _reduceVotes(targets[i], budget - destroyedVotes);
}
require(destroyedVotes > 0);
totalVotesAtAnchor = uint192(totalVotes() - destroyedVotes - budget);
totalVotesAnchorTime = _anchorTime();
}
function _reduceVotes(address target, uint256 amount) internal returns (uint256) {
uint256 votesBefore = votes(target);
if (amount >= votesBefore) {
amount = votesBefore;
voteAnchor[target] = _anchorTime();
return votesBefore;
} else {
voteAnchor[target] = uint64(_anchorTime() - (votesBefore - amount) / balanceOf(target));
return votesBefore - votes(target);
}
}
function invest(uint256 amount, uint256 expectedShares) external returns (uint256) {
zchf.transferFrom(msg.sender, address(this), amount);
uint256 equity = zchf.equity();
require(equity >= MINIMUM_EQUITY, "insuf equity");
uint256 shares = _calculateShares(equity <= amount ? 0 : equity - amount, amount);
require(shares >= expectedShares);
_mint(msg.sender, shares);
emit Trade(msg.sender, int(shares), amount, price());
require(totalSupply() <= type(uint96).max, "total supply exceeded");
return shares;
}
function calculateShares(uint256 investment) external view returns (uint256) {
return _calculateShares(zchf.equity(), investment);
}
function _calculateShares(uint256 capitalBefore, uint256 investment) internal view returns (uint256) {
uint256 totalShares = totalSupply();
uint256 investmentExFees = (investment * 997) / 1000;
uint256 newTotalShares = capitalBefore < MINIMUM_EQUITY || totalShares == 0
? totalShares + 1000 * ONE_DEC18
: _mulD18(totalShares, _cubicRoot(_divD18(capitalBefore + investmentExFees, capitalBefore)));
return newTotalShares - totalShares;
}
function redeem(address target, uint256 shares) external returns (uint256) {
return _redeemFrom(msg.sender, target, shares);
}
function redeemExpected(address target, uint256 shares, uint256 expectedProceeds) external returns (uint256) {
uint256 proceeds = _redeemFrom(msg.sender, target, shares);
require(proceeds >= expectedProceeds);
return proceeds;
}
function redeemFrom(
address owner,
address target,
uint256 shares,
uint256 expectedProceeds
) external returns (uint256) {
_useAllowance(owner, msg.sender, shares);
uint256 proceeds = _redeemFrom(owner, target, shares);
require(proceeds >= expectedProceeds);
return proceeds;
}
function _redeemFrom(address owner, address target, uint256 shares) internal returns (uint256) {
require(canRedeem(owner));
uint256 proceeds = calculateProceeds(shares);
_burn(owner, shares);
zchf.transfer(target, proceeds);
emit Trade(owner, -int(shares), proceeds, price());
return proceeds;
}
function calculateProceeds(uint256 shares) public view returns (uint256) {
uint256 totalShares = totalSupply();
require(shares + ONE_DEC18 < totalShares, "too many shares");
uint256 capital = zchf.equity();
uint256 reductionAfterFees = (shares * 997) / 1000;
uint256 newCapital = _mulD18(capital, _power3(_divD18(totalShares - reductionAfterFees, totalShares)));
return capital - newCapital;
}
function restructureCapTable(address[] calldata helpers, address[] calldata addressesToWipe) external {
require(zchf.equity() < MINIMUM_EQUITY);
checkQualified(msg.sender, helpers);
for (uint256 i = 0; i < addressesToWipe.length; i++) {
address current = addressesToWipe[i];
_burn(current, balanceOf(current));
}
}
}
文件 4 的 9:Frankencoin.sol
pragma solidity ^0.8.0;
import "./utils/ERC20PermitLight.sol";
import "./Equity.sol";
import "./interface/IReserve.sol";
import "./interface/IFrankencoin.sol";
contract Frankencoin is ERC20PermitLight, IFrankencoin {
uint256 public constant MIN_FEE = 1000 * (10 ** 18);
uint256 public immutable MIN_APPLICATION_PERIOD;
IReserve public immutable override reserve;
uint256 private minterReserveE6;
mapping(address minter => uint256 validityStart) public minters;
mapping(address position => address registeringMinter) public positions;
event MinterApplied(address indexed minter, uint256 applicationPeriod, uint256 applicationFee, string message);
event MinterDenied(address indexed minter, string message);
event Loss(address indexed reportingMinter, uint256 amount);
event Profit(address indexed reportingMinter, uint256 amount);
error PeriodTooShort();
error FeeTooLow();
error AlreadyRegistered();
error NotMinter();
error TooLate();
modifier minterOnly() {
if (!isMinter(msg.sender) && !isMinter(positions[msg.sender])) revert NotMinter();
_;
}
constructor(uint256 _minApplicationPeriod) ERC20(18) {
MIN_APPLICATION_PERIOD = _minApplicationPeriod;
reserve = new Equity(this);
}
function name() external pure override returns (string memory) {
return "Frankencoin";
}
function symbol() external pure override returns (string memory) {
return "ZCHF";
}
function initialize(address _minter, string calldata _message) external {
require(totalSupply() == 0 && reserve.totalSupply() == 0);
minters[_minter] = block.timestamp;
emit MinterApplied(_minter, 0, 0, _message);
}
function suggestMinter(
address _minter,
uint256 _applicationPeriod,
uint256 _applicationFee,
string calldata _message
) external override {
if (_applicationPeriod < MIN_APPLICATION_PERIOD) revert PeriodTooShort();
if (_applicationFee < MIN_FEE) revert FeeTooLow();
if (minters[_minter] != 0) revert AlreadyRegistered();
_collectProfits(address(this), msg.sender, _applicationFee);
minters[_minter] = block.timestamp + _applicationPeriod;
emit MinterApplied(_minter, _applicationPeriod, _applicationFee, _message);
}
function _allowance(address owner, address spender) internal view override returns (uint256) {
uint256 explicit = super._allowance(owner, spender);
if (explicit > 0) {
return explicit;
} else if (isMinter(spender) || isMinter(getPositionParent(spender)) || spender == address(reserve)) {
return INFINITY;
} else {
return 0;
}
}
function minterReserve() public view returns (uint256) {
return minterReserveE6 / 1000000;
}
function registerPosition(address _position) external override {
if (!isMinter(msg.sender)) revert NotMinter();
positions[_position] = msg.sender;
}
function equity() public view returns (uint256) {
uint256 balance = balanceOf(address(reserve));
uint256 minReserve = minterReserve();
if (balance <= minReserve) {
return 0;
} else {
return balance - minReserve;
}
}
function denyMinter(address _minter, address[] calldata _helpers, string calldata _message) external override {
if (block.timestamp > minters[_minter]) revert TooLate();
reserve.checkQualified(msg.sender, _helpers);
delete minters[_minter];
emit MinterDenied(_minter, _message);
}
function mintWithReserve(
address _target,
uint256 _amount,
uint32 _reservePPM,
uint32 _feesPPM
) external override minterOnly {
uint256 usableMint = (_amount * (1000_000 - _feesPPM - _reservePPM)) / 1000_000;
_mint(_target, usableMint);
_mint(address(reserve), _amount - usableMint);
minterReserveE6 += _amount * _reservePPM;
emit Profit(msg.sender, (_feesPPM * _amount) / 1000_000);
}
function mint(address _target, uint256 _amount) external override minterOnly {
_mint(_target, _amount);
}
function burn(uint256 _amount) external {
_burn(msg.sender, _amount);
}
function burnFrom(address _owner, uint256 _amount) external override minterOnly {
_burn(_owner, _amount);
}
function burnWithoutReserve(uint256 amount, uint32 reservePPM) public override minterOnly {
_burn(msg.sender, amount);
uint256 reserveReduction = amount * reservePPM;
if (reserveReduction > minterReserveE6) {
emit Profit(msg.sender, minterReserveE6 / 1000_000);
minterReserveE6 = 0;
} else {
minterReserveE6 -= reserveReduction;
emit Profit(msg.sender, reserveReduction / 1000_000);
}
}
function burnWithReserve(
uint256 _amountExcludingReserve,
uint32 _reservePPM
) external override minterOnly returns (uint256) {
uint256 freedAmount = calculateFreedAmount(_amountExcludingReserve, _reservePPM);
minterReserveE6 -= freedAmount * _reservePPM;
_transfer(address(reserve), msg.sender, freedAmount - _amountExcludingReserve);
_burn(msg.sender, freedAmount);
return freedAmount;
}
function burnFromWithReserve(
address payer,
uint256 targetTotalBurnAmount,
uint32 reservePPM
) external override minterOnly returns (uint256) {
uint256 assigned = calculateAssignedReserve(targetTotalBurnAmount, reservePPM);
_transfer(address(reserve), payer, assigned);
_burn(payer, targetTotalBurnAmount);
minterReserveE6 -= targetTotalBurnAmount * reservePPM;
return assigned;
}
function calculateAssignedReserve(uint256 mintedAmount, uint32 _reservePPM) public view returns (uint256) {
uint256 theoreticalReserve = (_reservePPM * mintedAmount) / 1000000;
uint256 currentReserve = balanceOf(address(reserve));
uint256 minterReserve_ = minterReserve();
if (currentReserve < minterReserve_) {
return (theoreticalReserve * currentReserve) / minterReserve_;
} else {
return theoreticalReserve;
}
}
function calculateFreedAmount(
uint256 amountExcludingReserve ,
uint32 reservePPM
) public view returns (uint256) {
uint256 currentReserve = balanceOf(address(reserve));
uint256 minterReserve_ = minterReserve();
uint256 adjustedReservePPM = currentReserve < minterReserve_
? (reservePPM * currentReserve) / minterReserve_
: reservePPM;
return (1000000 * amountExcludingReserve) / (1000000 - adjustedReservePPM);
}
function coverLoss(address source, uint256 _amount) external override minterOnly {
uint256 reserveLeft = balanceOf(address(reserve));
if (reserveLeft >= _amount) {
_transfer(address(reserve), source, _amount);
} else {
_transfer(address(reserve), source, reserveLeft);
_mint(source, _amount - reserveLeft);
}
emit Loss(source, _amount);
}
function collectProfits(address source, uint256 _amount) external override minterOnly {
_collectProfits(msg.sender, source, _amount);
}
function _collectProfits(address minter, address source, uint256 _amount) internal {
_transfer(source, address(reserve), _amount);
emit Profit(minter, _amount);
}
function isMinter(address _minter) public view override returns (bool) {
return minters[_minter] != 0 && block.timestamp >= minters[_minter];
}
function getPositionParent(address _position) public view override returns (address) {
return positions[_position];
}
}
文件 5 的 9:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
文件 6 的 9:IERC677Receiver.sol
pragma solidity ^0.8.0;
interface IERC677Receiver {
function onTokenTransfer(address from, uint256 amount, bytes calldata data) external returns (bool);
}
文件 7 的 9:IFrankencoin.sol
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./IReserve.sol";
interface IFrankencoin is IERC20 {
function suggestMinter(address _minter, uint256 _applicationPeriod, uint256 _applicationFee, string calldata _message) external;
function registerPosition(address position) external;
function denyMinter(address minter, address[] calldata helpers, string calldata message) external;
function reserve() external view returns (IReserve);
function minterReserve() external view returns (uint256);
function calculateAssignedReserve(uint256 mintedAmount, uint32 _reservePPM) external view returns (uint256);
function equity() external view returns (uint256);
function isMinter(address minter) external view returns (bool);
function getPositionParent(address position) external view returns (address);
function mint(address target, uint256 amount) external;
function mintWithReserve(address target, uint256 amount, uint32 reservePPM, uint32 feePPM) external;
function burnFrom(address target, uint256 amount) external;
function burnWithoutReserve(uint256 amountIncludingReserve, uint32 reservePPM) external;
function burnFromWithReserve(address payer, uint256 targetTotalBurnAmount, uint32 _reservePPM) external returns (uint256);
function burnWithReserve(uint256 amountExcludingReserve, uint32 reservePPM) external returns (uint256);
function coverLoss(address source, uint256 amount) external;
function collectProfits(address source, uint256 _amount) external;
}
文件 8 的 9:IReserve.sol
pragma solidity ^0.8.0;
import "./IERC20.sol";
interface IReserve is IERC20 {
function invest(uint256 amount, uint256 expected) external returns (uint256);
function checkQualified(address sender, address[] calldata helpers) external view;
}
文件 9 的 9:MathUtil.sol
pragma solidity ^0.8.0;
contract MathUtil {
uint256 internal constant ONE_DEC18 = 10 ** 18;
uint256 internal constant THRESH_DEC18 = 10 ** 6;
function _cubicRoot(uint256 _v) internal pure returns (uint256) {
uint256 x = _v > ONE_DEC18 && _v < 10 ** 19 ? (_v - ONE_DEC18) / 3 + ONE_DEC18 : ONE_DEC18;
uint256 diff;
do {
uint256 powX3 = _mulD18(_mulD18(x, x), x);
uint256 xnew = x * (powX3 + 2 * _v) / (2 * powX3 + _v);
diff = xnew > x ? xnew - x : x - xnew;
x = xnew;
} while (diff > THRESH_DEC18);
return x;
}
function _mulD18(uint256 _a, uint256 _b) internal pure returns (uint256) {
return (_a * _b) / ONE_DEC18;
}
function _divD18(uint256 _a, uint256 _b) internal pure returns (uint256) {
return (_a * ONE_DEC18) / _b;
}
function _power3(uint256 _x) internal pure returns (uint256) {
return _mulD18(_mulD18(_x, _x), _x);
}
function _min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
{
"compilationTarget": {
"contracts/Frankencoin.sol": "Frankencoin"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"uint256","name":"_minApplicationPeriod","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyRegistered","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[],"name":"FeeTooLow","type":"error"},{"inputs":[],"name":"NotMinter","type":"error"},{"inputs":[],"name":"PeriodTooShort","type":"error"},{"inputs":[],"name":"TooLate","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"reportingMinter","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Loss","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"applicationPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"applicationFee","type":"uint256"},{"indexed":false,"internalType":"string","name":"message","type":"string"}],"name":"MinterApplied","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"string","name":"message","type":"string"}],"name":"MinterDenied","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"reportingMinter","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Profit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_APPLICATION_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"payer","type":"address"},{"internalType":"uint256","name":"targetTotalBurnAmount","type":"uint256"},{"internalType":"uint32","name":"reservePPM","type":"uint32"}],"name":"burnFromWithReserve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountExcludingReserve","type":"uint256"},{"internalType":"uint32","name":"_reservePPM","type":"uint32"}],"name":"burnWithReserve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"reservePPM","type":"uint32"}],"name":"burnWithoutReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintedAmount","type":"uint256"},{"internalType":"uint32","name":"_reservePPM","type":"uint32"}],"name":"calculateAssignedReserve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountExcludingReserve","type":"uint256"},{"internalType":"uint32","name":"reservePPM","type":"uint32"}],"name":"calculateFreedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"source","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"collectProfits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"source","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"coverLoss","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"},{"internalType":"address[]","name":"_helpers","type":"address[]"},{"internalType":"string","name":"_message","type":"string"}],"name":"denyMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"equity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_position","type":"address"}],"name":"getPositionParent","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"},{"internalType":"string","name":"_message","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"isMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint32","name":"_reservePPM","type":"uint32"},{"internalType":"uint32","name":"_feesPPM","type":"uint32"}],"name":"mintWithReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minterReserve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"minters","outputs":[{"internalType":"uint256","name":"validityStart","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"position","type":"address"}],"name":"positions","outputs":[{"internalType":"address","name":"registeringMinter","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_position","type":"address"}],"name":"registerPosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserve","outputs":[{"internalType":"contract IReserve","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"},{"internalType":"uint256","name":"_applicationPeriod","type":"uint256"},{"internalType":"uint256","name":"_applicationFee","type":"uint256"},{"internalType":"string","name":"_message","type":"string"}],"name":"suggestMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]