123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413 |
- {
- "address": "0xd1e0e083d778274Bbd828ce27AB421A41fa2E31F",
- "abi": [
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_factory",
- "type": "address"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "lpFeeBP",
- "type": "uint256"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "protocolFeeBP",
- "type": "uint256"
- }
- ],
- "name": "FeesUpdated",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "previousOwner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "OwnershipTransferred",
- "type": "event"
- },
- {
- "inputs": [],
- "name": "BP_DENOMINATOR",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "eqFeeBP",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "eqRewardBP",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "factory",
- "outputs": [
- {
- "internalType": "contract Factory",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- },
- {
- "internalType": "uint16",
- "name": "",
- "type": "uint16"
- },
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "_amountSD",
- "type": "uint256"
- }
- ],
- "name": "getFees",
- "outputs": [
- {
- "components": [
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "eqFee",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "eqReward",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "lpFee",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "protocolFee",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "lkbRemove",
- "type": "uint256"
- }
- ],
- "internalType": "struct Pool.SwapObj",
- "name": "s",
- "type": "tuple"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getVersion",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "pure",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "lpFeeBP",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "owner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "protocolFeeBP",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "renounceOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "_lpFeeBP",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "_protocolFeeBP",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "_eqFeeBP",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "_eqRewardBP",
- "type": "uint256"
- }
- ],
- "name": "setFees",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "transferOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- }
- ],
- "transactionHash": "0x7b062fcac9c4dacc182e0364c52d61f38d716664ee00e1c12f921a7440ef97ea",
- "receipt": {
- "to": null,
- "from": "0x368715F09C1AB5E0B55bF5bA19cD887189A28DBE",
- "contractAddress": "0xd1e0e083d778274Bbd828ce27AB421A41fa2E31F",
- "transactionIndex": 1,
- "gasUsed": "34567975",
- "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000001000000000000000000000000000000000000020000000000000200000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000080020000000000000000000000000000000000000000000000010000000000000000000",
- "blockHash": "0xff72be6bbe9eac19cf96f2c97e153ba21bddea0f84be03997b245f49e1f2f73c",
- "transactionHash": "0x7b062fcac9c4dacc182e0364c52d61f38d716664ee00e1c12f921a7440ef97ea",
- "logs": [
- {
- "transactionIndex": 1,
- "blockNumber": 14284976,
- "transactionHash": "0x7b062fcac9c4dacc182e0364c52d61f38d716664ee00e1c12f921a7440ef97ea",
- "address": "0xd1e0e083d778274Bbd828ce27AB421A41fa2E31F",
- "topics": [
- "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
- "0x0000000000000000000000000000000000000000000000000000000000000000",
- "0x000000000000000000000000368715f09c1ab5e0b55bf5ba19cd887189a28dbe"
- ],
- "data": "0x",
- "logIndex": 0,
- "blockHash": "0xff72be6bbe9eac19cf96f2c97e153ba21bddea0f84be03997b245f49e1f2f73c"
- }
- ],
- "blockNumber": 14284976,
- "cumulativeGasUsed": "34567975",
- "status": 1,
- "byzantium": true
- },
- "args": [
- "0x5F5947a284319231B7FcF2F8Fde87343BBE0867f"
- ],
- "numDeployments": 1,
- "solcInputHash": "c474952dec744e7c88dc7c3d2b8d163f",
- "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_factory\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpFeeBP\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeBP\",\"type\":\"uint256\"}],\"name\":\"FeesUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BP_DENOMINATOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eqFeeBP\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eqRewardBP\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"contract Factory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountSD\",\"type\":\"uint256\"}],\"name\":\"getFees\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"eqFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"eqReward\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lpFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"protocolFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lkbRemove\",\"type\":\"uint256\"}],\"internalType\":\"struct Pool.SwapObj\",\"name\":\"s\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lpFeeBP\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeBP\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_lpFeeBP\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_protocolFeeBP\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_eqFeeBP\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_eqRewardBP\",\"type\":\"uint256\"}],\"name\":\"setFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/libraries/MirrorgateFeeLibraryV01.sol\":\"MirrorgateFeeLibraryV01\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x549c5343ad9f7e3f38aa4c4761854403502574bbc15b822db2ce892ff9b79da7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, \\\"SafeMath: addition overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b <= a, \\\"SafeMath: subtraction overflow\\\");\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n if (a == 0) return 0;\\n uint256 c = a * b;\\n require(c / a == b, \\\"SafeMath: multiplication overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: division by zero\\\");\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: modulo by zero\\\");\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryDiv}.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n}\\n\",\"keccak256\":\"0xe22a1fc7400ae196eba2ad1562d0386462b00a6363b742d55a2fd2021a58586f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor () {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x1153f6dd334c01566417b8c551122450542a2b75a2bbb379d59a8c320ed6da28\",\"license\":\"MIT\"},\"contracts/Factory.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\r\\n\\r\\npragma solidity 0.7.6;\\r\\npragma abicoder v2;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\r\\nimport \\\"./Pool.sol\\\";\\r\\n\\r\\ncontract Factory is Ownable {\\r\\n using SafeMath for uint256;\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // VARIABLES\\r\\n mapping(uint256 => Pool) public getPool; // poolId -> PoolInfo\\r\\n address[] public allPools;\\r\\n address public immutable router;\\r\\n address public defaultFeeLibrary; // address for retrieving fee params for swaps\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // MODIFIERS\\r\\n modifier onlyRouter() {\\r\\n require(msg.sender == router, \\\"Mirrorgate: caller must be Router.\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor(address _router) {\\r\\n require(_router != address(0x0), \\\"Mirrorgate: _router cant be 0x0\\\"); // 1 time only\\r\\n router = _router;\\r\\n }\\r\\n\\r\\n function setDefaultFeeLibrary(address _defaultFeeLibrary) external onlyOwner {\\r\\n require(_defaultFeeLibrary != address(0x0), \\\"Mirrorgate: fee library cant be 0x0\\\");\\r\\n defaultFeeLibrary = _defaultFeeLibrary;\\r\\n }\\r\\n\\r\\n function allPoolsLength() external view returns (uint256) {\\r\\n return allPools.length;\\r\\n }\\r\\n\\r\\n function createPool(\\r\\n uint256 _poolId,\\r\\n address _token,\\r\\n uint8 _sharedDecimals,\\r\\n uint8 _localDecimals,\\r\\n string memory _name,\\r\\n string memory _symbol\\r\\n ) public onlyRouter returns (address poolAddress) {\\r\\n require(address(getPool[_poolId]) == address(0x0), \\\"Mirrorgate: Pool already created\\\");\\r\\n\\r\\n Pool pool = new Pool(_poolId, router, _token, _sharedDecimals, _localDecimals, defaultFeeLibrary, _name, _symbol);\\r\\n getPool[_poolId] = pool;\\r\\n poolAddress = address(pool);\\r\\n allPools.push(poolAddress);\\r\\n }\\r\\n\\r\\n function renounceOwnership() public override onlyOwner {}\\r\\n}\\r\\n\",\"keccak256\":\"0x5513cf7154b898cedf2def7e0c0f5c664e7b2ea1a24eea2e132199336a79d956\",\"license\":\"BUSL-1.1\"},\"contracts/LPTokenERC20.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\r\\n\\r\\npragma solidity 0.7.6;\\r\\n\\r\\n// libraries\\r\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\r\\n\\r\\ncontract LPTokenERC20 {\\r\\n using SafeMath for uint256;\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // CONSTANTS\\r\\n string public name;\\r\\n string public symbol;\\r\\n bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;\\r\\n // set in constructor\\r\\n bytes32 public DOMAIN_SEPARATOR;\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // VARIABLES\\r\\n uint256 public decimals;\\r\\n uint256 public totalSupply;\\r\\n mapping(address => uint256) public balanceOf;\\r\\n mapping(address => mapping(address => uint256)) public allowance;\\r\\n mapping(address => uint256) public nonces;\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // EVENTS\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n constructor(string memory _name, string memory _symbol) {\\r\\n name = _name;\\r\\n symbol = _symbol;\\r\\n uint256 chainId;\\r\\n assembly {\\r\\n chainId := chainid()\\r\\n }\\r\\n DOMAIN_SEPARATOR = keccak256(\\r\\n abi.encode(\\r\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"),\\r\\n keccak256(bytes(name)),\\r\\n keccak256(bytes(\\\"1\\\")),\\r\\n chainId,\\r\\n address(this)\\r\\n )\\r\\n );\\r\\n }\\r\\n\\r\\n function _mint(address to, uint256 value) internal {\\r\\n totalSupply = totalSupply.add(value);\\r\\n balanceOf[to] = balanceOf[to].add(value);\\r\\n emit Transfer(address(0), to, value);\\r\\n }\\r\\n\\r\\n function _burn(address from, uint256 value) internal {\\r\\n balanceOf[from] = balanceOf[from].sub(value);\\r\\n totalSupply = totalSupply.sub(value);\\r\\n emit Transfer(from, address(0), value);\\r\\n }\\r\\n\\r\\n function _approve(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) private {\\r\\n allowance[owner][spender] = value;\\r\\n emit Approval(owner, spender, value);\\r\\n }\\r\\n\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) private {\\r\\n balanceOf[from] = balanceOf[from].sub(value);\\r\\n balanceOf[to] = balanceOf[to].add(value);\\r\\n emit Transfer(from, to, value);\\r\\n }\\r\\n\\r\\n function approve(address spender, uint256 value) external returns (bool) {\\r\\n _approve(msg.sender, spender, value);\\r\\n return true;\\r\\n }\\r\\n\\r\\n function transfer(address to, uint256 value) external returns (bool) {\\r\\n _transfer(msg.sender, to, value);\\r\\n return true;\\r\\n }\\r\\n\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) external returns (bool) {\\r\\n if (allowance[from][msg.sender] != uint256(-1)) {\\r\\n allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);\\r\\n }\\r\\n _transfer(from, to, value);\\r\\n return true;\\r\\n }\\r\\n\\r\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\r\\n _approve(msg.sender, spender, allowance[msg.sender][spender].add(addedValue));\\r\\n return true;\\r\\n }\\r\\n\\r\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\r\\n _approve(msg.sender, spender, allowance[msg.sender][spender].sub(subtractedValue, \\\"ERC20: decreased allowance below zero\\\"));\\r\\n return true;\\r\\n }\\r\\n\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external {\\r\\n require(deadline >= block.timestamp, \\\"Bridge: EXPIRED\\\");\\r\\n bytes32 digest = keccak256(\\r\\n abi.encodePacked(\\r\\n \\\"\\\\x19\\\\x01\\\",\\r\\n DOMAIN_SEPARATOR,\\r\\n keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))\\r\\n )\\r\\n );\\r\\n address recoveredAddress = ecrecover(digest, v, r, s);\\r\\n require(recoveredAddress != address(0) && recoveredAddress == owner, \\\"Bridge: INVALID_SIGNATURE\\\");\\r\\n _approve(owner, spender, value);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xfad1da8f35c7d9dd3ff2a96f8133ec736a4098633c184fc746d67113591f94bc\",\"license\":\"BUSL-1.1\"},\"contracts/Pool.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\r\\n\\r\\npragma solidity 0.7.6;\\r\\npragma abicoder v2;\\r\\n\\r\\n// imports\\r\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\\\";\\r\\nimport \\\"./LPTokenERC20.sol\\\";\\r\\nimport \\\"./interfaces/IMirrorgateFeeLibrary.sol\\\";\\r\\n\\r\\n// libraries\\r\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\r\\n\\r\\n/// Pool contracts on other chains and managed by the Stargate protocol.\\r\\ncontract Pool is LPTokenERC20, ReentrancyGuard {\\r\\n using SafeMath for uint256;\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // CONSTANTS\\r\\n bytes4 private constant SELECTOR = bytes4(keccak256(bytes(\\\"transfer(address,uint256)\\\")));\\r\\n uint256 public constant BP_DENOMINATOR = 10000;\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // STRUCTS\\r\\n struct ChainPath {\\r\\n bool ready; // indicate if the counter chainPath has been created.\\r\\n uint16 dstChainId;\\r\\n uint256 dstPoolId;\\r\\n uint256 weight;\\r\\n uint256 balance;\\r\\n uint256 lkb;\\r\\n uint256 credits;\\r\\n uint256 idealBalance;\\r\\n }\\r\\n\\r\\n struct SwapObj {\\r\\n uint256 amount;\\r\\n uint256 eqFee;\\r\\n uint256 eqReward;\\r\\n uint256 lpFee;\\r\\n uint256 protocolFee;\\r\\n uint256 lkbRemove;\\r\\n }\\r\\n\\r\\n struct CreditObj {\\r\\n uint256 credits;\\r\\n uint256 idealBalance;\\r\\n }\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // VARIABLES\\r\\n\\r\\n // chainPath\\r\\n ChainPath[] public chainPaths; // list of connected chains with shared pools\\r\\n mapping(uint16 => mapping(uint256 => uint256)) public chainPathIndexLookup; // lookup for chainPath by chainId => poolId =>index\\r\\n\\r\\n // metadata\\r\\n uint256 public immutable poolId; // shared id between chains to represent same pool\\r\\n uint256 public sharedDecimals; // the shared decimals (lowest common decimals between chains)\\r\\n uint256 public localDecimals; // the decimals for the token\\r\\n uint256 public immutable convertRate; // the decimals for the token\\r\\n address public immutable token; // the token for the pool\\r\\n address public immutable router; // the token for the pool\\r\\n\\r\\n bool public stopSwap; // flag to stop swapping in extreme cases\\r\\n\\r\\n // Fee and Liquidity\\r\\n uint256 public totalLiquidity; // the total amount of tokens added on this side of the chain (fees + deposits - withdrawals)\\r\\n uint256 public totalWeight; // total weight for pool percentages\\r\\n uint256 public mintFeeBP; // fee basis points for the mint/deposit\\r\\n uint256 public protocolFeeBalance; // fee balance created from dao fee\\r\\n uint256 public mintFeeBalance; // fee balance created from mint fee\\r\\n uint256 public eqFeePool; // pool rewards in Shared Decimal format. indicate the total budget for reverse swap incentive\\r\\n address public feeLibrary; // address for retrieving fee params for swaps\\r\\n\\r\\n // Delta related\\r\\n uint256 public deltaCredit; // credits accumulated from txn\\r\\n bool public batched; // flag to indicate if we want batch processing.\\r\\n bool public defaultSwapMode; // flag for the default mode for swap\\r\\n bool public defaultLPMode; // flag for the default mode for lp\\r\\n uint256 public swapDeltaBP; // basis points of poolCredits to activate Delta in swap\\r\\n uint256 public lpDeltaBP; // basis points of poolCredits to activate Delta in liquidity events\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // EVENTS\\r\\n event Mint(address to, uint256 amountLP, uint256 amountSD, uint256 mintFeeAmountSD);\\r\\n event Burn(address from, uint256 amountLP, uint256 amountSD);\\r\\n event RedeemLocalCallback(address _to, uint256 _amountSD, uint256 _amountToMintSD);\\r\\n event Swap(\\r\\n uint16 chainId,\\r\\n uint256 dstPoolId,\\r\\n address from,\\r\\n uint256 amountSD,\\r\\n uint256 eqReward,\\r\\n uint256 eqFee,\\r\\n uint256 protocolFee,\\r\\n uint256 lpFee\\r\\n );\\r\\n event SendCredits(uint16 dstChainId, uint256 dstPoolId, uint256 credits, uint256 idealBalance);\\r\\n event RedeemRemote(uint16 chainId, uint256 dstPoolId, address from, uint256 amountLP, uint256 amountSD);\\r\\n event RedeemLocal(address from, uint256 amountLP, uint256 amountSD, uint16 chainId, uint256 dstPoolId, bytes to);\\r\\n event InstantRedeemLocal(address from, uint256 amountLP, uint256 amountSD, address to);\\r\\n event CreditChainPath(uint16 chainId, uint256 srcPoolId, uint256 amountSD, uint256 idealBalance);\\r\\n event SwapRemote(address to, uint256 amountSD, uint256 protocolFee, uint256 dstFee);\\r\\n event WithdrawRemote(uint16 srcChainId, uint256 srcPoolId, uint256 swapAmount, uint256 mintAmount);\\r\\n event ChainPathUpdate(uint16 dstChainId, uint256 dstPoolId, uint256 weight);\\r\\n event FeesUpdated(uint256 mintFeeBP);\\r\\n event FeeLibraryUpdated(address feeLibraryAddr);\\r\\n event StopSwapUpdated(bool swapStop);\\r\\n event WithdrawProtocolFeeBalance(address to, uint256 amountSD);\\r\\n event WithdrawMintFeeBalance(address to, uint256 amountSD);\\r\\n event DeltaParamUpdated(bool batched, uint256 swapDeltaBP, uint256 lpDeltaBP, bool defaultSwapMode, bool defaultLPMode);\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // MODIFIERS\\r\\n modifier onlyRouter() {\\r\\n require(msg.sender == router, \\\"Mirrorgate: only the router can call this method\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor(\\r\\n uint256 _poolId,\\r\\n address _router,\\r\\n address _token,\\r\\n uint256 _sharedDecimals,\\r\\n uint256 _localDecimals,\\r\\n address _feeLibrary,\\r\\n string memory _name,\\r\\n string memory _symbol\\r\\n ) LPTokenERC20(_name, _symbol) {\\r\\n require(_token != address(0x0), \\\"Mirrorgate: _token cannot be 0x0\\\");\\r\\n require(_router != address(0x0), \\\"Mirrorgate: _router cannot be 0x0\\\");\\r\\n poolId = _poolId;\\r\\n router = _router;\\r\\n token = _token;\\r\\n sharedDecimals = _sharedDecimals;\\r\\n decimals = uint8(_sharedDecimals);\\r\\n localDecimals = _localDecimals;\\r\\n convertRate = 10**(uint256(localDecimals).sub(sharedDecimals));\\r\\n totalWeight = 0;\\r\\n feeLibrary = _feeLibrary;\\r\\n\\r\\n //delta algo related\\r\\n batched = false;\\r\\n defaultSwapMode = true;\\r\\n defaultLPMode = true;\\r\\n }\\r\\n\\r\\n function getChainPathsLength() public view returns (uint256) {\\r\\n return chainPaths.length;\\r\\n }\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // LOCAL CHAIN FUNCTIONS\\r\\n\\r\\n function mint(address _to, uint256 _amountLD) external nonReentrant onlyRouter returns (uint256) {\\r\\n return _mintLocal(_to, _amountLD, true, true);\\r\\n }\\r\\n\\r\\n // Local Remote\\r\\n // ------- ---------\\r\\n // swap -> swapRemote\\r\\n function swap(\\r\\n uint16 _dstChainId,\\r\\n uint256 _dstPoolId,\\r\\n address _from,\\r\\n uint256 _amountLD,\\r\\n uint256 _minAmountLD,\\r\\n bool newLiquidity\\r\\n ) external nonReentrant onlyRouter returns (SwapObj memory) {\\r\\n require(!stopSwap, \\\"Mirrorgate: swap func stopped\\\");\\r\\n ChainPath storage cp = getAndCheckCP(_dstChainId, _dstPoolId);\\r\\n require(cp.ready == true, \\\"Mirrorgate: counter chainPath is not ready\\\");\\r\\n\\r\\n uint256 amountSD = amountLDtoSD(_amountLD);\\r\\n uint256 minAmountSD = amountLDtoSD(_minAmountLD);\\r\\n\\r\\n // request fee params from library\\r\\n SwapObj memory s = IMirrorgateFeeLibrary(feeLibrary).getFees(poolId, _dstPoolId, _dstChainId, _from, amountSD);\\r\\n\\r\\n // equilibrium fee and reward. note eqFee/eqReward are separated from swap liquidity\\r\\n eqFeePool = eqFeePool.sub(s.eqReward);\\r\\n // update the new amount the user gets minus the fees\\r\\n s.amount = amountSD.sub(s.eqFee).sub(s.protocolFee).sub(s.lpFee);\\r\\n // users will also get the eqReward\\r\\n require(s.amount.add(s.eqReward) >= minAmountSD, \\\"Mirrorgate: slippage too high\\\");\\r\\n\\r\\n // behaviours\\r\\n // - protocolFee: booked, stayed and withdrawn at remote.\\r\\n // - eqFee: booked, stayed and withdrawn at remote.\\r\\n // - lpFee: booked and stayed at remote, can be withdrawn anywhere\\r\\n\\r\\n s.lkbRemove = amountSD.sub(s.lpFee).add(s.eqReward);\\r\\n // check for transfer solvency.\\r\\n require(cp.balance >= s.lkbRemove, \\\"Mirrorgate: dst balance too low\\\");\\r\\n cp.balance = cp.balance.sub(s.lkbRemove);\\r\\n\\r\\n if (newLiquidity) {\\r\\n deltaCredit = deltaCredit.add(amountSD).add(s.eqReward);\\r\\n } else if (s.eqReward > 0) {\\r\\n deltaCredit = deltaCredit.add(s.eqReward);\\r\\n }\\r\\n\\r\\n // distribute credits on condition.\\r\\n if (!batched || deltaCredit >= totalLiquidity.mul(swapDeltaBP).div(BP_DENOMINATOR)) {\\r\\n _delta(defaultSwapMode);\\r\\n }\\r\\n\\r\\n emit Swap(_dstChainId, _dstPoolId, _from, s.amount, s.eqReward, s.eqFee, s.protocolFee, s.lpFee);\\r\\n return s;\\r\\n }\\r\\n\\r\\n // Local Remote\\r\\n // ------- ---------\\r\\n // sendCredits -> creditChainPath\\r\\n function sendCredits(uint16 _dstChainId, uint256 _dstPoolId) external nonReentrant onlyRouter returns (CreditObj memory c) {\\r\\n ChainPath storage cp = getAndCheckCP(_dstChainId, _dstPoolId);\\r\\n require(cp.ready == true, \\\"Mirrorgate: counter chainPath is not ready\\\");\\r\\n cp.lkb = cp.lkb.add(cp.credits);\\r\\n c.idealBalance = totalLiquidity.mul(cp.weight).div(totalWeight);\\r\\n c.credits = cp.credits;\\r\\n cp.credits = 0;\\r\\n emit SendCredits(_dstChainId, _dstPoolId, c.credits, c.idealBalance);\\r\\n }\\r\\n\\r\\n // Local Remote\\r\\n // ------- ---------\\r\\n // redeemRemote -> swapRemote\\r\\n function redeemRemote(\\r\\n uint16 _dstChainId,\\r\\n uint256 _dstPoolId,\\r\\n address _from,\\r\\n uint256 _amountLP\\r\\n ) external nonReentrant onlyRouter {\\r\\n require(_from != address(0x0), \\\"Mirrorgate: _from cannot be 0x0\\\");\\r\\n uint256 amountSD = _burnLocal(_from, _amountLP);\\r\\n //run Delta\\r\\n if (!batched || deltaCredit > totalLiquidity.mul(lpDeltaBP).div(BP_DENOMINATOR)) {\\r\\n _delta(defaultLPMode);\\r\\n }\\r\\n uint256 amountLD = amountSDtoLD(amountSD);\\r\\n emit RedeemRemote(_dstChainId, _dstPoolId, _from, _amountLP, amountLD);\\r\\n }\\r\\n\\r\\n function instantRedeemLocal(\\r\\n address _from,\\r\\n uint256 _amountLP,\\r\\n address _to\\r\\n ) external nonReentrant onlyRouter returns (uint256 amountSD) {\\r\\n require(_from != address(0x0), \\\"Mirrorgate: _from cannot be 0x0\\\");\\r\\n uint256 _deltaCredit = deltaCredit; // sload optimization.\\r\\n uint256 _capAmountLP = _amountSDtoLP(_deltaCredit);\\r\\n\\r\\n if (_amountLP > _capAmountLP) _amountLP = _capAmountLP;\\r\\n\\r\\n amountSD = _burnLocal(_from, _amountLP);\\r\\n deltaCredit = _deltaCredit.sub(amountSD);\\r\\n uint256 amountLD = amountSDtoLD(amountSD);\\r\\n _safeTransfer(token, _to, amountLD);\\r\\n emit InstantRedeemLocal(_from, _amountLP, amountSD, _to);\\r\\n }\\r\\n\\r\\n // Local Remote\\r\\n // ------- ---------\\r\\n // redeemLocal -> redeemLocalCheckOnRemote\\r\\n // redeemLocalCallback <-\\r\\n function redeemLocal(\\r\\n address _from,\\r\\n uint256 _amountLP,\\r\\n uint16 _dstChainId,\\r\\n uint256 _dstPoolId,\\r\\n bytes calldata _to\\r\\n ) external nonReentrant onlyRouter returns (uint256 amountSD) {\\r\\n require(_from != address(0x0), \\\"Mirrorgate: _from cannot be 0x0\\\");\\r\\n\\r\\n // safeguard.\\r\\n require(chainPaths[chainPathIndexLookup[_dstChainId][_dstPoolId]].ready == true, \\\"Mirrorgate: counter chainPath is not ready\\\");\\r\\n amountSD = _burnLocal(_from, _amountLP);\\r\\n\\r\\n // run Delta\\r\\n if (!batched || deltaCredit > totalLiquidity.mul(lpDeltaBP).div(BP_DENOMINATOR)) {\\r\\n _delta(false);\\r\\n }\\r\\n emit RedeemLocal(_from, _amountLP, amountSD, _dstChainId, _dstPoolId, _to);\\r\\n }\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // REMOTE CHAIN FUNCTIONS\\r\\n\\r\\n // Local Remote\\r\\n // ------- ---------\\r\\n // sendCredits -> creditChainPath\\r\\n function creditChainPath(\\r\\n uint16 _dstChainId,\\r\\n uint256 _dstPoolId,\\r\\n CreditObj memory _c\\r\\n ) external nonReentrant onlyRouter {\\r\\n ChainPath storage cp = chainPaths[chainPathIndexLookup[_dstChainId][_dstPoolId]];\\r\\n cp.balance = cp.balance.add(_c.credits);\\r\\n if (cp.idealBalance != _c.idealBalance) {\\r\\n cp.idealBalance = _c.idealBalance;\\r\\n }\\r\\n emit CreditChainPath(_dstChainId, _dstPoolId, _c.credits, _c.idealBalance);\\r\\n }\\r\\n\\r\\n // Local Remote\\r\\n // ------- ---------\\r\\n // swap -> swapRemote\\r\\n function swapRemote(\\r\\n uint16 _srcChainId,\\r\\n uint256 _srcPoolId,\\r\\n address _to,\\r\\n SwapObj memory _s\\r\\n ) external nonReentrant onlyRouter returns (uint256 amountLD) {\\r\\n // booking lpFee\\r\\n totalLiquidity = totalLiquidity.add(_s.lpFee);\\r\\n // booking eqFee\\r\\n eqFeePool = eqFeePool.add(_s.eqFee);\\r\\n // booking stargateFee\\r\\n protocolFeeBalance = protocolFeeBalance.add(_s.protocolFee);\\r\\n\\r\\n // update LKB\\r\\n uint256 chainPathIndex = chainPathIndexLookup[_srcChainId][_srcPoolId];\\r\\n chainPaths[chainPathIndex].lkb = chainPaths[chainPathIndex].lkb.sub(_s.lkbRemove);\\r\\n\\r\\n // user receives the amount + the srcReward\\r\\n amountLD = amountSDtoLD(_s.amount.add(_s.eqReward));\\r\\n _safeTransfer(token, _to, amountLD);\\r\\n emit SwapRemote(_to, _s.amount.add(_s.eqReward), _s.protocolFee, _s.eqFee);\\r\\n }\\r\\n\\r\\n // Local Remote\\r\\n // ------- ---------\\r\\n // redeemLocal -> redeemLocalCheckOnRemote\\r\\n // redeemLocalCallback <-\\r\\n function redeemLocalCallback(\\r\\n uint16 _srcChainId,\\r\\n uint256 _srcPoolId,\\r\\n address _to,\\r\\n uint256 _amountSD,\\r\\n uint256 _amountToMintSD\\r\\n ) external nonReentrant onlyRouter {\\r\\n if (_amountToMintSD > 0) {\\r\\n _mintLocal(_to, amountSDtoLD(_amountToMintSD), false, false);\\r\\n }\\r\\n\\r\\n ChainPath storage cp = getAndCheckCP(_srcChainId, _srcPoolId);\\r\\n cp.lkb = cp.lkb.sub(_amountSD);\\r\\n\\r\\n uint256 amountLD = amountSDtoLD(_amountSD);\\r\\n _safeTransfer(token, _to, amountLD);\\r\\n emit RedeemLocalCallback(_to, _amountSD, _amountToMintSD);\\r\\n }\\r\\n\\r\\n // Local Remote\\r\\n // ------- ---------\\r\\n // redeemLocal(amount) -> redeemLocalCheckOnRemote\\r\\n // redeemLocalCallback <-\\r\\n function redeemLocalCheckOnRemote(\\r\\n uint16 _srcChainId,\\r\\n uint256 _srcPoolId,\\r\\n uint256 _amountSD\\r\\n ) external nonReentrant onlyRouter returns (uint256 swapAmount, uint256 mintAmount) {\\r\\n ChainPath storage cp = getAndCheckCP(_srcChainId, _srcPoolId);\\r\\n if (_amountSD > cp.balance) {\\r\\n mintAmount = _amountSD - cp.balance;\\r\\n swapAmount = cp.balance;\\r\\n cp.balance = 0;\\r\\n } else {\\r\\n cp.balance = cp.balance.sub(_amountSD);\\r\\n swapAmount = _amountSD;\\r\\n mintAmount = 0;\\r\\n }\\r\\n emit WithdrawRemote(_srcChainId, _srcPoolId, swapAmount, mintAmount);\\r\\n }\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // DAO Calls\\r\\n function createChainPath(\\r\\n uint16 _dstChainId,\\r\\n uint256 _dstPoolId,\\r\\n uint256 _weight\\r\\n ) external onlyRouter {\\r\\n for (uint256 i = 0; i < chainPaths.length; ++i) {\\r\\n ChainPath memory cp = chainPaths[i];\\r\\n bool exists = cp.dstChainId == _dstChainId && cp.dstPoolId == _dstPoolId;\\r\\n require(!exists, \\\"Mirrorgate: cant createChainPath of existing dstChainId and _dstPoolId\\\");\\r\\n }\\r\\n totalWeight = totalWeight.add(_weight);\\r\\n chainPathIndexLookup[_dstChainId][_dstPoolId] = chainPaths.length;\\r\\n chainPaths.push(ChainPath(false, _dstChainId, _dstPoolId, _weight, 0, 0, 0, 0));\\r\\n emit ChainPathUpdate(_dstChainId, _dstPoolId, _weight);\\r\\n }\\r\\n\\r\\n function setWeightForChainPath(\\r\\n uint16 _dstChainId,\\r\\n uint256 _dstPoolId,\\r\\n uint16 _weight\\r\\n ) external onlyRouter {\\r\\n ChainPath storage cp = getAndCheckCP(_dstChainId, _dstPoolId);\\r\\n totalWeight = totalWeight.sub(cp.weight).add(_weight);\\r\\n cp.weight = _weight;\\r\\n emit ChainPathUpdate(_dstChainId, _dstPoolId, _weight);\\r\\n }\\r\\n\\r\\n function setFee(uint256 _mintFeeBP) external onlyRouter {\\r\\n require(_mintFeeBP <= BP_DENOMINATOR, \\\"Bridge: cum fees > 100%\\\");\\r\\n mintFeeBP = _mintFeeBP;\\r\\n emit FeesUpdated(mintFeeBP);\\r\\n }\\r\\n\\r\\n function setFeeLibrary(address _feeLibraryAddr) external onlyRouter {\\r\\n require(_feeLibraryAddr != address(0x0), \\\"Mirrorgate: fee library cant be 0x0\\\");\\r\\n feeLibrary = _feeLibraryAddr;\\r\\n emit FeeLibraryUpdated(_feeLibraryAddr);\\r\\n }\\r\\n\\r\\n function setSwapStop(bool _swapStop) external onlyRouter {\\r\\n stopSwap = _swapStop;\\r\\n emit StopSwapUpdated(_swapStop);\\r\\n }\\r\\n\\r\\n function setDeltaParam(\\r\\n bool _batched,\\r\\n uint256 _swapDeltaBP,\\r\\n uint256 _lpDeltaBP,\\r\\n bool _defaultSwapMode,\\r\\n bool _defaultLPMode\\r\\n ) external onlyRouter {\\r\\n require(_swapDeltaBP <= BP_DENOMINATOR && _lpDeltaBP <= BP_DENOMINATOR, \\\"Mirrorgate: wrong Delta param\\\");\\r\\n batched = _batched;\\r\\n swapDeltaBP = _swapDeltaBP;\\r\\n lpDeltaBP = _lpDeltaBP;\\r\\n defaultSwapMode = _defaultSwapMode;\\r\\n defaultLPMode = _defaultLPMode;\\r\\n emit DeltaParamUpdated(_batched, _swapDeltaBP, _lpDeltaBP, _defaultSwapMode, _defaultLPMode);\\r\\n }\\r\\n\\r\\n function callDelta(bool _fullMode) external onlyRouter {\\r\\n _delta(_fullMode);\\r\\n }\\r\\n\\r\\n function activateChainPath(uint16 _dstChainId, uint256 _dstPoolId) external onlyRouter {\\r\\n ChainPath storage cp = getAndCheckCP(_dstChainId, _dstPoolId);\\r\\n require(cp.ready == false, \\\"Mirrorgate: chainPath is already active\\\");\\r\\n // this func will only be called once\\r\\n cp.ready = true;\\r\\n }\\r\\n\\r\\n function withdrawProtocolFeeBalance(address _to) external onlyRouter {\\r\\n if (protocolFeeBalance > 0) {\\r\\n uint256 amountOfLD = amountSDtoLD(protocolFeeBalance);\\r\\n protocolFeeBalance = 0;\\r\\n _safeTransfer(token, _to, amountOfLD);\\r\\n emit WithdrawProtocolFeeBalance(_to, amountOfLD);\\r\\n }\\r\\n }\\r\\n\\r\\n function withdrawMintFeeBalance(address _to) external onlyRouter {\\r\\n if (mintFeeBalance > 0) {\\r\\n uint256 amountOfLD = amountSDtoLD(mintFeeBalance);\\r\\n mintFeeBalance = 0;\\r\\n _safeTransfer(token, _to, amountOfLD);\\r\\n emit WithdrawMintFeeBalance(_to, amountOfLD);\\r\\n }\\r\\n }\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // INTERNAL\\r\\n // Conversion Helpers\\r\\n //---------------------------------------------------------------------------\\r\\n function amountLPtoLD(uint256 _amountLP) external view returns (uint256) {\\r\\n return amountSDtoLD(_amountLPtoSD(_amountLP));\\r\\n }\\r\\n\\r\\n function _amountLPtoSD(uint256 _amountLP) internal view returns (uint256) {\\r\\n require(totalSupply > 0, \\\"Mirrorgate: cant convert LPtoSD when totalSupply == 0\\\");\\r\\n return _amountLP.mul(totalLiquidity).div(totalSupply);\\r\\n }\\r\\n\\r\\n function _amountSDtoLP(uint256 _amountSD) internal view returns (uint256) {\\r\\n require(totalLiquidity > 0, \\\"Mirrorgate: cant convert SDtoLP when totalLiq == 0\\\");\\r\\n return _amountSD.mul(totalSupply).div(totalLiquidity);\\r\\n }\\r\\n\\r\\n function amountSDtoLD(uint256 _amount) internal view returns (uint256) {\\r\\n return _amount.mul(convertRate);\\r\\n }\\r\\n\\r\\n function amountLDtoSD(uint256 _amount) internal view returns (uint256) {\\r\\n return _amount.div(convertRate);\\r\\n }\\r\\n\\r\\n function getAndCheckCP(uint16 _dstChainId, uint256 _dstPoolId) internal view returns (ChainPath storage) {\\r\\n require(chainPaths.length > 0, \\\"Mirrorgate: no chainpaths exist\\\");\\r\\n ChainPath storage cp = chainPaths[chainPathIndexLookup[_dstChainId][_dstPoolId]];\\r\\n require(cp.dstChainId == _dstChainId && cp.dstPoolId == _dstPoolId, \\\"Mirrorgate: local chainPath does not exist\\\");\\r\\n return cp;\\r\\n }\\r\\n\\r\\n function getChainPath(uint16 _dstChainId, uint256 _dstPoolId) external view returns (ChainPath memory) {\\r\\n ChainPath memory cp = chainPaths[chainPathIndexLookup[_dstChainId][_dstPoolId]];\\r\\n require(cp.dstChainId == _dstChainId && cp.dstPoolId == _dstPoolId, \\\"Mirrorgate: local chainPath does not exist\\\");\\r\\n return cp;\\r\\n }\\r\\n\\r\\n function _burnLocal(address _from, uint256 _amountLP) internal returns (uint256) {\\r\\n require(totalSupply > 0, \\\"Mirrorgate: cant burn when totalSupply == 0\\\");\\r\\n uint256 amountOfLPTokens = balanceOf[_from];\\r\\n require(amountOfLPTokens >= _amountLP, \\\"Mirrorgate: not enough LP tokens to burn\\\");\\r\\n\\r\\n uint256 amountSD = _amountLP.mul(totalLiquidity).div(totalSupply);\\r\\n //subtract totalLiquidity accordingly\\r\\n totalLiquidity = totalLiquidity.sub(amountSD);\\r\\n\\r\\n _burn(_from, _amountLP);\\r\\n emit Burn(_from, _amountLP, amountSD);\\r\\n return amountSD;\\r\\n }\\r\\n\\r\\n function _delta(bool fullMode) internal {\\r\\n if (deltaCredit > 0 && totalWeight > 0) {\\r\\n uint256 cpLength = chainPaths.length;\\r\\n uint256[] memory deficit = new uint256[](cpLength);\\r\\n uint256 totalDeficit = 0;\\r\\n\\r\\n // algorithm steps 6-9: calculate the total and the amounts required to get to balance state\\r\\n for (uint256 i = 0; i < cpLength; ++i) {\\r\\n ChainPath storage cp = chainPaths[i];\\r\\n // (liquidity * (weight/totalWeight)) - (lkb+credits)\\r\\n uint256 balLiq = totalLiquidity.mul(cp.weight).div(totalWeight);\\r\\n uint256 currLiq = cp.lkb.add(cp.credits);\\r\\n if (balLiq > currLiq) {\\r\\n // save gas since we know balLiq > currLiq and we know deficit[i] > 0\\r\\n deficit[i] = balLiq - currLiq;\\r\\n totalDeficit = totalDeficit.add(deficit[i]);\\r\\n }\\r\\n }\\r\\n\\r\\n // indicates how much delta credit is distributed\\r\\n uint256 spent;\\r\\n\\r\\n // handle credits with 2 tranches. the [ < totalDeficit] [excessCredit]\\r\\n // run full Delta, allocate all credits\\r\\n if (totalDeficit == 0) {\\r\\n // only fullMode delta will allocate excess credits\\r\\n if (fullMode && deltaCredit > 0) {\\r\\n // credit ChainPath by weights\\r\\n for (uint256 i = 0; i < cpLength; ++i) {\\r\\n ChainPath storage cp = chainPaths[i];\\r\\n // credits = credits + toBalanceChange + remaining allocation based on weight\\r\\n uint256 amtToCredit = deltaCredit.mul(cp.weight).div(totalWeight);\\r\\n spent = spent.add(amtToCredit);\\r\\n cp.credits = cp.credits.add(amtToCredit);\\r\\n }\\r\\n } // else do nth\\r\\n } else if (totalDeficit <= deltaCredit) {\\r\\n if (fullMode) {\\r\\n // algorithm step 13: calculate amount to disperse to bring to balance state or as close as possible\\r\\n uint256 excessCredit = deltaCredit - totalDeficit;\\r\\n // algorithm steps 14-16: calculate credits\\r\\n for (uint256 i = 0; i < cpLength; ++i) {\\r\\n if (deficit[i] > 0) {\\r\\n ChainPath storage cp = chainPaths[i];\\r\\n // credits = credits + deficit + remaining allocation based on weight\\r\\n uint256 amtToCredit = deficit[i].add(excessCredit.mul(cp.weight).div(totalWeight));\\r\\n spent = spent.add(amtToCredit);\\r\\n cp.credits = cp.credits.add(amtToCredit);\\r\\n }\\r\\n }\\r\\n } else {\\r\\n // totalDeficit <= deltaCredit but not running fullMode\\r\\n // credit chainPaths as is if any deficit, not using all deltaCredit\\r\\n for (uint256 i = 0; i < cpLength; ++i) {\\r\\n if (deficit[i] > 0) {\\r\\n ChainPath storage cp = chainPaths[i];\\r\\n uint256 amtToCredit = deficit[i];\\r\\n spent = spent.add(amtToCredit);\\r\\n cp.credits = cp.credits.add(amtToCredit);\\r\\n }\\r\\n }\\r\\n }\\r\\n } else {\\r\\n // totalDeficit > deltaCredit, fullMode or not, normalize the deficit by deltaCredit\\r\\n for (uint256 i = 0; i < cpLength; ++i) {\\r\\n if (deficit[i] > 0) {\\r\\n ChainPath storage cp = chainPaths[i];\\r\\n uint256 proportionalDeficit = deficit[i].mul(deltaCredit).div(totalDeficit);\\r\\n spent = spent.add(proportionalDeficit);\\r\\n cp.credits = cp.credits.add(proportionalDeficit);\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n // deduct the amount of credit sent\\r\\n deltaCredit = deltaCredit.sub(spent);\\r\\n }\\r\\n }\\r\\n\\r\\n function _mintLocal(\\r\\n address _to,\\r\\n uint256 _amountLD,\\r\\n bool _feesEnabled,\\r\\n bool _creditDelta\\r\\n ) internal returns (uint256 amountSD) {\\r\\n require(totalWeight > 0, \\\"Mirrorgate: No ChainPaths exist\\\");\\r\\n amountSD = amountLDtoSD(_amountLD);\\r\\n\\r\\n uint256 mintFeeSD = 0;\\r\\n if (_feesEnabled) {\\r\\n mintFeeSD = amountSD.mul(mintFeeBP).div(BP_DENOMINATOR);\\r\\n amountSD = amountSD.sub(mintFeeSD);\\r\\n mintFeeBalance = mintFeeBalance.add(mintFeeSD);\\r\\n }\\r\\n\\r\\n if (_creditDelta) {\\r\\n deltaCredit = deltaCredit.add(amountSD);\\r\\n }\\r\\n\\r\\n uint256 amountLPTokens = amountSD;\\r\\n if (totalSupply != 0) {\\r\\n amountLPTokens = amountSD.mul(totalSupply).div(totalLiquidity);\\r\\n }\\r\\n totalLiquidity = totalLiquidity.add(amountSD);\\r\\n\\r\\n _mint(_to, amountLPTokens);\\r\\n emit Mint(_to, amountLPTokens, amountSD, mintFeeSD);\\r\\n\\r\\n // add to credits and call delta. short circuit to save gas\\r\\n if (!batched || deltaCredit > totalLiquidity.mul(lpDeltaBP).div(BP_DENOMINATOR)) {\\r\\n _delta(defaultLPMode);\\r\\n }\\r\\n }\\r\\n\\r\\n function _safeTransfer(\\r\\n address _token,\\r\\n address _to,\\r\\n uint256 _value\\r\\n ) private {\\r\\n (bool success, bytes memory data) = _token.call(abi.encodeWithSelector(SELECTOR, _to, _value));\\r\\n require(success && (data.length == 0 || abi.decode(data, (bool))), \\\"Mirrorgate: TRANSFER_FAILED\\\");\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x553659592a7dcfe5a199ce693bd765d5eea4bbda29b115d064718c5886360649\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/IMirrorgateFeeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\r\\n\\r\\npragma solidity ^0.7.6;\\r\\npragma abicoder v2;\\r\\nimport \\\"../Pool.sol\\\";\\r\\n\\r\\ninterface IMirrorgateFeeLibrary {\\r\\n function getFees(\\r\\n uint256 _srcPoolId,\\r\\n uint256 _dstPoolId,\\r\\n uint16 _dstChainId,\\r\\n address _from,\\r\\n uint256 _amountSD\\r\\n ) external returns (Pool.SwapObj memory s);\\r\\n\\r\\n function getVersion() external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x1d89dcbe8d20534fac363a1c8542ca4a5223afc0efb8fbfa56fba9acbdd1cbd8\",\"license\":\"BUSL-1.1\"},\"contracts/libraries/MirrorgateFeeLibraryV01.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\r\\n\\r\\npragma solidity 0.7.6;\\r\\npragma abicoder v2;\\r\\n\\r\\nimport \\\"../interfaces/IMirrorgateFeeLibrary.sol\\\";\\r\\nimport \\\"../Pool.sol\\\";\\r\\nimport \\\"../Factory.sol\\\";\\r\\n// libraries\\r\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\r\\n\\r\\ncontract MirrorgateFeeLibraryV01 is IMirrorgateFeeLibrary, Ownable, ReentrancyGuard {\\r\\n using SafeMath for uint256;\\r\\n uint256 public constant BP_DENOMINATOR = 10000;\\r\\n\\r\\n constructor(address _factory) {\\r\\n require(_factory != address(0x0), \\\"FeeLibrary: Factory cannot be 0x0\\\");\\r\\n factory = Factory(_factory);\\r\\n }\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // VARIABLES\\r\\n Factory public factory;\\r\\n\\r\\n uint256 public lpFeeBP; // fee basis points for lp holders\\r\\n uint256 public protocolFeeBP; // fee basis points for xMirrorgate\\r\\n uint256 public eqFeeBP; // fee basis points for eqFeeBP\\r\\n uint256 public eqRewardBP; // fee basis points for eqRewardBP\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // EVENTS\\r\\n event FeesUpdated(uint256 lpFeeBP, uint256 protocolFeeBP);\\r\\n\\r\\n function getFees(\\r\\n uint256, /*_srcPoolId*/\\r\\n uint256, /*_dstPoolId*/\\r\\n uint16, /*_dstChainId*/\\r\\n address, /*_from*/\\r\\n uint256 _amountSD\\r\\n ) external view override returns (Pool.SwapObj memory s) {\\r\\n // calculate the xMirrorgate Fee.\\r\\n s.protocolFee = _amountSD.mul(protocolFeeBP).div(BP_DENOMINATOR);\\r\\n // calculate the LP fee. booked at remote\\r\\n s.lpFee = _amountSD.mul(lpFeeBP).div(BP_DENOMINATOR);\\r\\n // calculate the equilibrium Fee and reward\\r\\n s.eqFee = _amountSD.mul(eqFeeBP).div(BP_DENOMINATOR);\\r\\n s.eqReward = _amountSD.mul(eqRewardBP).div(BP_DENOMINATOR);\\r\\n return s;\\r\\n }\\r\\n\\r\\n function setFees(\\r\\n uint256 _lpFeeBP,\\r\\n uint256 _protocolFeeBP,\\r\\n uint256 _eqFeeBP,\\r\\n uint256 _eqRewardBP\\r\\n ) external onlyOwner {\\r\\n require(_lpFeeBP.add(_protocolFeeBP).add(_eqFeeBP).add(_eqRewardBP) <= BP_DENOMINATOR, \\\"FeeLibrary: sum fees > 100%\\\");\\r\\n require(eqRewardBP <= eqFeeBP, \\\"FeeLibrary: eq fee param incorrect\\\");\\r\\n lpFeeBP = _lpFeeBP;\\r\\n protocolFeeBP = _protocolFeeBP;\\r\\n eqFeeBP = _eqFeeBP;\\r\\n eqRewardBP = _eqRewardBP;\\r\\n emit FeesUpdated(lpFeeBP, protocolFeeBP);\\r\\n }\\r\\n\\r\\n function getVersion() external pure override returns (string memory) {\\r\\n return \\\"1.0.0\\\";\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x66b233a2639d3379c7b7527917b1bca815d9385b948edd138b25718f462e434c\",\"license\":\"BUSL-1.1\"}},\"version\":1}",
- "bytecode": "0x608060405234801561001057600080fd5b50604051610a8f380380610a8f83398101604081905261002f916100df565b60006100396100db565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180556001600160a01b0381166100b65760405162461bcd60e51b81526004016100ad9061010d565b60405180910390fd5b600280546001600160a01b0319166001600160a01b039290921691909117905561014e565b3390565b6000602082840312156100f0578081fd5b81516001600160a01b0381168114610106578182fd5b9392505050565b60208082526021908201527f4665654c6962726172793a20466163746f72792063616e6e6f742062652030786040820152600360fc1b606082015260800190565b6109328061015d6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c806398a6c1cf1161007157806398a6c1cf1461013e578063abe685cd14610146578063c45a01551461014e578063c5fba0b814610156578063cc95f9b71461015e578063f2fde38b14610166576100b4565b80630d8e6e2c146100b95780631ab62430146100d75780636fcba377146100f7578063715018a61461010c578063838aa646146101145780638da5cb5b14610129575b600080fd5b6100c1610179565b6040516100ce919061078e565b60405180910390f35b6100ea6100e53660046106f4565b610198565b6040516100ce919061085a565b61010a610105366004610749565b610220565b005b61010a61034c565b61011c61040a565b6040516100ce919061089e565b610131610410565b6040516100ce919061077a565b61011c61041f565b61011c610425565b61013161042b565b61011c61043a565b61011c610440565b61010a6101743660046106d3565b610446565b6040805180820190915260058152640312e302e360dc1b602082015290565b6101a0610681565b6101c16127106101bb6004548561055a90919063ffffffff16565b906105bc565b60808201526003546101dc90612710906101bb90859061055a565b60608201526005546101f790612710906101bb90859061055a565b602082015260065461021290612710906101bb90859061055a565b604082015295945050505050565b610228610623565b6001600160a01b0316610239610410565b6001600160a01b031614610294576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6127106102ad826102a785818989610627565b90610627565b11156102d45760405162461bcd60e51b81526004016102cb90610823565b60405180910390fd5b60055460065411156102f85760405162461bcd60e51b81526004016102cb906107e1565b60038490556004839055600582905560068190556040517f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a19061033e90869086906108a7565b60405180910390a150505050565b610354610623565b6001600160a01b0316610365610410565b6001600160a01b0316146103c0576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60065481565b6000546001600160a01b031690565b60035481565b61271081565b6002546001600160a01b031681565b60045481565b60055481565b61044e610623565b6001600160a01b031661045f610410565b6001600160a01b0316146104ba576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166104ff5760405162461bcd60e51b81526004018080602001828103825260268152602001806108b66026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600082610569575060006105b6565b8282028284828161057657fe5b04146105b35760405162461bcd60e51b81526004018080602001828103825260218152602001806108dc6021913960400191505060405180910390fd5b90505b92915050565b6000808211610612576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161061b57fe5b049392505050565b3390565b6000828201838110156105b3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b80356001600160a01b03811681146106ce57600080fd5b919050565b6000602082840312156106e4578081fd5b6106ed826106b7565b9392505050565b600080600080600060a0868803121561070b578081fd5b8535945060208601359350604086013561ffff8116811461072a578182fd5b9250610738606087016106b7565b949793965091946080013592915050565b6000806000806080858703121561075e578384fd5b5050823594602084013594506040840135936060013592509050565b6001600160a01b0391909116815260200190565b6000602080835283518082850152825b818110156107ba5785810183015185820160400152820161079e565b818111156107cb5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526022908201527f4665654c6962726172793a2065712066656520706172616d20696e636f72726560408201526118dd60f21b606082015260800190565b6020808252601b908201527f4665654c6962726172793a2073756d2066656573203e20313030250000000000604082015260600190565b600060c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b90815260200190565b91825260208201526040019056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220af682021426c5819aca7865ada9626c604cc54944e5e3fcc0230a65a2c6beb4464736f6c63430007060033",
- "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806398a6c1cf1161007157806398a6c1cf1461013e578063abe685cd14610146578063c45a01551461014e578063c5fba0b814610156578063cc95f9b71461015e578063f2fde38b14610166576100b4565b80630d8e6e2c146100b95780631ab62430146100d75780636fcba377146100f7578063715018a61461010c578063838aa646146101145780638da5cb5b14610129575b600080fd5b6100c1610179565b6040516100ce919061078e565b60405180910390f35b6100ea6100e53660046106f4565b610198565b6040516100ce919061085a565b61010a610105366004610749565b610220565b005b61010a61034c565b61011c61040a565b6040516100ce919061089e565b610131610410565b6040516100ce919061077a565b61011c61041f565b61011c610425565b61013161042b565b61011c61043a565b61011c610440565b61010a6101743660046106d3565b610446565b6040805180820190915260058152640312e302e360dc1b602082015290565b6101a0610681565b6101c16127106101bb6004548561055a90919063ffffffff16565b906105bc565b60808201526003546101dc90612710906101bb90859061055a565b60608201526005546101f790612710906101bb90859061055a565b602082015260065461021290612710906101bb90859061055a565b604082015295945050505050565b610228610623565b6001600160a01b0316610239610410565b6001600160a01b031614610294576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6127106102ad826102a785818989610627565b90610627565b11156102d45760405162461bcd60e51b81526004016102cb90610823565b60405180910390fd5b60055460065411156102f85760405162461bcd60e51b81526004016102cb906107e1565b60038490556004839055600582905560068190556040517f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a19061033e90869086906108a7565b60405180910390a150505050565b610354610623565b6001600160a01b0316610365610410565b6001600160a01b0316146103c0576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60065481565b6000546001600160a01b031690565b60035481565b61271081565b6002546001600160a01b031681565b60045481565b60055481565b61044e610623565b6001600160a01b031661045f610410565b6001600160a01b0316146104ba576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166104ff5760405162461bcd60e51b81526004018080602001828103825260268152602001806108b66026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600082610569575060006105b6565b8282028284828161057657fe5b04146105b35760405162461bcd60e51b81526004018080602001828103825260218152602001806108dc6021913960400191505060405180910390fd5b90505b92915050565b6000808211610612576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161061b57fe5b049392505050565b3390565b6000828201838110156105b3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b80356001600160a01b03811681146106ce57600080fd5b919050565b6000602082840312156106e4578081fd5b6106ed826106b7565b9392505050565b600080600080600060a0868803121561070b578081fd5b8535945060208601359350604086013561ffff8116811461072a578182fd5b9250610738606087016106b7565b949793965091946080013592915050565b6000806000806080858703121561075e578384fd5b5050823594602084013594506040840135936060013592509050565b6001600160a01b0391909116815260200190565b6000602080835283518082850152825b818110156107ba5785810183015185820160400152820161079e565b818111156107cb5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526022908201527f4665654c6962726172793a2065712066656520706172616d20696e636f72726560408201526118dd60f21b606082015260800190565b6020808252601b908201527f4665654c6962726172793a2073756d2066656573203e20313030250000000000604082015260600190565b600060c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b90815260200190565b91825260208201526040019056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220af682021426c5819aca7865ada9626c604cc54944e5e3fcc0230a65a2c6beb4464736f6c63430007060033",
- "devdoc": {
- "kind": "dev",
- "methods": {
- "owner()": {
- "details": "Returns the address of the current owner."
- },
- "renounceOwnership()": {
- "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner."
- },
- "transferOwnership(address)": {
- "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner."
- }
- },
- "version": 1
- },
- "userdoc": {
- "kind": "user",
- "methods": {},
- "version": 1
- },
- "storageLayout": {
- "storage": [
- {
- "astId": 7,
- "contract": "contracts/libraries/MirrorgateFeeLibraryV01.sol:MirrorgateFeeLibraryV01",
- "label": "_owner",
- "offset": 0,
- "slot": "0",
- "type": "t_address"
- },
- {
- "astId": 2080,
- "contract": "contracts/libraries/MirrorgateFeeLibraryV01.sol:MirrorgateFeeLibraryV01",
- "label": "_status",
- "offset": 0,
- "slot": "1",
- "type": "t_uint256"
- },
- {
- "astId": 10208,
- "contract": "contracts/libraries/MirrorgateFeeLibraryV01.sol:MirrorgateFeeLibraryV01",
- "label": "factory",
- "offset": 0,
- "slot": "2",
- "type": "t_contract(Factory)3328"
- },
- {
- "astId": 10210,
- "contract": "contracts/libraries/MirrorgateFeeLibraryV01.sol:MirrorgateFeeLibraryV01",
- "label": "lpFeeBP",
- "offset": 0,
- "slot": "3",
- "type": "t_uint256"
- },
- {
- "astId": 10212,
- "contract": "contracts/libraries/MirrorgateFeeLibraryV01.sol:MirrorgateFeeLibraryV01",
- "label": "protocolFeeBP",
- "offset": 0,
- "slot": "4",
- "type": "t_uint256"
- },
- {
- "astId": 10214,
- "contract": "contracts/libraries/MirrorgateFeeLibraryV01.sol:MirrorgateFeeLibraryV01",
- "label": "eqFeeBP",
- "offset": 0,
- "slot": "5",
- "type": "t_uint256"
- },
- {
- "astId": 10216,
- "contract": "contracts/libraries/MirrorgateFeeLibraryV01.sol:MirrorgateFeeLibraryV01",
- "label": "eqRewardBP",
- "offset": 0,
- "slot": "6",
- "type": "t_uint256"
- }
- ],
- "types": {
- "t_address": {
- "encoding": "inplace",
- "label": "address",
- "numberOfBytes": "20"
- },
- "t_contract(Factory)3328": {
- "encoding": "inplace",
- "label": "contract Factory",
- "numberOfBytes": "20"
- },
- "t_uint256": {
- "encoding": "inplace",
- "label": "uint256",
- "numberOfBytes": "32"
- }
- }
- }
- }
|