编译器
0.8.13+commit.abaa5c0e
文件 1 的 7:Address.sol
pragma solidity ^0.8.1;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 2 的 7:IERC20.sol
pragma solidity ^0.8.0;
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 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
文件 3 的 7:IMarsbaseBestBid.sol
pragma solidity >=0.8.0 <0.9.0;
interface IMarsbaseBestBid
{
struct BBBid
{
uint256 offerId;
uint256 bidIdx;
address bobAddress;
address tokenBob;
uint256 amountBob;
}
struct BBOffer
{
bool active;
uint256 id;
address aliceAddress;
BBOfferParams params;
uint256 totalBidsCount;
uint256 activeBidsCount;
}
struct BBOfferParams
{
address tokenAlice;
uint256 amountAlice;
address[] tokensBob;
uint256 feeAlice;
uint256 feeBob;
}
event OfferCreated(
uint256 indexed id,
address indexed aliceAddress,
address indexed tokenAlice,
BBOfferParams params
);
event BidCreated(
uint256 indexed offerId,
address indexed bobAddress,
address indexed tokenBob,
uint256 bidIdx,
bytes32 bidId,
BBBid bid
);
enum OfferCloseReason {
Success,
CancelledBySeller,
ContractMigrated
}
enum BidCancelReason {
OfferClosed,
CancelledByBidder,
ContractMigrated
}
event OfferClosed(
uint256 indexed id,
address indexed aliceAddress,
OfferCloseReason indexed reason,
BBOffer offer
);
event BidAccepted(
uint256 indexed id,
address indexed aliceAddress,
uint256 aliceReceivedTotal,
uint256 aliceFeeTotal,
uint256 bobReceivedTotal,
uint256 bobFeeTotal,
BBOffer offer,
BBBid bid
);
event BidCancelled(
uint256 indexed offerId,
address indexed bobAddress,
address indexed tokenBob,
BidCancelReason reason,
uint256 bidIdx,
bytes32 bidId,
BBBid bid
);
function createOffer(BBOfferParams calldata offer) external payable;
function createBid(uint256 offerId, address tokenBob, uint256 amountBob) external payable;
function acceptBid(uint256 offerId, uint256 bidIdx) external;
function cancelBid(uint256 offerId, uint256 bidIdx) external;
function cancelOffer(uint256 offerId) external;
function getActiveOffers() external returns (BBOffer[] memory);
}
文件 4 的 7:MarsBaseCommon.sol
pragma solidity >=0.4.22 <0.9.0;
library MarsBaseCommon {
enum OfferType {
FullPurchase,
LimitedTime,
ChunkedPurchase,
LimitedTimeChunkedPurchase,
MinimumChunkedPurchase,
LimitedTimeMinimumPurchase,
LimitedTimeMinimumChunkedPurchase,
LimitedTimeMinimumChunkedDeadlinePurchase
}
enum OfferCloseReason {
Success,
CancelledBySeller,
DeadlinePassed
}
enum ContractType {
Offers,
MinimumOffers
}
struct OfferParams {
bool cancelEnabled;
bool modifyEnabled;
bool holdTokens;
uint256 feeAlice;
uint256 feeBob;
uint256 smallestChunkSize;
uint256 deadline;
uint256 minimumSize;
}
struct MBOffer {
bool active;
bool minimumMet;
OfferType offerType;
uint256 offerId;
uint256 amountAlice;
uint256 feeAlice;
uint256 feeBob;
uint256 smallestChunkSize;
uint256 minimumSize;
uint256 deadline;
uint256 amountRemaining;
address offerer;
address payoutAddress;
address tokenAlice;
bool[3] capabilities;
uint256[] amountBob;
uint256[] minimumOrderAmountsAlice;
uint256[] minimumOrderAmountsBob;
address[] minimumOrderAddresses;
address[] minimumOrderTokens;
address[] tokenBob;
}
event OfferCreated(
uint256 offerId,
address sender,
uint256 blockTimestamp,
MarsBaseCommon.MBOffer offer
);
event OfferModified(
uint256 offerId,
address sender,
uint256 blockTimestamp,
MarsBaseCommon.OfferParams offerParameters
);
event OfferAccepted(
uint256 offerId,
address sender,
uint256 blockTimestamp,
uint256 amountAliceReceived,
uint256 amountBobReceived,
address tokenAddressAlice,
address tokenAddressBob,
MarsBaseCommon.OfferType offerType,
uint256 feeAlice,
uint256 feeBob
);
event OfferCancelled(
uint256 offerId,
address sender,
uint256 blockTimestamp
);
event OfferClosed(
uint256 offerId,
MarsBaseCommon.OfferCloseReason reason,
uint256 blockTimestamp
);
event ContractMigrated();
event BidCancelled(uint256 offerId, address sender, uint256 blockTimestamp);
event Log(uint256 log);
struct MBAddresses {
address offersContract;
address minimumOffersContract;
}
}
文件 5 的 7:MarsbaseMarketplace.sol
pragma solidity >=0.8.0 <0.9.0;
import "./MarsBaseCommon.sol";
import "./IMarsbaseBestBid.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
using SafeERC20 for IERC20;
interface IMarsbaseMarketplace
{
struct BBBid
{
uint256 offerId;
uint256 bidIdx;
address bobAddress;
address tokenBob;
uint256 amountBob;
}
struct BBOffer
{
bool active;
uint256 id;
address aliceAddress;
BBOfferParams params;
uint256 totalBidsCount;
uint256 activeBidsCount;
}
struct BBOfferParams
{
address tokenAlice;
uint256 amountAlice;
address[] tokensBob;
uint256 feeAlice;
uint256 feeBob;
uint64 deadline;
}
event OfferCreated(
uint256 indexed id,
address indexed aliceAddress,
address indexed tokenAlice,
BBOfferParams params
);
event BidCreated(
uint256 indexed offerId,
address indexed bobAddress,
address indexed tokenBob,
uint256 bidIdx,
bytes32 bidId,
BBBid bid
);
enum OfferCloseReason {
Success,
CancelledBySeller,
ContractMigrated
}
enum BidCancelReason {
OfferClosed,
CancelledByBidder,
ContractMigrated
}
event OfferClosed(
uint256 indexed id,
address indexed aliceAddress,
OfferCloseReason indexed reason,
BBOffer offer
);
event BidAccepted(
uint256 indexed id,
address indexed aliceAddress,
uint256 indexed bbOfferId,
BBOffer offer,
BBBid bid
);
event BidCancelled(
uint256 indexed offerId,
address indexed bobAddress,
address indexed tokenBob,
BidCancelReason reason,
uint256 bidIdx,
bytes32 bidId,
BBBid bid
);
event OfferExtended(
uint256 indexed offerId,
uint64 deadline
);
function createOffer(BBOfferParams calldata offer) external payable;
function createBid(uint256 offerId, address tokenBob, uint256 amountBob) external payable;
function acceptBid(uint256 offerId, uint256 bidIdx, uint256 bbOfferId) external;
function cancelBid(uint256 offerId, uint256 bidIdx) external;
function cancelOffer(uint256 offerId) external;
function extendDeadline(uint256 offerId, uint64 deadline) external payable;
function dumpEthToComissionWallet() external payable;
}
contract MarsbaseMarketplace is IMarsbaseMarketplace
{
address public owner;
uint256 public nextOfferId = 0;
uint256 public activeOffersCount = 0;
uint256 public minimumFee = 0;
address public commissionWallet;
uint256 public offerLifetimeSecondPrice = 1 gwei;
uint64 public freePeriod = 7 days;
bool public locked = false;
mapping(uint256 => BBOffer) public offers;
mapping(bytes32 => BBBid) public offerBids;
constructor(uint256 startOfferId)
{
owner = msg.sender;
commissionWallet = msg.sender;
nextOfferId = startOfferId;
}
modifier onlyOwner {
require(msg.sender == owner, "403");
_;
}
modifier unlocked {
require(!locked, "409");
_;
}
function setCommissionAddress(address wallet) onlyOwner public
{
commissionWallet = wallet;
}
function setMinimumFee(uint256 _minimumFee) onlyOwner public
{
minimumFee = _minimumFee;
}
function changeOwner(address newOwner) onlyOwner public
{
owner = newOwner;
}
function getActiveOffers() external view returns (BBOffer[] memory)
{
BBOffer[] memory activeOffers = new BBOffer[](activeOffersCount);
uint256 i = 0;
for (uint256 offerId = 0; offerId < nextOfferId; offerId++)
{
if (offers[offerId].active)
{
activeOffers[i] = offers[offerId];
i++;
}
}
return activeOffers;
}
function getBidId(uint256 offerId, uint256 bidIdx) public pure returns (bytes32 bidId)
{
return keccak256(abi.encode(offerId, bidIdx));
}
function getActiveBidsForOffer(uint256 offerId) external view returns (BBBid[] memory)
{
BBOffer memory offer = offers[offerId];
BBBid[] memory bids = new BBBid[](offer.activeBidsCount);
uint256 i = 0;
for (uint256 bidIdx = 0; bidIdx < offer.totalBidsCount; bidIdx++)
{
if (offerBids[getBidId(offerId, bidIdx)].amountBob > 0)
{
bids[i] = offerBids[getBidId(offerId, bidIdx)];
i++;
}
}
return bids;
}
function getOffer(uint256 offerId) public view returns (BBOffer memory)
{
return offers[offerId];
}
function createOffer(BBOfferParams calldata offer) public payable unlocked
{
require(offer.amountAlice > 0, "400-AAL");
require(offer.tokensBob.length > 0, "400-BE");
require(offer.feeAlice + offer.feeBob >= minimumFee, "400-FL");
require(msg.value >= lifetimePrice(offer.deadline, block.timestamp), "400-NE");
uint256 offerId = nextOfferId++;
activeOffersCount++;
offers[offerId] = BBOffer({
active: true,
id: offerId,
aliceAddress: msg.sender,
params: offer,
totalBidsCount: 0,
activeBidsCount: 0
});
emit OfferCreated({
id: offerId,
aliceAddress: msg.sender,
tokenAlice: offer.tokenAlice,
params: offer
});
}
function createBid(uint256 offerId, address tokenBob, uint256 amountBob) public payable unlocked
{
require(amountBob > 0, "400-ABL");
require(offers[offerId].active, "400-OI");
uint256 bidIdx = offers[offerId].totalBidsCount++;
bytes32 bidId = getBidId(offerId, bidIdx);
offers[offerId].activeBidsCount++;
offerBids[bidId] = BBBid({
offerId: offerId,
bidIdx: bidIdx,
bobAddress: msg.sender,
tokenBob: tokenBob,
amountBob: amountBob
});
emit BidCreated({
offerId: offerId,
bobAddress: msg.sender,
tokenBob: tokenBob,
bidIdx: bidIdx,
bidId: bidId,
bid: offerBids[bidId]
});
}
function sendEth(address to, uint256 amount) private
{
(bool success, ) = to.call{value: amount, gas: 30000}("");
require(success, "404-C1");
}
function cancelBid(uint256 offerId, uint256 bidIdx) public unlocked
{
require(offers[offerId].active, "400-OI");
bytes32 bidId = getBidId(offerId, bidIdx);
require(offerBids[bidId].amountBob > 0, "400-BI");
require(offerBids[bidId].bobAddress == msg.sender, "403-BI");
_cancelBid(offerId, bidIdx, bidId, BidCancelReason.CancelledByBidder);
}
function _cancelBid(uint256 offerId, uint256 bidIdx, bytes32 bidId, BidCancelReason reason) private
{
BBBid memory bid = offerBids[bidId];
delete offerBids[bidId];
offers[offerId].activeBidsCount--;
emit BidCancelled({
offerId: offerId,
bobAddress: bid.bobAddress,
tokenBob: bid.tokenBob,
bidIdx: bidIdx,
bidId: bidId,
reason: reason,
bid: bid
});
}
function _cancelAllBids(uint256 offerId, BidCancelReason reason) private
{
uint256 length = offers[offerId].totalBidsCount;
for (uint256 bidIdx = 0; bidIdx < length; bidIdx++)
{
bytes32 bidId = getBidId(offerId, bidIdx);
if (offerBids[bidId].amountBob > 0)
{
_cancelBid(offerId, bidIdx, bidId, reason);
}
}
}
function acceptBid(uint256 offerId, uint256 bidIdx, uint256 bbOfferId) public unlocked
{
require(offers[offerId].active, "400-OI");
require(offers[offerId].aliceAddress == msg.sender, "403-AI");
BBOffer memory offer = offers[offerId];
BBBid memory bid = offerBids[getBidId(offerId, bidIdx)];
require(bid.amountBob > 0, "400-BI");
offers[offerId].active = false;
delete offerBids[getBidId(offerId, bidIdx)];
emit BidAccepted({
id: offer.id,
aliceAddress: offer.aliceAddress,
bbOfferId: bbOfferId,
offer: offer,
bid: bid
});
_cancelAllBids(offerId, BidCancelReason.OfferClosed);
delete offers[offerId];
activeOffersCount--;
emit OfferClosed({
id: offerId,
aliceAddress: offer.aliceAddress,
reason: OfferCloseReason.Success,
offer: offer
});
}
function cancelOffer(uint256 offerId) public unlocked
{
require(offers[offerId].active, "400-OI");
require(offers[offerId].aliceAddress == msg.sender, "403-AI");
_cancelOffer(offerId, BidCancelReason.OfferClosed, OfferCloseReason.CancelledBySeller);
}
function _cancelOffer(uint256 offerId, BidCancelReason bidReason, OfferCloseReason offerReason) private
{
offers[offerId].active = false;
BBOffer memory offer = offers[offerId];
_cancelAllBids(offerId, bidReason);
delete offers[offerId];
activeOffersCount--;
emit OfferClosed({
id: offerId,
aliceAddress: offers[offerId].aliceAddress,
reason: offerReason,
offer: offer
});
}
function lifetimePrice(uint64 deadline, uint256 _now) public view returns (uint256)
{
if (_now >= deadline)
return 0;
uint256 timeleft = deadline - _now;
if (timeleft <= freePeriod)
return 0;
uint256 price = 0;
price = (timeleft - freePeriod) * offerLifetimeSecondPrice;
return price;
}
function extendDeadline(uint256 offerId, uint64 deadline) public payable
{
require(offers[offerId].active, "400-OI");
require(offers[offerId].aliceAddress == msg.sender, "403-AI");
BBOffer memory offer = offers[offerId];
int256 delta = int256(uint256(deadline)) - int256(uint256(offer.params.deadline));
if (delta > 0)
{
require(msg.value >= lifetimePrice(deadline, block.timestamp) , "400-NE");
}
offer.params.deadline = deadline;
offers[offerId] = offer;
emit OfferExtended(offerId, deadline);
}
function lockContract() onlyOwner public
{
locked = true;
}
function cancelBids(uint256 offerId, uint256 from, uint256 to) onlyOwner public payable
{
for (uint256 bidIdx = from; bidIdx < to; bidIdx++)
{
bytes32 bidId = getBidId(offerId, bidIdx);
if (offerBids[bidId].amountBob > 0)
{
_cancelBid(offerId, bidIdx, bidId, BidCancelReason.ContractMigrated);
}
}
}
function cancelOffers(uint256 from, uint256 to) onlyOwner public payable
{
for (uint256 offerId = from; offerId < to; offerId++)
{
BBOffer memory offer = offers[offerId];
if (offer.active)
{
_cancelOffer(offerId, BidCancelReason.ContractMigrated, OfferCloseReason.ContractMigrated);
}
}
}
function dumpEthToComissionWallet() public payable
{
address wallet = commissionWallet;
if (wallet == address(0))
wallet = owner;
uint256 amount = address(this).balance;
if (amount > 0)
sendEth(wallet, amount);
}
}
文件 6 的 7:SafeERC20.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
文件 7 的 7:draft-IERC20Permit.sol
pragma solidity ^0.8.0;
interface IERC20Permit {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
{
"compilationTarget": {
"contracts/MarsbaseMarketplace.sol": "MarsbaseMarketplace"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"uint256","name":"startOfferId","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"aliceAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"bbOfferId","type":"uint256"},{"components":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"aliceAddress","type":"address"},{"components":[{"internalType":"address","name":"tokenAlice","type":"address"},{"internalType":"uint256","name":"amountAlice","type":"uint256"},{"internalType":"address[]","name":"tokensBob","type":"address[]"},{"internalType":"uint256","name":"feeAlice","type":"uint256"},{"internalType":"uint256","name":"feeBob","type":"uint256"},{"internalType":"uint64","name":"deadline","type":"uint64"}],"internalType":"struct IMarsbaseMarketplace.BBOfferParams","name":"params","type":"tuple"},{"internalType":"uint256","name":"totalBidsCount","type":"uint256"},{"internalType":"uint256","name":"activeBidsCount","type":"uint256"}],"indexed":false,"internalType":"struct IMarsbaseMarketplace.BBOffer","name":"offer","type":"tuple"},{"components":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"bidIdx","type":"uint256"},{"internalType":"address","name":"bobAddress","type":"address"},{"internalType":"address","name":"tokenBob","type":"address"},{"internalType":"uint256","name":"amountBob","type":"uint256"}],"indexed":false,"internalType":"struct IMarsbaseMarketplace.BBBid","name":"bid","type":"tuple"}],"name":"BidAccepted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"offerId","type":"uint256"},{"indexed":true,"internalType":"address","name":"bobAddress","type":"address"},{"indexed":true,"internalType":"address","name":"tokenBob","type":"address"},{"indexed":false,"internalType":"enum IMarsbaseMarketplace.BidCancelReason","name":"reason","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"bidIdx","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"bidId","type":"bytes32"},{"components":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"bidIdx","type":"uint256"},{"internalType":"address","name":"bobAddress","type":"address"},{"internalType":"address","name":"tokenBob","type":"address"},{"internalType":"uint256","name":"amountBob","type":"uint256"}],"indexed":false,"internalType":"struct IMarsbaseMarketplace.BBBid","name":"bid","type":"tuple"}],"name":"BidCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"offerId","type":"uint256"},{"indexed":true,"internalType":"address","name":"bobAddress","type":"address"},{"indexed":true,"internalType":"address","name":"tokenBob","type":"address"},{"indexed":false,"internalType":"uint256","name":"bidIdx","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"bidId","type":"bytes32"},{"components":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"bidIdx","type":"uint256"},{"internalType":"address","name":"bobAddress","type":"address"},{"internalType":"address","name":"tokenBob","type":"address"},{"internalType":"uint256","name":"amountBob","type":"uint256"}],"indexed":false,"internalType":"struct IMarsbaseMarketplace.BBBid","name":"bid","type":"tuple"}],"name":"BidCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"aliceAddress","type":"address"},{"indexed":true,"internalType":"enum IMarsbaseMarketplace.OfferCloseReason","name":"reason","type":"uint8"},{"components":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"aliceAddress","type":"address"},{"components":[{"internalType":"address","name":"tokenAlice","type":"address"},{"internalType":"uint256","name":"amountAlice","type":"uint256"},{"internalType":"address[]","name":"tokensBob","type":"address[]"},{"internalType":"uint256","name":"feeAlice","type":"uint256"},{"internalType":"uint256","name":"feeBob","type":"uint256"},{"internalType":"uint64","name":"deadline","type":"uint64"}],"internalType":"struct IMarsbaseMarketplace.BBOfferParams","name":"params","type":"tuple"},{"internalType":"uint256","name":"totalBidsCount","type":"uint256"},{"internalType":"uint256","name":"activeBidsCount","type":"uint256"}],"indexed":false,"internalType":"struct IMarsbaseMarketplace.BBOffer","name":"offer","type":"tuple"}],"name":"OfferClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"aliceAddress","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAlice","type":"address"},{"components":[{"internalType":"address","name":"tokenAlice","type":"address"},{"internalType":"uint256","name":"amountAlice","type":"uint256"},{"internalType":"address[]","name":"tokensBob","type":"address[]"},{"internalType":"uint256","name":"feeAlice","type":"uint256"},{"internalType":"uint256","name":"feeBob","type":"uint256"},{"internalType":"uint64","name":"deadline","type":"uint64"}],"indexed":false,"internalType":"struct IMarsbaseMarketplace.BBOfferParams","name":"params","type":"tuple"}],"name":"OfferCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"offerId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"deadline","type":"uint64"}],"name":"OfferExtended","type":"event"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"bidIdx","type":"uint256"},{"internalType":"uint256","name":"bbOfferId","type":"uint256"}],"name":"acceptBid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"activeOffersCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"bidIdx","type":"uint256"}],"name":"cancelBid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"from","type":"uint256"},{"internalType":"uint256","name":"to","type":"uint256"}],"name":"cancelBids","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"cancelOffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"from","type":"uint256"},{"internalType":"uint256","name":"to","type":"uint256"}],"name":"cancelOffers","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"changeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"commissionWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"address","name":"tokenBob","type":"address"},{"internalType":"uint256","name":"amountBob","type":"uint256"}],"name":"createBid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenAlice","type":"address"},{"internalType":"uint256","name":"amountAlice","type":"uint256"},{"internalType":"address[]","name":"tokensBob","type":"address[]"},{"internalType":"uint256","name":"feeAlice","type":"uint256"},{"internalType":"uint256","name":"feeBob","type":"uint256"},{"internalType":"uint64","name":"deadline","type":"uint64"}],"internalType":"struct IMarsbaseMarketplace.BBOfferParams","name":"offer","type":"tuple"}],"name":"createOffer","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"dumpEthToComissionWallet","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint64","name":"deadline","type":"uint64"}],"name":"extendDeadline","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"freePeriod","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"getActiveBidsForOffer","outputs":[{"components":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"bidIdx","type":"uint256"},{"internalType":"address","name":"bobAddress","type":"address"},{"internalType":"address","name":"tokenBob","type":"address"},{"internalType":"uint256","name":"amountBob","type":"uint256"}],"internalType":"struct IMarsbaseMarketplace.BBBid[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getActiveOffers","outputs":[{"components":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"aliceAddress","type":"address"},{"components":[{"internalType":"address","name":"tokenAlice","type":"address"},{"internalType":"uint256","name":"amountAlice","type":"uint256"},{"internalType":"address[]","name":"tokensBob","type":"address[]"},{"internalType":"uint256","name":"feeAlice","type":"uint256"},{"internalType":"uint256","name":"feeBob","type":"uint256"},{"internalType":"uint64","name":"deadline","type":"uint64"}],"internalType":"struct IMarsbaseMarketplace.BBOfferParams","name":"params","type":"tuple"},{"internalType":"uint256","name":"totalBidsCount","type":"uint256"},{"internalType":"uint256","name":"activeBidsCount","type":"uint256"}],"internalType":"struct IMarsbaseMarketplace.BBOffer[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"bidIdx","type":"uint256"}],"name":"getBidId","outputs":[{"internalType":"bytes32","name":"bidId","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"getOffer","outputs":[{"components":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"aliceAddress","type":"address"},{"components":[{"internalType":"address","name":"tokenAlice","type":"address"},{"internalType":"uint256","name":"amountAlice","type":"uint256"},{"internalType":"address[]","name":"tokensBob","type":"address[]"},{"internalType":"uint256","name":"feeAlice","type":"uint256"},{"internalType":"uint256","name":"feeBob","type":"uint256"},{"internalType":"uint64","name":"deadline","type":"uint64"}],"internalType":"struct IMarsbaseMarketplace.BBOfferParams","name":"params","type":"tuple"},{"internalType":"uint256","name":"totalBidsCount","type":"uint256"},{"internalType":"uint256","name":"activeBidsCount","type":"uint256"}],"internalType":"struct IMarsbaseMarketplace.BBOffer","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"deadline","type":"uint64"},{"internalType":"uint256","name":"_now","type":"uint256"}],"name":"lifetimePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextOfferId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"offerBids","outputs":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"bidIdx","type":"uint256"},{"internalType":"address","name":"bobAddress","type":"address"},{"internalType":"address","name":"tokenBob","type":"address"},{"internalType":"uint256","name":"amountBob","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"offerLifetimeSecondPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"offers","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"aliceAddress","type":"address"},{"components":[{"internalType":"address","name":"tokenAlice","type":"address"},{"internalType":"uint256","name":"amountAlice","type":"uint256"},{"internalType":"address[]","name":"tokensBob","type":"address[]"},{"internalType":"uint256","name":"feeAlice","type":"uint256"},{"internalType":"uint256","name":"feeBob","type":"uint256"},{"internalType":"uint64","name":"deadline","type":"uint64"}],"internalType":"struct IMarsbaseMarketplace.BBOfferParams","name":"params","type":"tuple"},{"internalType":"uint256","name":"totalBidsCount","type":"uint256"},{"internalType":"uint256","name":"activeBidsCount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"setCommissionAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minimumFee","type":"uint256"}],"name":"setMinimumFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]