GOBMarket sales ERC1155 tokens in exchange for approved ERC20 tokens. Tokens listed for sale can be viewed with listedItems() and listedItem(). Tokens are minted to the buyer when the purchase is completed. Tokens can be bought using one of three different payment methods: - buyItem(): pay with ERC20 tokens listed in validCurrencies(). - buyItemWithVesting(): pay with ERC20 tokens locked in vesting. - buyItemWithSeed(): pay with ERC20 seed tokens used by vesting.
Methods
DEFAULT_ADMIN_ROLE
function DEFAULT_ADMIN_ROLE() external view returns (bytes32)
Returns
Name
Type
Description
_0
bytes32
undefined
MANAGER_ROLE
function MANAGER_ROLE() external view returns (bytes32)
Returns
Name
Type
Description
_0
bytes32
undefined
SELLER_ROLE
function SELLER_ROLE() external view returns (bytes32)
Returns
Name
Type
Description
_0
bytes32
undefined
WITHDRAW_ROLE
function WITHDRAW_ROLE() external view returns (bytes32)
Returns
Name
Type
Description
_0
bytes32
undefined
addCurrency
function addCurrency(address newCurrency) external nonpayable
Adds a new currency to the list of ERC20s accepted as payments. IMPORTANT: All ERC20s are assumed to be of the same market value. There is only one price per token id listed for sale, and that price applies to all currencies. Emits {CurrencyAdded}.
Parameters
Name
Type
Description
newCurrency
address
ERC20 address (ie: usdc).
addERC1155
function addERC1155(address erc1155) external nonpayable
Adds an ERC1155 that will hold the tokens to be sold (minted). GOBMarket must have minting access in erc1155 at purchase time. Emits {ERC1155Added}.
Parameters
Name
Type
Description
erc1155
address
ERC1155 address
buyItem
function buyItem(address erc1155, uint256 tokenId, address to, uint256 quantity, address currency) external nonpayable
Buy tokens of a listed ERC1155 using an approved ERC20 as payment. The token's price is in items and it is expressed in priceDecimals If the price of token id 1 is set at 300000 and priceDecimals is 4, the price in USDC is 30.00 if paying with USDC as currency. Emits {TokenPurchased}. Requirements: - currency must exists in validCurrencies(). - erc1155 and tokenId must be listed for sale. See listedItems and listedItem. - Sender must have enough balance of selected currency. - GOBMarket must have enough allowance of sender's selected currency.
Parameters
Name
Type
Description
erc1155
address
ERC1155 addresss.
tokenId
uint256
Token to purchase.
to
address
Address to mint the tokenId.
quantity
uint256
Amount of tokens to purchase. It cannot be zero.
currency
address
ERC20 to be used as payment.
buyItemWithSeed
function buyItemWithSeed(address erc1155, uint256 tokenId, address to, uint256 quantity) external nonpayable
Buy tokens of a listed ERC1155 using ERC20 seed tokens used by vesting. All price calculations are the same as buyItemWithVesting(). Emits {TokenPurchased}. Requirements: - erc1155 and tokenId must be listed for sale. See listedItems and listedItem. - Sender must have enough balance of seed token used by vesting. - GOBMarket must have enough allowance of sender's seed token. - vesting and seedPrice must be set.
Parameters
Name
Type
Description
erc1155
address
ERC1155 addresss.
tokenId
uint256
Token to purchase.
to
address
Address to mint the tokenId.
quantity
uint256
Amount of tokens to purchase. It cannot be zero.
buyItemWithVesting
function buyItemWithVesting(address erc1155, uint256 tokenId, address to, uint256 quantity) external nonpayable
Buy tokens of a listed ERC1155 using ERC20 tokens locked in vesting. The token's price is in items and it is expressed in priceDecimals. The value of the locked tokens is set in seedPrice and is also using priceDecimals. (See buyItem) If seedPrice is 10000 and priceDecimals is 4, the convertion rate between any validCurrencies() and locked tokens is 1:1 (10000 / 104) (ie: 1 LockedToken = 1 USDC) If seedPrice is 5000 the convertion rate is 1:2 (5000 / 104) (ie: 1 LockedToken = 2 USDC) Emits {TokenPurchased}. Requirements: - erc1155 and tokenId must be listed for sale. See listedItems and listedItem. - vesting and seedPrice must be set. - Sender must have enough balance of locked tokens in vesting.
Parameters
Name
Type
Description
erc1155
address
ERC1155 addresss.
tokenId
uint256
Token to purchase.
to
address
Address to mint the tokenId.
quantity
uint256
Amount of tokens to purchase. It cannot be zero.
changeCap
function changeCap(address erc1155, uint256 tokenId, uint256 newCap) external nonpayable
Change the sale cap of a token listed for sale. Emits {CapChanged}. Requirements: - tokenId must be listed. - newCapMust be different than previous cap and cannot be less than the amount sold so far.
Parameters
Name
Type
Description
erc1155
address
ERC1155 address.
tokenId
uint256
The token id to be changed.
newCap
uint256
New cap.
changePrice
function changePrice(address erc1155, uint256 tokenId, uint256 newPrice) external nonpayable
Changes the priced of a token listed for sale. Emits {PriceChanged}. Requirements: - tokenId must be listed. - newPrice must be different than the previous price.
Parameters
Name
Type
Description
erc1155
address
ERC1155 address.
tokenId
uint256
The token id to be changed.
newPrice
uint256
New price.
erc1155At
function erc1155At(uint256 index) external view returns (address)
Returns the ERC1155 address at a specific index.
Parameters
Name
Type
Description
index
uint256
undefined
Returns
Name
Type
Description
_0
address
ERC1155 address.
erc1155Length
function erc1155Length() external view returns (uint256)
Returns the ERC1155 counter.
Returns
Name
Type
Description
_0
uint256
ERC1155 counter.
erc1155List
function erc1155List() external view returns (address[])
Returns all the available ERC1155.
Returns
Name
Type
Description
_0
address[]
Array with all ERC1155 addresses.
getRoleAdmin
function getRoleAdmin(bytes32 role) external view returns (bytes32)
Returns the admin role that controls role. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.
Parameters
Name
Type
Description
role
bytes32
undefined
Returns
Name
Type
Description
_0
bytes32
undefined
grantRole
function grantRole(bytes32 role, address account) external nonpayable
Grants role to account. If account had not been already granted role, emits a {RoleGranted} event. Requirements: - the caller must have role's admin role. May emit a {RoleGranted} event.
Parameters
Name
Type
Description
role
bytes32
undefined
account
address
undefined
hasRole
function hasRole(bytes32 role, address account) external view returns (bool)
Returns true if account has been granted role.
Parameters
Name
Type
Description
role
bytes32
undefined
account
address
undefined
Returns
Name
Type
Description
_0
bool
undefined
isValidCurrency
function isValidCurrency(address currency) external view returns (bool)
Returns the selling info for all tokens in erc1155 available for sale.
Parameters
Name
Type
Description
erc1155
address
ERC1155 addresss.
Returns
Name
Type
Description
tokenIds
uint256[]
Array of all tokenIds.
listedItems_
GOBMarket.ItemInfo[]
Array of ItemInfo. Matched by index with _tokenIds.
priceDecimals
function priceDecimals() external view returns (uint8)
Returns
Name
Type
Description
_0
uint8
undefined
removeCurrency
function removeCurrency(address currency) external nonpayable
Removes an ERC20 from the accepted list of currencies. Emits {CurrencyRemoved}.
Parameters
Name
Type
Description
currency
address
ERC20 address.
removeERC1155
function removeERC1155(address erc1155) external nonpayable
Removes an ERC1155. Emits {ERC1155Removed}. Requirements: - erc1155 must not have tokens listed for sale.
Parameters
Name
Type
Description
erc1155
address
ERC1155 address
renounceRole
function renounceRole(bytes32 role, address account) external nonpayable
Revokes role from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked role, emits a {RoleRevoked} event. Requirements: - the caller must be account. May emit a {RoleRevoked} event.
Parameters
Name
Type
Description
role
bytes32
undefined
account
address
undefined
revokeRole
function revokeRole(bytes32 role, address account) external nonpayable
Revokes role from account. If account had been granted role, emits a {RoleRevoked} event. Requirements: - the caller must have role's admin role. May emit a {RoleRevoked} event.
Parameters
Name
Type
Description
role
bytes32
undefined
account
address
undefined
seedPrice
function seedPrice() external view returns (uint256)
Returns
Name
Type
Description
_0
uint256
undefined
setSeedPrice
function setSeedPrice(uint256 price) external nonpayable
Sets the parity betwen the seed token in vesting and accepted currencies. Calculations use priceDecimals. See buyItemWithVesting(). NOTE: If seedPrice is set to zero, buyItemWithVesting() and buyItemWithSeed() will be disabled. Emits {SeedPriceChanged}.
Parameters
Name
Type
Description
price
uint256
New price.
setVesting
function setVesting(address vesting_) external nonpayable
Sets the vesting contract that allows the purchase using vested tokens or seedTokens.
Parameters
Name
Type
Description
vesting_
address
Vesting address. Emits {VestingChanged}. Requirements: - vesting_ must have vesting token set. - vested token decimals must be >= priceDecimals.
supportsInterface
function supportsInterface(bytes4 interfaceId) external view returns (bool)
See {IERC165-supportsInterface}.
Parameters
Name
Type
Description
interfaceId
bytes4
undefined
Returns
Name
Type
Description
_0
bool
undefined
unlistItems
function unlistItems(address erc1155, uint256[] tokenIds) external nonpayable
Unlists tokens from the selling list. Emits {TokenUnlisted}. Requirements: - tokenId must be listed.
Parameters
Name
Type
Description
erc1155
address
ERC1155 address.
tokenIds
uint256[]
Array with the token ids to be removed.
validCurrencies
function validCurrencies() external view returns (address[])
Returns all ERC20 accepted as payment.
Returns
Name
Type
Description
_0
address[]
Array with all ERC20 addresses.
vesting
function vesting() external view returns (contract IVesting)
Returns
Name
Type
Description
_0
contract IVesting
undefined
withdraw
function withdraw(address currency_, uint256 amount) external nonpayable
Emitted when newAdminRole is set as role's admin role, replacing previousAdminRoleDEFAULT_ADMIN_ROLE is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._
Emitted when account is granted role. sender is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.
Emitted when account is revoked role. sender is the account that originated the contract call: - if using revokeRole, it is the admin role bearer - if using renounceRole, it is the role bearer (i.e. account)