编译器
0.8.20+commit.a1b79de6
文件 1 的 16:Access.sol
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/AccessControl.sol";
contract Access is AccessControl {
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
constructor() {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(ADMIN_ROLE, msg.sender);
}
function transferOwnership(address newOwner) public onlyRole(DEFAULT_ADMIN_ROLE) {
require(newOwner != address(0), "New owner cannot be zero address");
_revokeRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(DEFAULT_ADMIN_ROLE, newOwner);
}
function addAdmin(address account) public onlyRole(DEFAULT_ADMIN_ROLE) {
grantRole(ADMIN_ROLE, account);
}
function removeAdmin(address account) public onlyRole(DEFAULT_ADMIN_ROLE) {
revokeRole(ADMIN_ROLE, account);
}
function isAdmin(address account) external view returns (bool) {
return hasRole(ADMIN_ROLE, account);
}
function isOwner(address account) external view returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, account);
}
}
文件 2 的 16:AccessControl.sol
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
return _roles[role].hasRole[account];
}
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
return _roles[role].adminRole;
}
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}
文件 3 的 16:Context.sol
pragma solidity ^0.8.20;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
文件 4 的 16:ERC1155Holder.sol
pragma solidity ^0.8.20;
import {IERC165, ERC165} from "../../../utils/introspection/ERC165.sol";
import {IERC1155Receiver} from "../IERC1155Receiver.sol";
abstract contract ERC1155Holder is ERC165, IERC1155Receiver {
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}
function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
}
文件 5 的 16:ERC165.sol
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 6 的 16:IAccessControl.sol
pragma solidity ^0.8.20;
interface IAccessControl {
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
error AccessControlBadConfirmation();
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
function hasRole(bytes32 role, address account) external view returns (bool);
function getRoleAdmin(bytes32 role) external view returns (bytes32);
function grantRole(bytes32 role, address account) external;
function revokeRole(bytes32 role, address account) external;
function renounceRole(bytes32 role, address callerConfirmation) external;
}
文件 7 的 16:ICPMM.sol
pragma solidity ^0.8.20;
import { IERC20 } from "./IERC20.sol";
import { IConditionalTokens } from "./IConditionalTokens.sol";
interface ICPMM is IERC20 {
event FPMMFundingAdded(address indexed funder, uint256[] amountsAdded, uint256 sharesMinted);
event FPMMFundingRemoved(
address indexed funder, uint256[] amountsRemoved, uint256 collateralRemovedFromFeePool, uint256 sharesBurnt
);
function conditionalTokens() external view returns (IConditionalTokens);
function addFunding(uint256 addedFunds, uint256[] calldata distributionHint) external;
function removeFunding(uint256 sharesToBurn) external;
function withdrawFee(address account) external;
function feesWithdrawableBy(address account) external view returns (uint256);
function onERC1155Received(address operator, address from, uint256 id, uint256 value, bytes calldata data)
external
returns (bytes4);
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
文件 8 的 16:ICPMMFactory.sol
pragma solidity ^0.8.20;
import { IERC20 } from "./IERC20.sol";
import { ICPMM } from "./ICPMM.sol";
import { IConditionalTokens } from "./IConditionalTokens.sol";
interface ICPMMFactory {
function createFixedProductMarketMaker(
IConditionalTokens conditionalTokens,
IERC20 collateralToken,
bytes32[] calldata conditionIds,
uint256 fee
) external returns (ICPMM);
}
文件 9 的 16:IConditionalTokens.sol
pragma solidity ^0.8.20;
import { IERC20 } from "./IERC20.sol";
import { IERC1155 } from "./IERC1155.sol";
interface IConditionalTokens is IERC1155 {
function payoutNumerators(bytes32) external returns (uint256[] memory);
function payoutDenominator(bytes32) external returns (uint256);
function prepareCondition(address oracle, bytes32 questionId, uint256 outcomeSlotCount) external;
function reportPayouts(bytes32 questionId, uint256[] calldata payouts) external;
function splitPosition(
IERC20 collateralToken,
bytes32 parentCollectionId,
bytes32 conditionId,
uint256[] calldata partition,
uint256 amount
) external;
function mergePositions(
IERC20 collateralToken,
bytes32 parentCollectionId,
bytes32 conditionId,
uint256[] calldata partition,
uint256 amount
) external;
function redeemPositions(
IERC20 collateralToken,
bytes32 parentCollectionId,
bytes32 conditionId,
uint256[] calldata indexSets
) external;
function getOutcomeSlotCount(bytes32 conditionId) external view returns (uint256);
function getConditionId(address oracle, bytes32 questionId, uint256 outcomeSlotCount)
external
pure
returns (bytes32);
function getCollectionId(bytes32 parentCollectionId, bytes32 conditionId, uint256 indexSet)
external
view
returns (bytes32);
function getPositionId(IERC20 collateralToken, bytes32 collectionId) external pure returns (uint256);
}
文件 10 的 16:IERC1155.sol
pragma solidity ^0.8.20;
import { IERC165 } from "./IERC165.sol";
interface IERC1155 is IERC165 {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(
address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values
);
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
event URI(string value, uint256 indexed id);
function balanceOf(address account, uint256 id) external view returns (uint256);
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
function setApprovalForAll(address operator, bool approved) external;
function isApprovedForAll(address account, address operator) external view returns (bool);
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
}
文件 11 的 16:IERC1155Receiver.sol
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
interface IERC1155Receiver is IERC165 {
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
文件 12 的 16:IERC165.sol
pragma solidity ^0.8.20;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 13 的 16:IERC20.sol
pragma solidity ^0.8.20;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
文件 14 的 16:ILimitlessAgentVaultV1.sol
pragma solidity ^0.8.20;
interface ILimitlessAgentVaultV1EE {
error InsufficientBalance();
error TransferFailed();
error ApprovalFailed();
error InvalidCollateral();
error InvalidAmount();
event CollateralAdded(address indexed collateralToken);
event CollateralRemoved(address indexed collateralToken);
event EmergencyErc20Withdraw(address indexed erc20, address indexed destination, uint256 amount);
event EmergencyEtherWithdraw(address indexed destination, uint256 amount);
event EmergencyConditionalTokensWithdraw(
address indexed conditionalTokens, uint256[] positionIds, address indexed destination
);
event VaultFundingAdded(
address indexed collateral, address indexed cpmm, uint256 addedFunds, uint256[] distributionHint
);
event VaultFundingRemoved(address indexed cpmm, uint256 sharesBurned);
event VaultFeesWithdrawn(address indexed cpmm, uint256 amount);
event VaultPositionSplit(address indexed conditionalTokens, bytes32 conditionId, uint256 amount);
event VaultPositionsMerged(address indexed conditionalTokens, bytes32 conditionId, uint256 amount);
event VaultPositionsRedeemed(
address indexed conditionalTokens, address indexed collateralToken, bytes32 conditionId
);
}
文件 15 的 16:ILimitlessPriceOracleV1.sol
pragma solidity ^0.8.20;
struct QuestionData {
uint256 requestTimestamp;
int64 price;
int32 expo;
uint256 confAge;
uint256 deadline;
uint256 emergencyResolutionTimestamp;
bytes32 priceFeedId;
bool initialized;
bool resolved;
address creator;
int16 winningIndex;
int64 settledPrice;
int32 settledExpo;
uint256 publishTime;
}
interface ILimitlessPriceOracleV1EE {
error NotInitialized();
error AlreadyInitialized();
error NotPaused();
error Paused();
error NotFlagged();
error NotReadyToResolve();
error Resolved();
error Flagged();
error DeadlineNotPassed();
error SafetyPeriodPassed();
error SafetyPeriodNotPassed();
error PriceOutdated();
error PriceNotAvailable();
error InvalidExpo();
error InvalidPrice();
error InvalidPayoutsPrice();
error InvalidPayouts();
error InvalidDeadline();
error InvalidPriceFeed();
event QuestionInitialized(
bytes32 indexed questionId,
address indexed creator,
bytes32 indexed priceFeedId,
uint256 requestTimestamp,
int64 price,
int32 expo,
uint256 confTime,
uint256 deadline
);
event QuestionFlagged(bytes32 indexed questionId);
event QuestionUnflagged(bytes32 indexed questionId);
event QuestionReset(bytes32 indexed questionId);
event QuestionResolved(
bytes32 indexed questionId, int256 indexed settledPrice, int32 expo, uint256[] payouts, uint256 publishTime
);
event QuestionEmergencyResolved(bytes32 indexed questionId, uint256[] payouts);
}
interface ILimitlessPriceOracleV1 {
function initialize(
bytes32 questionID,
bytes32 priceFeedID,
int64 price,
int32 expo,
uint256 confAge,
uint256 deadline
) external;
}
文件 16 的 16:LimitlessAgentVaultV1.sol
pragma solidity ^0.8.20;
import { IConditionalTokens } from "./interfaces/IConditionalTokens.sol";
import { IERC20 } from "./interfaces/IERC20.sol";
import { ICPMM } from "./interfaces/ICPMM.sol";
import { ICPMMFactory } from "./interfaces/ICPMMFactory.sol";
import { ILimitlessPriceOracleV1 } from "./interfaces/ILimitlessPriceOracleV1.sol";
import { ILimitlessAgentVaultV1EE } from "./interfaces/ILimitlessAgentVaultV1.sol";
import { ERC1155Holder } from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";
import { Access } from "./mixins/Access.sol";
contract LimitlessAgentVaultV1 is ILimitlessAgentVaultV1EE, ERC1155Holder, Access {
mapping(address => bool) public collaterals;
function addCollateral(address collateralToken) external onlyRole(DEFAULT_ADMIN_ROLE) {
collaterals[collateralToken] = true;
emit CollateralAdded(collateralToken);
}
function removeCollateral(address collateralToken) external onlyRole(DEFAULT_ADMIN_ROLE) {
collaterals[collateralToken] = false;
emit CollateralRemoved(collateralToken);
}
function addFunding(address collateralToken, address cpmm, uint256 addedFunds, uint256[] calldata distributionHint)
external
onlyRole(ADMIN_ROLE)
{
if (!collaterals[collateralToken]) revert InvalidCollateral();
_addFunding(collateralToken, cpmm, addedFunds, distributionHint);
}
function initQuestionAndAddFunding(
address collateralToken,
address oracle,
bytes32 questionId,
bytes32 priceFeedID,
int64 targetPrice,
int32 expo,
address cpmm,
uint256 confAge,
uint256 deadline,
uint256 addedFunds,
uint256[] calldata distributionHint
) external onlyRole(ADMIN_ROLE) {
if (!collaterals[collateralToken]) revert InvalidCollateral();
ILimitlessPriceOracleV1 priceOracle = ILimitlessPriceOracleV1(oracle);
priceOracle.initialize(questionId, priceFeedID, targetPrice, expo, confAge, deadline);
_addFunding(collateralToken, address(cpmm), addedFunds, distributionHint);
}
function removeFunding(address cpmm, uint256 sharesToBurn) external onlyRole(ADMIN_ROLE) {
_removeFunding(cpmm, sharesToBurn);
}
function removeFundingAndRedeemPositions(
address conditionalTokens,
address collateralToken,
address cpmm,
uint256 sharesToBurn,
bytes32 parentCollectionId,
bytes32 conditionId,
uint256[] calldata indexSets
) external onlyRole(ADMIN_ROLE) {
if (!collaterals[collateralToken]) revert InvalidCollateral();
_removeFunding(cpmm, sharesToBurn);
_redeemPositions(conditionalTokens, collateralToken, parentCollectionId, conditionId, indexSets);
}
function withdrawFees(address cpmm) external onlyRole(ADMIN_ROLE) {
ICPMM(cpmm).withdrawFee(address(this));
}
function splitPosition(
address conditionalTokens,
address collateralToken,
bytes32 parentCollectionId,
bytes32 conditionId,
uint256[] calldata partition,
uint256 amount
) external onlyRole(ADMIN_ROLE) {
if (amount == 0) revert InvalidAmount();
IConditionalTokens ctf = IConditionalTokens(conditionalTokens);
if (!collaterals[collateralToken]) revert InvalidCollateral();
IERC20 collateral = IERC20(collateralToken);
if (amount > collateral.balanceOf(address(this))) revert InsufficientBalance();
if (!collateral.approve(conditionalTokens, amount)) revert ApprovalFailed();
ctf.splitPosition(collateral, parentCollectionId, conditionId, partition, amount);
emit VaultPositionSplit(conditionalTokens, conditionId, amount);
}
function mergePositions(
address conditionalTokens,
address collateralToken,
bytes32 parentCollectionId,
bytes32 conditionId,
uint256[] calldata partition,
uint256 amount
) external onlyRole(ADMIN_ROLE) {
if (!collaterals[collateralToken]) revert InvalidCollateral();
IConditionalTokens ctf = IConditionalTokens(conditionalTokens);
IERC20 collateral = IERC20(collateralToken);
ctf.setApprovalForAll(conditionalTokens, true);
ctf.mergePositions(collateral, parentCollectionId, conditionId, partition, amount);
emit VaultPositionsMerged(conditionalTokens, conditionId, amount);
}
function redeemPositions(
address conditionalTokens,
address collateralToken,
bytes32 parentCollectionId,
bytes32 conditionId,
uint256[] calldata indexSets
) external onlyRole(ADMIN_ROLE) {
if (!collaterals[collateralToken]) revert InvalidCollateral();
_redeemPositions(conditionalTokens, collateralToken, parentCollectionId, conditionId, indexSets);
}
function emergencyErc20TokenWithdraw(address erc20, address destination) external onlyRole(DEFAULT_ADMIN_ROLE) {
IERC20 token = IERC20(erc20);
if (!token.transfer(destination, token.balanceOf(address(this)))) revert TransferFailed();
emit EmergencyErc20Withdraw(erc20, destination, token.balanceOf(address(this)));
}
function emergencyConditionalTokensWithdraw(
address conditionalTokens,
uint256[] calldata positionIds,
address destination
) external onlyRole(DEFAULT_ADMIN_ROLE) {
IConditionalTokens ctf = IConditionalTokens(conditionalTokens);
ctf.setApprovalForAll(address(this), true);
for (uint256 i = 0; i < positionIds.length; i++) {
ctf.safeTransferFrom(
address(this), destination, positionIds[i], ctf.balanceOf(address(this), positionIds[i]), ""
);
}
emit EmergencyConditionalTokensWithdraw(conditionalTokens, positionIds, destination);
}
function positionBalance(
address conditionalTokens,
address collateralToken,
bytes32 parentCollectionId,
bytes32 conditionId,
uint256 indexSet
) external view returns (uint256, uint256) {
IConditionalTokens ctf = IConditionalTokens(conditionalTokens);
IERC20 collateral = IERC20(collateralToken);
bytes32 collectionId = ctf.getCollectionId(parentCollectionId, conditionId, indexSet);
uint256 positionId = ctf.getPositionId(collateral, collectionId);
return (ctf.balanceOf(address(this), positionId), positionId);
}
function positionBalanceById(address conditionalTokens, uint256 positionId)
external
view
returns (uint256, uint256)
{
IConditionalTokens ctf = IConditionalTokens(conditionalTokens);
return (ctf.balanceOf(address(this), positionId), positionId);
}
function sharesBalance(address cpmm) external view returns (uint256) {
return ICPMM(cpmm).balanceOf(address(this));
}
function feesWithdrawable(address cpmm) external view returns (uint256) {
return ICPMM(cpmm).feesWithdrawableBy(address(this));
}
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(AccessControl, ERC1155Holder)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
function _addFunding(address collateral, address cpmm, uint256 addedFunds, uint256[] calldata distributionHint)
internal
{
IERC20(collateral).approve(cpmm, addedFunds);
ICPMM(cpmm).addFunding(addedFunds, distributionHint);
emit VaultFundingAdded(collateral, cpmm, addedFunds, distributionHint);
}
function _removeFunding(address cpmm, uint256 sharesToBurn) internal {
ICPMM(cpmm).approve(address(cpmm), sharesToBurn);
ICPMM(cpmm).removeFunding(sharesToBurn);
emit VaultFundingRemoved(cpmm, sharesToBurn);
}
function _redeemPositions(
address conditionalTokens,
address collateralToken,
bytes32 parentCollectionId,
bytes32 conditionId,
uint256[] calldata indexSets
) internal {
IConditionalTokens ctf = IConditionalTokens(conditionalTokens);
IERC20 collateral = IERC20(collateralToken);
ctf.setApprovalForAll(conditionalTokens, true);
ctf.redeemPositions(collateral, parentCollectionId, conditionId, indexSets);
emit VaultPositionsRedeemed(conditionalTokens, collateralToken, conditionId);
}
}
{
"compilationTarget": {
"src/LimitlessAgentVaultV1.sol": "LimitlessAgentVaultV1"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [
":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
":ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
":forge-std/=lib/forge-std/src/",
":halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
":openzeppelin-contracts/=lib/openzeppelin-contracts/"
]
}
[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ApprovalFailed","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidCollateral","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collateralToken","type":"address"}],"name":"CollateralAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collateralToken","type":"address"}],"name":"CollateralRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"conditionalTokens","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"positionIds","type":"uint256[]"},{"indexed":true,"internalType":"address","name":"destination","type":"address"}],"name":"EmergencyConditionalTokensWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc20","type":"address"},{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyErc20Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyEtherWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"cpmm","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"VaultFeesWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collateral","type":"address"},{"indexed":true,"internalType":"address","name":"cpmm","type":"address"},{"indexed":false,"internalType":"uint256","name":"addedFunds","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"distributionHint","type":"uint256[]"}],"name":"VaultFundingAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"cpmm","type":"address"},{"indexed":false,"internalType":"uint256","name":"sharesBurned","type":"uint256"}],"name":"VaultFundingRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"conditionalTokens","type":"address"},{"indexed":false,"internalType":"bytes32","name":"conditionId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"VaultPositionSplit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"conditionalTokens","type":"address"},{"indexed":false,"internalType":"bytes32","name":"conditionId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"VaultPositionsMerged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"conditionalTokens","type":"address"},{"indexed":true,"internalType":"address","name":"collateralToken","type":"address"},{"indexed":false,"internalType":"bytes32","name":"conditionId","type":"bytes32"}],"name":"VaultPositionsRedeemed","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collateralToken","type":"address"}],"name":"addCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"cpmm","type":"address"},{"internalType":"uint256","name":"addedFunds","type":"uint256"},{"internalType":"uint256[]","name":"distributionHint","type":"uint256[]"}],"name":"addFunding","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"collaterals","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"conditionalTokens","type":"address"},{"internalType":"uint256[]","name":"positionIds","type":"uint256[]"},{"internalType":"address","name":"destination","type":"address"}],"name":"emergencyConditionalTokensWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc20","type":"address"},{"internalType":"address","name":"destination","type":"address"}],"name":"emergencyErc20TokenWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"cpmm","type":"address"}],"name":"feesWithdrawable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"bytes32","name":"questionId","type":"bytes32"},{"internalType":"bytes32","name":"priceFeedID","type":"bytes32"},{"internalType":"int64","name":"targetPrice","type":"int64"},{"internalType":"int32","name":"expo","type":"int32"},{"internalType":"address","name":"cpmm","type":"address"},{"internalType":"uint256","name":"confAge","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"addedFunds","type":"uint256"},{"internalType":"uint256[]","name":"distributionHint","type":"uint256[]"}],"name":"initQuestionAndAddFunding","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"conditionalTokens","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"bytes32","name":"parentCollectionId","type":"bytes32"},{"internalType":"bytes32","name":"conditionId","type":"bytes32"},{"internalType":"uint256[]","name":"partition","type":"uint256[]"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mergePositions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"conditionalTokens","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"bytes32","name":"parentCollectionId","type":"bytes32"},{"internalType":"bytes32","name":"conditionId","type":"bytes32"},{"internalType":"uint256","name":"indexSet","type":"uint256"}],"name":"positionBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"conditionalTokens","type":"address"},{"internalType":"uint256","name":"positionId","type":"uint256"}],"name":"positionBalanceById","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"conditionalTokens","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"bytes32","name":"parentCollectionId","type":"bytes32"},{"internalType":"bytes32","name":"conditionId","type":"bytes32"},{"internalType":"uint256[]","name":"indexSets","type":"uint256[]"}],"name":"redeemPositions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collateralToken","type":"address"}],"name":"removeCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"cpmm","type":"address"},{"internalType":"uint256","name":"sharesToBurn","type":"uint256"}],"name":"removeFunding","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"conditionalTokens","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"cpmm","type":"address"},{"internalType":"uint256","name":"sharesToBurn","type":"uint256"},{"internalType":"bytes32","name":"parentCollectionId","type":"bytes32"},{"internalType":"bytes32","name":"conditionId","type":"bytes32"},{"internalType":"uint256[]","name":"indexSets","type":"uint256[]"}],"name":"removeFundingAndRedeemPositions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"cpmm","type":"address"}],"name":"sharesBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"conditionalTokens","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"bytes32","name":"parentCollectionId","type":"bytes32"},{"internalType":"bytes32","name":"conditionId","type":"bytes32"},{"internalType":"uint256[]","name":"partition","type":"uint256[]"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"splitPosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"cpmm","type":"address"}],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]