{ "address": "0x7452c558d45f8afC8c83dAe62C3f8A5BE19c71f6", "abi": [ { "inputs": [ { "internalType": "contract RoleStore", "name": "_roleStore", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [ { "internalType": "address", "name": "msgSender", "type": "address" }, { "internalType": "string", "name": "role", "type": "string" } ], "name": "Unauthorized", "type": "error" }, { "inputs": [ { "internalType": "address", "name": "token", "type": "address" }, { "internalType": "address", "name": "account", "type": "address" }, { "internalType": "address", "name": "receiver", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "pluginTransfer", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "roleStore", "outputs": [ { "internalType": "contract RoleStore", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" } ], "transactionHash": "0x1e716f84bfa23bfe11771689866524990d59f148e757aba2d16243ac7e820985", "receipt": { "to": null, "from": "0xE7BfFf2aB721264887230037940490351700a068", "contractAddress": "0x7452c558d45f8afC8c83dAe62C3f8A5BE19c71f6", "transactionIndex": 1, "gasUsed": "2708602", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "blockHash": "0x54932ea0cd7ec7d2061854b7c8ef3ebeb1d1238dd1a4e6855bf51eb9cd939f7c", "transactionHash": "0x1e716f84bfa23bfe11771689866524990d59f148e757aba2d16243ac7e820985", "logs": [], "blockNumber": 107745499, "cumulativeGasUsed": "2708602", "status": 1, "byzantium": true }, "args": [ "0x3c3d99FD298f679DBC2CEcd132b4eC4d0F5e6e72" ], "numDeployments": 1, "solcInputHash": "8c38905f7fa580b3f5fcce85ee3cb071", "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract RoleStore\",\"name\":\"_roleStore\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"msgSender\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"role\",\"type\":\"string\"}],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"pluginTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roleStore\",\"outputs\":[{\"internalType\":\"contract RoleStore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Users will approve this router for token spenditures\",\"kind\":\"dev\",\"methods\":{\"pluginTransfer(address,address,address,uint256)\":{\"details\":\"transfer the specified amount of tokens from the account to the receiver\",\"params\":{\"account\":\"the account to transfer from\",\"amount\":\"the amount of tokens to transfer\",\"receiver\":\"the account to transfer to\",\"token\":\"the token to transfer\"}}},\"title\":\"Router\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/router/Router.sol\":\"Router\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\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 /**\\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 `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, 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 `from` to `to` 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n return _values(set._inner);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x5050943b32b6a8f282573d166b2e9d87ab7eb4dbba4ab6acf36ecb54fe6995e4\",\"license\":\"MIT\"},\"contracts/error/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Errors {\\n // AdlUtils errors\\n error InvalidSizeDeltaForAdl(uint256 sizeDeltaUsd, uint256 positionSizeInUsd);\\n error AdlNotEnabled();\\n\\n // Bank errors\\n error SelfTransferNotSupported(address receiver);\\n error InvalidNativeTokenSender(address msgSender);\\n\\n // CallbackUtils errors\\n error MaxCallbackGasLimitExceeded(uint256 callbackGasLimit, uint256 maxCallbackGasLimit);\\n\\n // Config errors\\n error InvalidBaseKey(bytes32 baseKey);\\n error InvalidFeeFactor(bytes32 baseKey, uint256 value);\\n\\n // Timelock errors\\n error ActionAlreadySignalled();\\n error ActionNotSignalled();\\n error SignalTimeNotYetPassed(uint256 signalTime);\\n error InvalidTimelockDelay(uint256 timelockDelay);\\n error MaxTimelockDelayExceeded(uint256 timelockDelay);\\n error InvalidFeeReceiver(address receiver);\\n error InvalidOracleSigner(address receiver);\\n\\n // DepositStoreUtils errors\\n error DepositNotFound(bytes32 key);\\n\\n // DepositUtils errors\\n error EmptyDeposit();\\n error EmptyDepositAmounts();\\n\\n // ExecuteDepositUtils errors\\n error MinMarketTokens(uint256 received, uint256 expected);\\n error EmptyDepositAmountsAfterSwap();\\n error InvalidPoolValueForDeposit(int256 poolValue);\\n error InvalidSwapOutputToken(address outputToken, address expectedOutputToken);\\n\\n // AdlHandler errors\\n error AdlNotRequired(int256 pnlToPoolFactor, uint256 maxPnlFactorForAdl);\\n error InvalidAdl(int256 nextPnlToPoolFactor, int256 pnlToPoolFactor);\\n error PnlOvercorrected(int256 nextPnlToPoolFactor, uint256 minPnlFactorForAdl);\\n\\n // ExchangeUtils errors\\n error RequestNotYetCancellable(uint256 requestAge, uint256 requestExpirationAge, string requestType);\\n\\n // OrderHandler errors\\n error OrderNotUpdatable(uint256 orderType);\\n error InvalidKeeperForFrozenOrder(address keeper);\\n\\n // FeatureUtils errors\\n error DisabledFeature(bytes32 key);\\n\\n // FeeHandler errors\\n error InvalidClaimFeesInput(uint256 marketsLength, uint256 tokensLength);\\n\\n // GasUtils errors\\n error InsufficientExecutionFee(uint256 minExecutionFee, uint256 executionFee);\\n error InsufficientWntAmountForExecutionFee(uint256 wntAmount, uint256 executionFee);\\n error InsufficientExecutionGas(uint256 startingGas, uint256 minHandleErrorGas);\\n\\n // MarketFactory errors\\n error MarketAlreadyExists(bytes32 salt, address existingMarketAddress);\\n\\n // MarketStoreUtils errors\\n error MarketNotFound(address key);\\n\\n // MarketUtils errors\\n error EmptyMarket();\\n error DisabledMarket(address market);\\n error MaxSwapPathLengthExceeded(uint256 swapPathLengh, uint256 maxSwapPathLength);\\n error InsufficientPoolAmount(uint256 poolAmount, uint256 amount);\\n error InsufficientReserve(uint256 reservedUsd, uint256 maxReservedUsd);\\n error InsufficientReserveForOpenInterest(uint256 reservedUsd, uint256 maxReservedUsd);\\n error UnableToGetOppositeToken(address inputToken, address market);\\n error UnexpectedTokenForVirtualInventory(address token, address market);\\n error EmptyMarketTokenSupply();\\n error InvalidSwapMarket(address market);\\n error UnableToGetCachedTokenPrice(address token, address market);\\n error CollateralAlreadyClaimed(uint256 adjustedClaimableAmount, uint256 claimedAmount);\\n error OpenInterestCannotBeUpdatedForSwapOnlyMarket(address market);\\n error MaxOpenInterestExceeded(uint256 openInterest, uint256 maxOpenInterest);\\n error MaxPoolAmountExceeded(uint256 poolAmount, uint256 maxPoolAmount);\\n error UnexpectedBorrowingFactor(uint256 positionBorrowingFactor, uint256 cumulativeBorrowingFactor);\\n error UnableToGetBorrowingFactorEmptyPoolUsd();\\n error UnableToGetFundingFactorEmptyOpenInterest();\\n error InvalidPositionMarket(address market);\\n error InvalidCollateralTokenForMarket(address market, address token);\\n error PnlFactorExceededForLongs(int256 pnlToPoolFactor, uint256 maxPnlFactor);\\n error PnlFactorExceededForShorts(int256 pnlToPoolFactor, uint256 maxPnlFactor);\\n error InvalidUiFeeFactor(uint256 uiFeeFactor, uint256 maxUiFeeFactor);\\n error EmptyAddressInMarketTokenBalanceValidation(address market, address token);\\n error InvalidMarketTokenBalance(address market, address token, uint256 balance, uint256 expectedMinBalance);\\n error InvalidMarketTokenBalanceForCollateralAmount(address market, address token, uint256 balance, uint256 collateralAmount);\\n error InvalidMarketTokenBalanceForClaimableFunding(address market, address token, uint256 balance, uint256 claimableFundingFeeAmount);\\n error UnexpectedPoolValue(int256 poolValue);\\n\\n // Oracle errors\\n error EmptySigner(uint256 signerIndex);\\n error InvalidBlockNumber(uint256 minOracleBlockNumber, uint256 currentBlockNumber);\\n error InvalidMinMaxBlockNumber(uint256 minOracleBlockNumber, uint256 maxOracleBlockNumber);\\n error MaxPriceAgeExceeded(uint256 oracleTimestamp, uint256 currentTimestamp);\\n error MinOracleSigners(uint256 oracleSigners, uint256 minOracleSigners);\\n error MaxOracleSigners(uint256 oracleSigners, uint256 maxOracleSigners);\\n error BlockNumbersNotSorted(uint256 minOracleBlockNumber, uint256 prevMinOracleBlockNumber);\\n error MinPricesNotSorted(address token, uint256 price, uint256 prevPrice);\\n error MaxPricesNotSorted(address token, uint256 price, uint256 prevPrice);\\n error EmptyPriceFeedMultiplier(address token);\\n error InvalidFeedPrice(address token, int256 price);\\n error PriceFeedNotUpdated(address token, uint256 timestamp, uint256 heartbeatDuration);\\n error MaxSignerIndex(uint256 signerIndex, uint256 maxSignerIndex);\\n error InvalidOraclePrice(address token);\\n error InvalidSignerMinMaxPrice(uint256 minPrice, uint256 maxPrice);\\n error InvalidMedianMinMaxPrice(uint256 minPrice, uint256 maxPrice);\\n error DuplicateTokenPrice(address token);\\n error NonEmptyTokensWithPrices(uint256 tokensWithPricesLength);\\n error EmptyPriceFeed(address token);\\n error PriceAlreadySet(address token, uint256 minPrice, uint256 maxPrice);\\n error MaxRefPriceDeviationExceeded(\\n address token,\\n uint256 price,\\n uint256 refPrice,\\n uint256 maxRefPriceDeviationFactor\\n );\\n\\n // OracleModule errors\\n error InvalidPrimaryPricesForSimulation(uint256 primaryTokensLength, uint256 primaryPricesLength);\\n error EndOfOracleSimulation();\\n\\n // OracleUtils errors\\n error EmptyCompactedPrice(uint256 index);\\n error EmptyCompactedBlockNumber(uint256 index);\\n error EmptyCompactedTimestamp(uint256 index);\\n error InvalidSignature(address recoveredSigner, address expectedSigner);\\n\\n error EmptyPrimaryPrice(address token);\\n\\n error OracleBlockNumbersAreSmallerThanRequired(uint256[] oracleBlockNumbers, uint256 expectedBlockNumber);\\n error OracleBlockNumberNotWithinRange(\\n uint256[] minOracleBlockNumbers,\\n uint256[] maxOracleBlockNumbers,\\n uint256 blockNumber\\n );\\n\\n // BaseOrderUtils errors\\n error EmptyOrder();\\n error UnsupportedOrderType();\\n error InvalidOrderPrices(\\n uint256 primaryPriceMin,\\n uint256 primaryPriceMax,\\n uint256 triggerPrice,\\n uint256 orderType\\n );\\n error EmptySizeDeltaInTokens();\\n error PriceImpactLargerThanOrderSize(int256 priceImpactUsd, uint256 sizeDeltaUsd);\\n error NegativeExecutionPrice(int256 executionPrice, uint256 price, uint256 positionSizeInUsd, int256 priceImpactUsd, uint256 sizeDeltaUsd);\\n error OrderNotFulfillableAtAcceptablePrice(uint256 price, uint256 acceptablePrice);\\n\\n // IncreaseOrderUtils errors\\n error UnexpectedPositionState();\\n\\n // OrderUtils errors\\n error OrderTypeCannotBeCreated(uint256 orderType);\\n error OrderAlreadyFrozen();\\n\\n // OrderStoreUtils errors\\n error OrderNotFound(bytes32 key);\\n\\n // SwapOrderUtils errors\\n error UnexpectedMarket();\\n\\n // DecreasePositionCollateralUtils errors\\n error InsufficientFundsToPayForCosts(uint256 remainingCostUsd, string step);\\n error InvalidOutputToken(address tokenOut, address expectedTokenOut);\\n\\n // DecreasePositionUtils errors\\n error InvalidDecreaseOrderSize(uint256 sizeDeltaUsd, uint256 positionSizeInUsd);\\n error UnableToWithdrawCollateral(int256 estimatedRemainingCollateralUsd);\\n error InvalidDecreasePositionSwapType(uint256 decreasePositionSwapType);\\n error PositionShouldNotBeLiquidated();\\n\\n // IncreasePositionUtils errors\\n error InsufficientCollateralAmount(uint256 collateralAmount, int256 collateralDeltaAmount);\\n error InsufficientCollateralUsd(int256 remainingCollateralUsd);\\n\\n // PositionStoreUtils errors\\n error PositionNotFound(bytes32 key);\\n\\n // PositionUtils errors\\n error LiquidatablePosition(string reason);\\n error EmptyPosition();\\n error InvalidPositionSizeValues(uint256 sizeInUsd, uint256 sizeInTokens);\\n error MinPositionSize(uint256 positionSizeInUsd, uint256 minPositionSizeUsd);\\n\\n // PositionPricingUtils errors\\n error UsdDeltaExceedsLongOpenInterest(int256 usdDelta, uint256 longOpenInterest);\\n error UsdDeltaExceedsShortOpenInterest(int256 usdDelta, uint256 shortOpenInterest);\\n\\n // SwapPricingUtils errors\\n error UsdDeltaExceedsPoolValue(int256 usdDelta, uint256 poolUsd);\\n\\n // RoleModule errors\\n error Unauthorized(address msgSender, string role);\\n\\n // RoleStore errors\\n error ThereMustBeAtLeastOneRoleAdmin();\\n error ThereMustBeAtLeastOneTimelockMultiSig();\\n\\n // ExchangeRouter errors\\n error InvalidClaimFundingFeesInput(uint256 marketsLength, uint256 tokensLength);\\n error InvalidClaimCollateralInput(uint256 marketsLength, uint256 tokensLength, uint256 timeKeysLength);\\n error InvalidClaimAffiliateRewardsInput(uint256 marketsLength, uint256 tokensLength);\\n error InvalidClaimUiFeesInput(uint256 marketsLength, uint256 tokensLength);\\n\\n // SwapUtils errors\\n error InvalidTokenIn(address tokenIn, address market);\\n error InsufficientOutputAmount(uint256 outputAmount, uint256 minOutputAmount);\\n error InsufficientSwapOutputAmount(uint256 outputAmount, uint256 minOutputAmount);\\n error DuplicatedMarketInSwapPath(address market);\\n error SwapPriceImpactExceedsAmountIn(uint256 amountAfterFees, int256 negativeImpactAmount);\\n\\n // TokenUtils errors\\n error EmptyTokenTranferGasLimit(address token);\\n error TokenTransferError(address token, address receiver, uint256 amount);\\n error EmptyHoldingAddress();\\n\\n // AccountUtils errors\\n error EmptyAccount();\\n error EmptyReceiver();\\n\\n // Array errors\\n error CompactedArrayOutOfBounds(\\n uint256[] compactedValues,\\n uint256 index,\\n uint256 slotIndex,\\n string label\\n );\\n\\n error ArrayOutOfBoundsUint256(\\n uint256[] values,\\n uint256 index,\\n string label\\n );\\n\\n error ArrayOutOfBoundsBytes(\\n bytes[] values,\\n uint256 index,\\n string label\\n );\\n\\n // WithdrawalStoreUtils errors\\n error WithdrawalNotFound(bytes32 key);\\n\\n // WithdrawalUtils errors\\n error EmptyWithdrawal();\\n error EmptyWithdrawalAmount();\\n error MinLongTokens(uint256 received, uint256 expected);\\n error MinShortTokens(uint256 received, uint256 expected);\\n error InsufficientMarketTokens(uint256 balance, uint256 expected);\\n error InsufficientWntAmount(uint256 wntAmount, uint256 executionFee);\\n error InvalidPoolValueForWithdrawal(int256 poolValue);\\n\\n // Uint256Mask errors\\n error MaskIndexOutOfBounds(uint256 index, string label);\\n error DuplicatedIndex(uint256 index, string label);\\n}\\n\",\"keccak256\":\"0xd8052d4aa698daafd882c56ddf3ef872c6bed4accac09b51047499ce0e4287f4\",\"license\":\"BUSL-1.1\"},\"contracts/role/Role.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Role\\n * @dev Library for role keys\\n */\\nlibrary Role {\\n /**\\n * @dev The ROLE_ADMIN role.\\n */\\n bytes32 public constant ROLE_ADMIN = keccak256(abi.encode(\\\"ROLE_ADMIN\\\"));\\n\\n /**\\n * @dev The TIMELOCK_ADMIN role.\\n */\\n bytes32 public constant TIMELOCK_ADMIN = keccak256(abi.encode(\\\"TIMELOCK_ADMIN\\\"));\\n\\n /**\\n * @dev The TIMELOCK_MULTISIG role.\\n */\\n bytes32 public constant TIMELOCK_MULTISIG = keccak256(abi.encode(\\\"TIMELOCK_MULTISIG\\\"));\\n\\n /**\\n * @dev The CONFIG_KEEPER role.\\n */\\n bytes32 public constant CONFIG_KEEPER = keccak256(abi.encode(\\\"CONFIG_KEEPER\\\"));\\n\\n /**\\n * @dev The CONTROLLER role.\\n */\\n bytes32 public constant CONTROLLER = keccak256(abi.encode(\\\"CONTROLLER\\\"));\\n\\n /**\\n * @dev The ROUTER_PLUGIN role.\\n */\\n bytes32 public constant ROUTER_PLUGIN = keccak256(abi.encode(\\\"ROUTER_PLUGIN\\\"));\\n\\n /**\\n * @dev The MARKET_KEEPER role.\\n */\\n bytes32 public constant MARKET_KEEPER = keccak256(abi.encode(\\\"MARKET_KEEPER\\\"));\\n\\n /**\\n * @dev The FEE_KEEPER role.\\n */\\n bytes32 public constant FEE_KEEPER = keccak256(abi.encode(\\\"FEE_KEEPER\\\"));\\n\\n /**\\n * @dev The ORDER_KEEPER role.\\n */\\n bytes32 public constant ORDER_KEEPER = keccak256(abi.encode(\\\"ORDER_KEEPER\\\"));\\n\\n /**\\n * @dev The FROZEN_ORDER_KEEPER role.\\n */\\n bytes32 public constant FROZEN_ORDER_KEEPER = keccak256(abi.encode(\\\"FROZEN_ORDER_KEEPER\\\"));\\n\\n /**\\n * @dev The PRICING_KEEPER role.\\n */\\n bytes32 public constant PRICING_KEEPER = keccak256(abi.encode(\\\"PRICING_KEEPER\\\"));\\n /**\\n * @dev The LIQUIDATION_KEEPER role.\\n */\\n bytes32 public constant LIQUIDATION_KEEPER = keccak256(abi.encode(\\\"LIQUIDATION_KEEPER\\\"));\\n /**\\n * @dev The ADL_KEEPER role.\\n */\\n bytes32 public constant ADL_KEEPER = keccak256(abi.encode(\\\"ADL_KEEPER\\\"));\\n}\\n\",\"keccak256\":\"0x274c57667c715caa0b5b476ca0a46da20de5fbe2a882203e8c418799fd1302ca\",\"license\":\"BUSL-1.1\"},\"contracts/role/RoleModule.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./RoleStore.sol\\\";\\n\\n/**\\n * @title RoleModule\\n * @dev Contract for role validation functions\\n */\\ncontract RoleModule {\\n RoleStore public immutable roleStore;\\n\\n /**\\n * @dev Constructor that initializes the role store for this contract.\\n *\\n * @param _roleStore The contract instance to use as the role store.\\n */\\n constructor(RoleStore _roleStore) {\\n roleStore = _roleStore;\\n }\\n\\n /**\\n * @dev Only allows the contract's own address to call the function.\\n */\\n modifier onlySelf() {\\n if (msg.sender != address(this)) {\\n revert Errors.Unauthorized(msg.sender, \\\"SELF\\\");\\n }\\n _;\\n }\\n\\n /**\\n * @dev Only allows addresses with the TIMELOCK_MULTISIG role to call the function.\\n */\\n modifier onlyTimelockMultisig() {\\n _validateRole(Role.TIMELOCK_MULTISIG, \\\"TIMELOCK_MULTISIG\\\");\\n _;\\n }\\n\\n /**\\n * @dev Only allows addresses with the TIMELOCK_ADMIN role to call the function.\\n */\\n modifier onlyTimelockAdmin() {\\n _validateRole(Role.TIMELOCK_ADMIN, \\\"TIMELOCK_ADMIN\\\");\\n _;\\n }\\n\\n /**\\n * @dev Only allows addresses with the CONFIG_KEEPER role to call the function.\\n */\\n modifier onlyConfigKeeper() {\\n _validateRole(Role.CONFIG_KEEPER, \\\"CONFIG_KEEPER\\\");\\n _;\\n }\\n\\n /**\\n * @dev Only allows addresses with the CONTROLLER role to call the function.\\n */\\n modifier onlyController() {\\n _validateRole(Role.CONTROLLER, \\\"CONTROLLER\\\");\\n _;\\n }\\n\\n /**\\n * @dev Only allows addresses with the ROUTER_PLUGIN role to call the function.\\n */\\n modifier onlyRouterPlugin() {\\n _validateRole(Role.ROUTER_PLUGIN, \\\"ROUTER_PLUGIN\\\");\\n _;\\n }\\n\\n /**\\n * @dev Only allows addresses with the MARKET_KEEPER role to call the function.\\n */\\n modifier onlyMarketKeeper() {\\n _validateRole(Role.MARKET_KEEPER, \\\"MARKET_KEEPER\\\");\\n _;\\n }\\n\\n /**\\n * @dev Only allows addresses with the FEE_KEEPER role to call the function.\\n */\\n modifier onlyFeeKeeper() {\\n _validateRole(Role.FEE_KEEPER, \\\"FEE_KEEPER\\\");\\n _;\\n }\\n\\n /**\\n * @dev Only allows addresses with the ORDER_KEEPER role to call the function.\\n */\\n modifier onlyOrderKeeper() {\\n _validateRole(Role.ORDER_KEEPER, \\\"ORDER_KEEPER\\\");\\n _;\\n }\\n\\n /**\\n * @dev Only allows addresses with the PRICING_KEEPER role to call the function.\\n */\\n modifier onlyPricingKeeper() {\\n _validateRole(Role.PRICING_KEEPER, \\\"PRICING_KEEPER\\\");\\n _;\\n }\\n\\n /**\\n * @dev Only allows addresses with the LIQUIDATION_KEEPER role to call the function.\\n */\\n modifier onlyLiquidationKeeper() {\\n _validateRole(Role.LIQUIDATION_KEEPER, \\\"LIQUIDATION_KEEPER\\\");\\n _;\\n }\\n\\n /**\\n * @dev Only allows addresses with the ADL_KEEPER role to call the function.\\n */\\n modifier onlyAdlKeeper() {\\n _validateRole(Role.ADL_KEEPER, \\\"ADL_KEEPER\\\");\\n _;\\n }\\n\\n /**\\n * @dev Validates that the caller has the specified role.\\n *\\n * If the caller does not have the specified role, the transaction is reverted.\\n *\\n * @param role The key of the role to validate.\\n * @param roleName The name of the role to validate.\\n */\\n function _validateRole(bytes32 role, string memory roleName) internal view {\\n if (!roleStore.hasRole(msg.sender, role)) {\\n revert Errors.Unauthorized(msg.sender, roleName);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa5d3ead0543d4ef828baa1e833cc0969c31412965d65e2f9771e202637075325\",\"license\":\"BUSL-1.1\"},\"contracts/role/RoleStore.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\nimport \\\"../utils/EnumerableValues.sol\\\";\\nimport \\\"./Role.sol\\\";\\nimport \\\"../error/Errors.sol\\\";\\n\\n/**\\n * @title RoleStore\\n * @dev Stores roles and their members.\\n */\\ncontract RoleStore {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using EnumerableSet for EnumerableSet.Bytes32Set;\\n using EnumerableValues for EnumerableSet.AddressSet;\\n using EnumerableValues for EnumerableSet.Bytes32Set;\\n\\n EnumerableSet.Bytes32Set internal roles;\\n mapping(bytes32 => EnumerableSet.AddressSet) internal roleMembers;\\n // checking if an account has a role is a frequently used function\\n // roleCache helps to save gas by offering a more efficient lookup\\n // vs calling roleMembers[key].contains(account)\\n mapping(address => mapping (bytes32 => bool)) roleCache;\\n\\n modifier onlyRoleAdmin() {\\n if (!hasRole(msg.sender, Role.ROLE_ADMIN)) {\\n revert Errors.Unauthorized(msg.sender, \\\"ROLE_ADMIN\\\");\\n }\\n _;\\n }\\n\\n constructor() {\\n _grantRole(msg.sender, Role.ROLE_ADMIN);\\n }\\n\\n /**\\n * @dev Grants the specified role to the given account.\\n *\\n * @param account The address of the account.\\n * @param roleKey The key of the role to grant.\\n */\\n function grantRole(address account, bytes32 roleKey) external onlyRoleAdmin {\\n _grantRole(account, roleKey);\\n }\\n\\n /**\\n * @dev Revokes the specified role from the given account.\\n *\\n * @param account The address of the account.\\n * @param roleKey The key of the role to revoke.\\n */\\n function revokeRole(address account, bytes32 roleKey) external onlyRoleAdmin {\\n _revokeRole(account, roleKey);\\n }\\n\\n /**\\n * @dev Returns true if the given account has the specified role.\\n *\\n * @param account The address of the account.\\n * @param roleKey The key of the role.\\n * @return True if the account has the role, false otherwise.\\n */\\n function hasRole(address account, bytes32 roleKey) public view returns (bool) {\\n return roleCache[account][roleKey];\\n }\\n\\n /**\\n * @dev Returns the number of roles stored in the contract.\\n *\\n * @return The number of roles.\\n */\\n function getRoleCount() external view returns (uint256) {\\n return roles.length();\\n }\\n\\n /**\\n * @dev Returns the keys of the roles stored in the contract.\\n *\\n * @param start The starting index of the range of roles to return.\\n * @param end The ending index of the range of roles to return.\\n * @return The keys of the roles.\\n */\\n function getRoles(uint256 start, uint256 end) external view returns (bytes32[] memory) {\\n return roles.valuesAt(start, end);\\n }\\n\\n /**\\n * @dev Returns the number of members of the specified role.\\n *\\n * @param roleKey The key of the role.\\n * @return The number of members of the role.\\n */\\n function getRoleMemberCount(bytes32 roleKey) external view returns (uint256) {\\n return roleMembers[roleKey].length();\\n }\\n\\n /**\\n * @dev Returns the members of the specified role.\\n *\\n * @param roleKey The key of the role.\\n * @param start the start index, the value for this index will be included.\\n * @param end the end index, the value for this index will not be included.\\n * @return The members of the role.\\n */\\n function getRoleMembers(bytes32 roleKey, uint256 start, uint256 end) external view returns (address[] memory) {\\n return roleMembers[roleKey].valuesAt(start, end);\\n }\\n\\n function _grantRole(address account, bytes32 roleKey) internal {\\n roles.add(roleKey);\\n roleMembers[roleKey].add(account);\\n roleCache[account][roleKey] = true;\\n }\\n\\n function _revokeRole(address account, bytes32 roleKey) internal {\\n roleMembers[roleKey].remove(account);\\n roleCache[account][roleKey] = false;\\n\\n if (roleMembers[roleKey].length() == 0) {\\n if (roleKey == Role.ROLE_ADMIN) {\\n revert Errors.ThereMustBeAtLeastOneRoleAdmin();\\n }\\n if (roleKey == Role.TIMELOCK_MULTISIG) {\\n revert Errors.ThereMustBeAtLeastOneTimelockMultiSig();\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa7be1876450ec19568c0e12e4238332c96eb921974a19c0e4a6fe1fb943bf6d\",\"license\":\"BUSL-1.1\"},\"contracts/router/Router.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\nimport \\\"../role/RoleModule.sol\\\";\\n\\n/**\\n * @title Router\\n * @dev Users will approve this router for token spenditures\\n */\\ncontract Router is RoleModule {\\n using SafeERC20 for IERC20;\\n\\n constructor(RoleStore _roleStore) RoleModule(_roleStore) {}\\n\\n /**\\n * @dev transfer the specified amount of tokens from the account to the receiver\\n * @param token the token to transfer\\n * @param account the account to transfer from\\n * @param receiver the account to transfer to\\n * @param amount the amount of tokens to transfer\\n */\\n function pluginTransfer(address token, address account, address receiver, uint256 amount) external onlyRouterPlugin {\\n IERC20(token).safeTransferFrom(account, receiver, amount);\\n }\\n}\\n\",\"keccak256\":\"0x8f1115b829d11b6f77e9380c91e5eee2ecaf217796686ec14a9bd55aa076d916\",\"license\":\"BUSL-1.1\"},\"contracts/utils/EnumerableValues.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\n/**\\n * @title EnumerableValues\\n * @dev Library to extend the EnumerableSet library with functions to get\\n * valuesAt for a range\\n */\\nlibrary EnumerableValues {\\n using EnumerableSet for EnumerableSet.Bytes32Set;\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using EnumerableSet for EnumerableSet.UintSet;\\n\\n /**\\n * Returns an array of bytes32 values from the given set, starting at the given\\n * start index and ending before the given end index.\\n *\\n * @param set The set to get the values from.\\n * @param start The starting index.\\n * @param end The ending index.\\n * @return An array of bytes32 values.\\n */\\n function valuesAt(EnumerableSet.Bytes32Set storage set, uint256 start, uint256 end) internal view returns (bytes32[] memory) {\\n uint256 max = set.length();\\n if (end > max) { end = max; }\\n\\n bytes32[] memory items = new bytes32[](end - start);\\n for (uint256 i = start; i < end; i++) {\\n items[i - start] = set.at(i);\\n }\\n\\n return items;\\n }\\n\\n\\n /**\\n * Returns an array of address values from the given set, starting at the given\\n * start index and ending before the given end index.\\n *\\n * @param set The set to get the values from.\\n * @param start The starting index.\\n * @param end The ending index.\\n * @return An array of address values.\\n */\\n function valuesAt(EnumerableSet.AddressSet storage set, uint256 start, uint256 end) internal view returns (address[] memory) {\\n uint256 max = set.length();\\n if (end > max) { end = max; }\\n\\n address[] memory items = new address[](end - start);\\n for (uint256 i = start; i < end; i++) {\\n items[i - start] = set.at(i);\\n }\\n\\n return items;\\n }\\n\\n\\n /**\\n * Returns an array of uint256 values from the given set, starting at the given\\n * start index and ending before the given end index, the item at the end index will not be returned.\\n *\\n * @param set The set to get the values from.\\n * @param start The starting index (inclusive, item at the start index will be returned).\\n * @param end The ending index (exclusive, item at the end index will not be returned).\\n * @return An array of uint256 values.\\n */\\n function valuesAt(EnumerableSet.UintSet storage set, uint256 start, uint256 end) internal view returns (uint256[] memory) {\\n if (start >= set.length()) {\\n return new uint256[](0);\\n }\\n\\n uint256 max = set.length();\\n if (end > max) { end = max; }\\n\\n uint256[] memory items = new uint256[](end - start);\\n for (uint256 i = start; i < end; i++) {\\n items[i - start] = set.at(i);\\n }\\n\\n return items;\\n }\\n}\\n\",\"keccak256\":\"0x1e525ad5645bc649551fa3a7d000af1cec96221d7fe1cdc17cedaf942b018f0d\",\"license\":\"BUSL-1.1\"}},\"version\":1}", "bytecode": "0x60a060405234801561001057600080fd5b5060405161067038038061067083398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516105df610091600039600081816055015261013f01526105df6000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80631b8278781461003b5780634a4a7b0414610050575b600080fd5b61004e610049366004610499565b610093565b005b6100777f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b6101086040516020016100c7906020808252600d908201526c2927aaaa22a92fa8262aa3a4a760991b604082015260600190565b604051602081830303815290604052805190602001206040518060400160405280600d81526020016c2927aaaa22a92fa8262aa3a4a760991b815250610123565b61011d6001600160a01b0385168484846101e0565b50505050565b60405163ac4ab3fb60e01b8152336004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ac4ab3fb90604401602060405180830381865afa15801561018e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b291906104e4565b6101dc57338160405163a35b150b60e01b81526004016101d3929190610556565b60405180910390fd5b5050565b604080516001600160a01b038581166024830152848116604483015260648083018590528351808403909101815260849092018352602080830180516001600160e01b03166323b872dd60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65649084015261011d928792916000916102789185169084906102fa565b8051909150156102f5578080602001905181019061029691906104e4565b6102f55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b60606103098484600085610313565b90505b9392505050565b6060824710156103745760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b6001600160a01b0385163b6103cb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b600080866001600160a01b031685876040516103e7919061057a565b60006040518083038185875af1925050503d8060008114610424576040519150601f19603f3d011682016040523d82523d6000602084013e610429565b606091505b5091509150610439828286610444565b979650505050505050565b6060831561045357508161030c565b8251156104635782518084602001fd5b8160405162461bcd60e51b81526004016101d39190610596565b80356001600160a01b038116811461049457600080fd5b919050565b600080600080608085870312156104af57600080fd5b6104b88561047d565b93506104c66020860161047d565b92506104d46040860161047d565b9396929550929360600135925050565b6000602082840312156104f657600080fd5b8151801515811461030c57600080fd5b60005b83811015610521578181015183820152602001610509565b50506000910152565b60008151808452610542816020860160208601610506565b601f01601f19169290920160200192915050565b6001600160a01b03831681526040602082018190526000906103099083018461052a565b6000825161058c818460208701610506565b9190910192915050565b60208152600061030c602083018461052a56fea2646970667358221220362eb1c1459edb4fd41e5b32d957c29559dbcf70a3cabc040b91577f68ce793a64736f6c63430008120033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80631b8278781461003b5780634a4a7b0414610050575b600080fd5b61004e610049366004610499565b610093565b005b6100777f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b6101086040516020016100c7906020808252600d908201526c2927aaaa22a92fa8262aa3a4a760991b604082015260600190565b604051602081830303815290604052805190602001206040518060400160405280600d81526020016c2927aaaa22a92fa8262aa3a4a760991b815250610123565b61011d6001600160a01b0385168484846101e0565b50505050565b60405163ac4ab3fb60e01b8152336004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ac4ab3fb90604401602060405180830381865afa15801561018e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b291906104e4565b6101dc57338160405163a35b150b60e01b81526004016101d3929190610556565b60405180910390fd5b5050565b604080516001600160a01b038581166024830152848116604483015260648083018590528351808403909101815260849092018352602080830180516001600160e01b03166323b872dd60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65649084015261011d928792916000916102789185169084906102fa565b8051909150156102f5578080602001905181019061029691906104e4565b6102f55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b60606103098484600085610313565b90505b9392505050565b6060824710156103745760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b6001600160a01b0385163b6103cb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b600080866001600160a01b031685876040516103e7919061057a565b60006040518083038185875af1925050503d8060008114610424576040519150601f19603f3d011682016040523d82523d6000602084013e610429565b606091505b5091509150610439828286610444565b979650505050505050565b6060831561045357508161030c565b8251156104635782518084602001fd5b8160405162461bcd60e51b81526004016101d39190610596565b80356001600160a01b038116811461049457600080fd5b919050565b600080600080608085870312156104af57600080fd5b6104b88561047d565b93506104c66020860161047d565b92506104d46040860161047d565b9396929550929360600135925050565b6000602082840312156104f657600080fd5b8151801515811461030c57600080fd5b60005b83811015610521578181015183820152602001610509565b50506000910152565b60008151808452610542816020860160208601610506565b601f01601f19169290920160200192915050565b6001600160a01b03831681526040602082018190526000906103099083018461052a565b6000825161058c818460208701610506565b9190910192915050565b60208152600061030c602083018461052a56fea2646970667358221220362eb1c1459edb4fd41e5b32d957c29559dbcf70a3cabc040b91577f68ce793a64736f6c63430008120033", "libraries": {}, "devdoc": { "details": "Users will approve this router for token spenditures", "kind": "dev", "methods": { "pluginTransfer(address,address,address,uint256)": { "details": "transfer the specified amount of tokens from the account to the receiver", "params": { "account": "the account to transfer from", "amount": "the amount of tokens to transfer", "receiver": "the account to transfer to", "token": "the token to transfer" } } }, "title": "Router", "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 }, "storageLayout": { "storage": [], "types": null } }