123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438 |
- {
- "address": "0xD33a713A7F5c517026111687ECd8545a993c1DB5",
- "abi": [
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_factory",
- "type": "address"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "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": "DELTA_1",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "DELTA_2",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "DENOMINATOR",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "LAMBDA_1",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "LAMBDA_2",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "LP_FEE",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "PROTOCOL_FEE",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "PROTOCOL_SUBSIDY",
- "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": "idealBalance",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "beforeBalance",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amountSD",
- "type": "uint256"
- }
- ],
- "name": "getEquilibriumFee",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "pure",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "_srcPoolId",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "_dstPoolId",
- "type": "uint256"
- },
- {
- "internalType": "uint16",
- "name": "_dstChainId",
- "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": [
- {
- "internalType": "uint256",
- "name": "lambda",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "yOffset",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "xUpperBound",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "xLowerBound",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "xStart",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "xEnd",
- "type": "uint256"
- }
- ],
- "name": "getTrapezoidArea",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "pure",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getVersion",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "pure",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "owner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "renounceOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "transferOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- }
- ],
- "transactionHash": "0x9a59a4709ff02388d2bd1a730b12679721c2b3efe97aa10449b65e40c39d719b",
- "receipt": {
- "to": null,
- "from": "0x368715F09C1AB5E0B55bF5bA19cD887189A28DBE",
- "contractAddress": "0xD33a713A7F5c517026111687ECd8545a993c1DB5",
- "transactionIndex": 1,
- "gasUsed": "52120719",
- "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000010000000000000000000000000080000000000000000000000000004000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000001000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000",
- "blockHash": "0x69e8bc6a07f12fecad22e0cb5eef1d42f402adfc92184bc061f85597fa8601a7",
- "transactionHash": "0x9a59a4709ff02388d2bd1a730b12679721c2b3efe97aa10449b65e40c39d719b",
- "logs": [
- {
- "transactionIndex": 1,
- "blockNumber": 14285025,
- "transactionHash": "0x9a59a4709ff02388d2bd1a730b12679721c2b3efe97aa10449b65e40c39d719b",
- "address": "0xD33a713A7F5c517026111687ECd8545a993c1DB5",
- "topics": [
- "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
- "0x0000000000000000000000000000000000000000000000000000000000000000",
- "0x000000000000000000000000368715f09c1ab5e0b55bf5ba19cd887189a28dbe"
- ],
- "data": "0x",
- "logIndex": 0,
- "blockHash": "0x69e8bc6a07f12fecad22e0cb5eef1d42f402adfc92184bc061f85597fa8601a7"
- }
- ],
- "blockNumber": 14285025,
- "cumulativeGasUsed": "52120719",
- "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\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DELTA_1\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DELTA_2\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DENOMINATOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"LAMBDA_1\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"LAMBDA_2\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"LP_FEE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PROTOCOL_FEE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PROTOCOL_SUBSIDY\",\"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\":\"idealBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"beforeBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountSD\",\"type\":\"uint256\"}],\"name\":\"getEquilibriumFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_srcPoolId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_dstPoolId\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"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\":[{\"internalType\":\"uint256\",\"name\":\"lambda\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"yOffset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"xUpperBound\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"xLowerBound\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"xStart\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"xEnd\",\"type\":\"uint256\"}],\"name\":\"getTrapezoidArea\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"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/MirrorgateFeeLibraryV02.sol\":\"MirrorgateFeeLibraryV02\"},\"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/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0xbd74f587ab9b9711801baf667db1426e4a03fd2d7f15af33e0e0d0394e7cef76\",\"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/MirrorgateFeeLibraryV02.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\\r\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\n\\r\\ncontract MirrorgateFeeLibraryV02 is IMirrorgateFeeLibrary, Ownable, ReentrancyGuard {\\r\\n using SafeMath for uint256;\\r\\n\\r\\n //---------------------------------------------------------------------------\\r\\n // VARIABLES\\r\\n\\r\\n // equilibrium func params. all in BPs * 10 ^ 2, i.e. 1 % = 10 ^ 6 units\\r\\n uint256 public constant DENOMINATOR = 1e18;\\r\\n uint256 public constant DELTA_1 = 6000 * 1e14;\\r\\n uint256 public constant DELTA_2 = 500 * 1e14;\\r\\n uint256 public constant LAMBDA_1 = 40 * 1e14;\\r\\n uint256 public constant LAMBDA_2 = 9960 * 1e14;\\r\\n uint256 public constant LP_FEE = 45 * 1e13;\\r\\n uint256 public constant PROTOCOL_FEE = 15 * 1e13;\\r\\n uint256 public constant PROTOCOL_SUBSIDY = 3 * 1e13;\\r\\n\\r\\n Factory public immutable factory;\\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 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 protocol fee\\r\\n s.protocolFee = _amountSD.mul(PROTOCOL_FEE).div(DENOMINATOR);\\r\\n\\r\\n // calculate the equilibrium Fee\\r\\n Pool pool = factory.getPool(_srcPoolId);\\r\\n Pool.ChainPath memory chainPath = pool.getChainPath(_dstChainId, _dstPoolId);\\r\\n\\r\\n // calculate the equilibrium fee\\r\\n (uint256 eqFee, uint256 protocolSubsidy) = _getEquilibriumFee(chainPath.idealBalance, chainPath.balance, _amountSD);\\r\\n s.eqFee = eqFee;\\r\\n s.protocolFee = s.protocolFee.sub(protocolSubsidy);\\r\\n\\r\\n // calculate the equilibrium reward\\r\\n address tokenAddress = pool.token();\\r\\n uint256 currentAssetSD = IERC20(tokenAddress).balanceOf(address(pool)).div(pool.convertRate());\\r\\n uint256 lpAsset = pool.totalLiquidity();\\r\\n if (lpAsset > currentAssetSD) {\\r\\n // in deficit\\r\\n uint256 poolDeficit = lpAsset.sub(currentAssetSD);\\r\\n uint256 rewardPoolSize = pool.eqFeePool();\\r\\n // reward capped at rewardPoolSize\\r\\n uint256 eqRewards = rewardPoolSize.mul(_amountSD).div(poolDeficit);\\r\\n if (eqRewards > rewardPoolSize) {\\r\\n eqRewards = rewardPoolSize;\\r\\n }\\r\\n s.eqReward = eqRewards;\\r\\n }\\r\\n\\r\\n // calculate the LP fee.\\r\\n s.lpFee = _amountSD.mul(LP_FEE).div(DENOMINATOR);\\r\\n\\r\\n return s;\\r\\n }\\r\\n\\r\\n function getEquilibriumFee(\\r\\n uint256 idealBalance,\\r\\n uint256 beforeBalance,\\r\\n uint256 amountSD\\r\\n ) external pure returns (uint256, uint256) {\\r\\n return _getEquilibriumFee(idealBalance, beforeBalance, amountSD);\\r\\n }\\r\\n\\r\\n function getTrapezoidArea(\\r\\n uint256 lambda,\\r\\n uint256 yOffset,\\r\\n uint256 xUpperBound,\\r\\n uint256 xLowerBound,\\r\\n uint256 xStart,\\r\\n uint256 xEnd\\r\\n ) external pure returns (uint256) {\\r\\n return _getTrapezoidArea(lambda, yOffset, xUpperBound, xLowerBound, xStart, xEnd);\\r\\n }\\r\\n\\r\\n function _getEquilibriumFee(\\r\\n uint256 idealBalance,\\r\\n uint256 beforeBalance,\\r\\n uint256 amountSD\\r\\n ) internal pure returns (uint256, uint256) {\\r\\n require(beforeBalance >= amountSD, \\\"Mirrorgate: not enough balance\\\");\\r\\n uint256 afterBalance = beforeBalance.sub(amountSD);\\r\\n\\r\\n uint256 safeZoneMax = idealBalance.mul(DELTA_1).div(DENOMINATOR);\\r\\n uint256 safeZoneMin = idealBalance.mul(DELTA_2).div(DENOMINATOR);\\r\\n\\r\\n uint256 eqFee = 0;\\r\\n uint256 protocolSubsidy = 0;\\r\\n\\r\\n if (afterBalance >= safeZoneMax) {\\r\\n // no fee zone, protocol subsidize it.\\r\\n eqFee = amountSD.mul(PROTOCOL_SUBSIDY).div(DENOMINATOR);\\r\\n protocolSubsidy = eqFee;\\r\\n } else if (afterBalance >= safeZoneMin) {\\r\\n // safe zone\\r\\n uint256 proxyBeforeBalance = beforeBalance < safeZoneMax ? beforeBalance : safeZoneMax;\\r\\n eqFee = _getTrapezoidArea(LAMBDA_1, 0, safeZoneMax, safeZoneMin, proxyBeforeBalance, afterBalance);\\r\\n } else {\\r\\n // danger zone\\r\\n if (beforeBalance >= safeZoneMin) {\\r\\n // across 2 or 3 zones\\r\\n // part 1\\r\\n uint256 proxyBeforeBalance = beforeBalance < safeZoneMax ? beforeBalance : safeZoneMax;\\r\\n eqFee = eqFee.add(_getTrapezoidArea(LAMBDA_1, 0, safeZoneMax, safeZoneMin, proxyBeforeBalance, safeZoneMin));\\r\\n // part 2\\r\\n eqFee = eqFee.add(_getTrapezoidArea(LAMBDA_2, LAMBDA_1, safeZoneMin, 0, safeZoneMin, afterBalance));\\r\\n } else {\\r\\n // only in danger zone\\r\\n // part 2 only\\r\\n eqFee = eqFee.add(_getTrapezoidArea(LAMBDA_2, LAMBDA_1, safeZoneMin, 0, beforeBalance, afterBalance));\\r\\n }\\r\\n }\\r\\n return (eqFee, protocolSubsidy);\\r\\n }\\r\\n\\r\\n function _getTrapezoidArea(\\r\\n uint256 lambda,\\r\\n uint256 yOffset,\\r\\n uint256 xUpperBound,\\r\\n uint256 xLowerBound,\\r\\n uint256 xStart,\\r\\n uint256 xEnd\\r\\n ) internal pure returns (uint256) {\\r\\n require(xEnd >= xLowerBound && xStart <= xUpperBound, \\\"Mirrorgate: balance out of bound\\\");\\r\\n uint256 xBoundWidth = xUpperBound.sub(xLowerBound);\\r\\n\\r\\n // xStartDrift = xUpperBound.sub(xStart);\\r\\n uint256 yStart = xUpperBound.sub(xStart).mul(lambda).div(xBoundWidth).add(yOffset);\\r\\n\\r\\n // xEndDrift = xUpperBound.sub(xEnd)\\r\\n uint256 yEnd = xUpperBound.sub(xEnd).mul(lambda).div(xBoundWidth).add(yOffset);\\r\\n\\r\\n // compute the area\\r\\n uint256 deltaX = xStart.sub(xEnd);\\r\\n return yStart.add(yEnd).mul(deltaX).div(2).div(DENOMINATOR);\\r\\n }\\r\\n\\r\\n function getVersion() external pure override returns (string memory) {\\r\\n return \\\"2.0.0\\\";\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x47f44ce520faa6db075fdc409e21013cd633508d036705484493a982ada3a3a0\",\"license\":\"BUSL-1.1\"}},\"version\":1}",
- "bytecode": "0x60a060405234801561001057600080fd5b506040516111f53803806111f583398101604081905261002f916100cf565b60006100396100cb565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180556001600160a01b0381166100b65760405162461bcd60e51b81526004016100ad906100fd565b60405180910390fd5b60601b6001600160601b03191660805261013e565b3390565b6000602082840312156100e0578081fd5b81516001600160a01b03811681146100f6578182fd5b9392505050565b60208082526021908201527f4665654c6962726172793a20466163746f72792063616e6e6f742062652030786040820152600360fc1b606082015260800190565b60805160601c6110956101606000398061027c52806107c752506110956000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c806360d86e7711610097578063918f867411610066578063918f8674146101d3578063a810de6c146101db578063c45a0155146101e3578063f2fde38b146101eb57610100565b806360d86e7714610199578063715018a6146101ac5780637ba5c12f146101b65780638da5cb5b146101be57610100565b806334b6a602116100d357806334b6a602146101605780633dad0dd514610181578063518a9f9f146101895780635e3f27271461019157610100565b8063012a1c2d146101055780630b4501fd146101235780630d8e6e2c1461012b5780631ab6243014610140575b600080fd5b61010d6101fe565b60405161011a9190610fd9565b60405180910390f35b61010d61020a565b610133610214565b60405161011a9190610ec2565b61015361014e366004610df0565b610233565b60405161011a9190610f81565b61017361016e366004610e41565b610680565b60405161011a929190610fe2565b61010d61069a565b61010d6106a6565b61010d6106b1565b61010d6101a7366004610e6c565b6106bc565b6101b46106d7565b005b61010d610795565b6101c661079f565b60405161011a9190610eae565b61010d6107ae565b61010d6107ba565b6101c66107c5565b6101b46101f9366004610d09565b6107e9565b670dd280b9144a000081565b65886c98b7600081565b6040805180820190915260058152640322e302e360dc1b602082015290565b61023b610cb3565b61025d670de0b6b3a76400006102578465886c98b760006108fd565b9061095f565b608082015260405163068bcd8d60e01b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063068bcd8d906102b1908a90600401610fd9565b60206040518083038186803b1580156102c957600080fd5b505afa1580156102dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103019190610d25565b90506000816001600160a01b031663159f6add87896040518363ffffffff1660e01b8152600401610333929190610fc5565b6101006040518083038186803b15801561034c57600080fd5b505afa158015610360573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103849190610d41565b905060008061039c8360e001518460800151886109c6565b60208701829052608087015191935091506103b79082610b42565b8560800181815250506000846001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103fb57600080fd5b505afa15801561040f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104339190610d25565b90506000610527866001600160a01b031663feb56b156040518163ffffffff1660e01b815260040160206040518083038186803b15801561047357600080fd5b505afa158015610487573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ab9190610dd8565b6040516370a0823160e01b81526001600160a01b038516906370a08231906104d7908b90600401610eae565b60206040518083038186803b1580156104ef57600080fd5b505afa158015610503573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102579190610dd8565b90506000866001600160a01b03166315770f926040518163ffffffff1660e01b815260040160206040518083038186803b15801561056457600080fd5b505afa158015610578573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059c9190610dd8565b90508181111561064e5760006105b28284610b42565b90506000886001600160a01b0316639bb811196040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190610dd8565b9050600061063983610257848f6108fd565b9050818111156106465750805b60408b015250505b61066b670de0b6b3a76400006102578b66019945ca2620006108fd565b60608901525050505050505095945050505050565b60008061068e8585856109c6565b91509150935093915050565b670853a0d2313c000081565b66b1a2bc2ec5000081565b66019945ca26200081565b60006106cc878787878787610b9f565b979650505050505050565b6106df610c55565b6001600160a01b03166106f061079f565b6001600160a01b03161461074b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b651b48eb57e00081565b6000546001600160a01b031690565b670de0b6b3a764000081565b660e35fa931a000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6107f1610c55565b6001600160a01b031661080261079f565b6001600160a01b03161461085d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166108a25760405162461bcd60e51b81526004018080602001828103825260268152602001806110196026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008261090c57506000610959565b8282028284828161091957fe5b04146109565760405162461bcd60e51b815260040180806020018281038252602181526020018061103f6021913960400191505060405180910390fd5b90505b92915050565b60008082116109b5576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816109be57fe5b049392505050565b600080828410156109f25760405162461bcd60e51b81526004016109e990610f15565b60405180910390fd5b60006109fe8585610b42565b90506000610a20670de0b6b3a764000061025789670853a0d2313c00006108fd565b90506000610a41670de0b6b3a76400006102578a66b1a2bc2ec500006108fd565b9050600080838510610a7357610a69670de0b6b3a76400006102578a651b48eb57e0006108fd565b9150819050610b33565b828510610aab576000848a10610a895784610a8b565b895b9050610aa3660e35fa931a000060008787858b610b9f565b925050610b33565b828910610b08576000848a10610ac15784610ac3565b895b9050610ae5610ade660e35fa931a000060008888868a610b9f565b8490610c59565b9250610aa3610ade670dd280b9144a0000660e35fa931a0000876000898c610b9f565b610b30610b29670dd280b9144a0000660e35fa931a00008660008e8b610b9f565b8390610c59565b91505b90999098509650505050505050565b600082821115610b99576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000838210158015610bb15750848311155b610bcd5760405162461bcd60e51b81526004016109e990610f4c565b6000610bd98686610b42565b90506000610bff88610bf9846102578d610bf38d8c610b42565b906108fd565b90610c59565b90506000610c1989610bf9856102578e610bf38e8c610b42565b90506000610c278787610b42565b9050610c46670de0b6b3a764000061025760028185610bf38989610c59565b9b9a5050505050505050505050565b3390565b600082820183811015610956576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b80518015158114610cf957600080fd5b919050565b8051610cf981611008565b600060208284031215610d1a578081fd5b813561095681610ff0565b600060208284031215610d36578081fd5b815161095681610ff0565b6000610100808385031215610d54578182fd5b6040519081019067ffffffffffffffff82118183101715610d7157fe5b81604052610d7e84610ce9565b8152610d8c60208501610cfe565b602082015260408401516040820152606084015160608201526080840151608082015260a084015160a082015260c084015160c082015260e084015160e0820152809250505092915050565b600060208284031215610de9578081fd5b5051919050565b600080600080600060a08688031215610e07578081fd5b85359450602086013593506040860135610e2081611008565b92506060860135610e3081610ff0565b949793965091946080013592915050565b600080600060608486031215610e55578283fd5b505081359360208301359350604090920135919050565b60008060008060008060c08789031215610e84578081fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6001600160a01b0391909116815260200190565b6000602080835283518082850152825b81811015610eee57858101830151858201604001528201610ed2565b81811115610eff5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252601e908201527f4d6972726f72676174653a206e6f7420656e6f7567682062616c616e63650000604082015260600190565b6020808252818101527f4d6972726f72676174653a2062616c616e6365206f7574206f6620626f756e64604082015260600190565b600060c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b61ffff929092168252602082015260400190565b90815260200190565b918252602082015260400190565b6001600160a01b038116811461100557600080fd5b50565b61ffff8116811461100557600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220adf0b1f8718b20c86c8448b644e1a759e46fb53cd1ca56786fe78edb8fbc706a64736f6c63430007060033",
- "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101005760003560e01c806360d86e7711610097578063918f867411610066578063918f8674146101d3578063a810de6c146101db578063c45a0155146101e3578063f2fde38b146101eb57610100565b806360d86e7714610199578063715018a6146101ac5780637ba5c12f146101b65780638da5cb5b146101be57610100565b806334b6a602116100d357806334b6a602146101605780633dad0dd514610181578063518a9f9f146101895780635e3f27271461019157610100565b8063012a1c2d146101055780630b4501fd146101235780630d8e6e2c1461012b5780631ab6243014610140575b600080fd5b61010d6101fe565b60405161011a9190610fd9565b60405180910390f35b61010d61020a565b610133610214565b60405161011a9190610ec2565b61015361014e366004610df0565b610233565b60405161011a9190610f81565b61017361016e366004610e41565b610680565b60405161011a929190610fe2565b61010d61069a565b61010d6106a6565b61010d6106b1565b61010d6101a7366004610e6c565b6106bc565b6101b46106d7565b005b61010d610795565b6101c661079f565b60405161011a9190610eae565b61010d6107ae565b61010d6107ba565b6101c66107c5565b6101b46101f9366004610d09565b6107e9565b670dd280b9144a000081565b65886c98b7600081565b6040805180820190915260058152640322e302e360dc1b602082015290565b61023b610cb3565b61025d670de0b6b3a76400006102578465886c98b760006108fd565b9061095f565b608082015260405163068bcd8d60e01b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063068bcd8d906102b1908a90600401610fd9565b60206040518083038186803b1580156102c957600080fd5b505afa1580156102dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103019190610d25565b90506000816001600160a01b031663159f6add87896040518363ffffffff1660e01b8152600401610333929190610fc5565b6101006040518083038186803b15801561034c57600080fd5b505afa158015610360573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103849190610d41565b905060008061039c8360e001518460800151886109c6565b60208701829052608087015191935091506103b79082610b42565b8560800181815250506000846001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103fb57600080fd5b505afa15801561040f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104339190610d25565b90506000610527866001600160a01b031663feb56b156040518163ffffffff1660e01b815260040160206040518083038186803b15801561047357600080fd5b505afa158015610487573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ab9190610dd8565b6040516370a0823160e01b81526001600160a01b038516906370a08231906104d7908b90600401610eae565b60206040518083038186803b1580156104ef57600080fd5b505afa158015610503573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102579190610dd8565b90506000866001600160a01b03166315770f926040518163ffffffff1660e01b815260040160206040518083038186803b15801561056457600080fd5b505afa158015610578573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059c9190610dd8565b90508181111561064e5760006105b28284610b42565b90506000886001600160a01b0316639bb811196040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190610dd8565b9050600061063983610257848f6108fd565b9050818111156106465750805b60408b015250505b61066b670de0b6b3a76400006102578b66019945ca2620006108fd565b60608901525050505050505095945050505050565b60008061068e8585856109c6565b91509150935093915050565b670853a0d2313c000081565b66b1a2bc2ec5000081565b66019945ca26200081565b60006106cc878787878787610b9f565b979650505050505050565b6106df610c55565b6001600160a01b03166106f061079f565b6001600160a01b03161461074b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b651b48eb57e00081565b6000546001600160a01b031690565b670de0b6b3a764000081565b660e35fa931a000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6107f1610c55565b6001600160a01b031661080261079f565b6001600160a01b03161461085d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166108a25760405162461bcd60e51b81526004018080602001828103825260268152602001806110196026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008261090c57506000610959565b8282028284828161091957fe5b04146109565760405162461bcd60e51b815260040180806020018281038252602181526020018061103f6021913960400191505060405180910390fd5b90505b92915050565b60008082116109b5576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816109be57fe5b049392505050565b600080828410156109f25760405162461bcd60e51b81526004016109e990610f15565b60405180910390fd5b60006109fe8585610b42565b90506000610a20670de0b6b3a764000061025789670853a0d2313c00006108fd565b90506000610a41670de0b6b3a76400006102578a66b1a2bc2ec500006108fd565b9050600080838510610a7357610a69670de0b6b3a76400006102578a651b48eb57e0006108fd565b9150819050610b33565b828510610aab576000848a10610a895784610a8b565b895b9050610aa3660e35fa931a000060008787858b610b9f565b925050610b33565b828910610b08576000848a10610ac15784610ac3565b895b9050610ae5610ade660e35fa931a000060008888868a610b9f565b8490610c59565b9250610aa3610ade670dd280b9144a0000660e35fa931a0000876000898c610b9f565b610b30610b29670dd280b9144a0000660e35fa931a00008660008e8b610b9f565b8390610c59565b91505b90999098509650505050505050565b600082821115610b99576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000838210158015610bb15750848311155b610bcd5760405162461bcd60e51b81526004016109e990610f4c565b6000610bd98686610b42565b90506000610bff88610bf9846102578d610bf38d8c610b42565b906108fd565b90610c59565b90506000610c1989610bf9856102578e610bf38e8c610b42565b90506000610c278787610b42565b9050610c46670de0b6b3a764000061025760028185610bf38989610c59565b9b9a5050505050505050505050565b3390565b600082820183811015610956576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b80518015158114610cf957600080fd5b919050565b8051610cf981611008565b600060208284031215610d1a578081fd5b813561095681610ff0565b600060208284031215610d36578081fd5b815161095681610ff0565b6000610100808385031215610d54578182fd5b6040519081019067ffffffffffffffff82118183101715610d7157fe5b81604052610d7e84610ce9565b8152610d8c60208501610cfe565b602082015260408401516040820152606084015160608201526080840151608082015260a084015160a082015260c084015160c082015260e084015160e0820152809250505092915050565b600060208284031215610de9578081fd5b5051919050565b600080600080600060a08688031215610e07578081fd5b85359450602086013593506040860135610e2081611008565b92506060860135610e3081610ff0565b949793965091946080013592915050565b600080600060608486031215610e55578283fd5b505081359360208301359350604090920135919050565b60008060008060008060c08789031215610e84578081fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6001600160a01b0391909116815260200190565b6000602080835283518082850152825b81811015610eee57858101830151858201604001528201610ed2565b81811115610eff5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252601e908201527f4d6972726f72676174653a206e6f7420656e6f7567682062616c616e63650000604082015260600190565b6020808252818101527f4d6972726f72676174653a2062616c616e6365206f7574206f6620626f756e64604082015260600190565b600060c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b61ffff929092168252602082015260400190565b90815260200190565b918252602082015260400190565b6001600160a01b038116811461100557600080fd5b50565b61ffff8116811461100557600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220adf0b1f8718b20c86c8448b644e1a759e46fb53cd1ca56786fe78edb8fbc706a64736f6c63430007060033",
- "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/MirrorgateFeeLibraryV02.sol:MirrorgateFeeLibraryV02",
- "label": "_owner",
- "offset": 0,
- "slot": "0",
- "type": "t_address"
- },
- {
- "astId": 2080,
- "contract": "contracts/libraries/MirrorgateFeeLibraryV02.sol:MirrorgateFeeLibraryV02",
- "label": "_status",
- "offset": 0,
- "slot": "1",
- "type": "t_uint256"
- }
- ],
- "types": {
- "t_address": {
- "encoding": "inplace",
- "label": "address",
- "numberOfBytes": "20"
- },
- "t_uint256": {
- "encoding": "inplace",
- "label": "uint256",
- "numberOfBytes": "32"
- }
- }
- }
- }
|