F1® Delta Time Inventory
About
Stats
Public Functions
54
Event Types
18
Code Size
105,685 bytes
Events (18) keyboard_arrow_up
State Variables (19) keyboard_arrow_up
Functions
isMinter keyboard_arrow_up
addMinter keyboard_arrow_up
renounceMinter keyboard_arrow_up
owner keyboard_arrow_up
isOwner keyboard_arrow_up
renounceOwnership keyboard_arrow_up
transferOwnership keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
null
Source Code
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
getHubAddr keyboard_arrow_up
relayHubVersion keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function relayHubVersion() public view returns (string memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return "1.0.0";
}
preRelayedCall keyboard_arrow_up
Requirements help
Source Code
function preRelayedCall(bytes calldata context) external returns (bytes32) {
require(msg.sender == getHubAddr(), "GSNRecipient: caller is not RelayHub");
return _preRelayedCall(context);
}
postRelayedCall keyboard_arrow_up
Parameters help
Requirements help
Source Code
function postRelayedCall(
bytes calldata context,
bool success,
uint256 actualCharge,
bytes32 preRetVal
) external {
require(msg.sender == getHubAddr(), "GSNRecipient: caller is not RelayHub");
_postRelayedCall(context, success, actualCharge, preRetVal);
}
setGasToken keyboard_arrow_up
setPayoutWallet keyboard_arrow_up
setGasPrice keyboard_arrow_up
withdrawDeposits keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
null
Source Code
function withdrawDeposits(uint256 amount, address payable payee)
external
onlyOwner
{
_withdrawDeposits(amount, payee);
}
acceptRelayedCall keyboard_arrow_up
Parameters help
Source Code
function acceptRelayedCall(
address,
address from,
bytes memory,
uint256 transactionFee,
uint256 gasPrice,
uint256,
uint256,
bytes memory,
uint256 maxPossibleCharge
) public view returns (uint256, bytes memory) {
if (
_gasToken.balanceOf(from) <
((maxPossibleCharge * _gasPriceScaling) / GAS_PRICE_SCALING_SCALE)
) {
return _rejectRelayedCall(uint256(ErrorCodes.INSUFFICIENT_BALANCE));
}
return
_approveRelayedCall(
abi.encode(from, maxPossibleCharge, transactionFee, gasPrice)
);
}
isPauser keyboard_arrow_up
addPauser keyboard_arrow_up
renouncePauser keyboard_arrow_up
paused keyboard_arrow_up
pause keyboard_arrow_up
unpause keyboard_arrow_up
pauseCollections keyboard_arrow_up
Modifiers help
onlyPauser checks for the following:
null
Source Code
function pauseCollections(uint256[] memory collectionIds) public onlyPauser {
for (uint256 i = 0; i < collectionIds.length; i++) {
uint256 collectionId = collectionIds[i];
require(!isNFT(collectionId)); // only works on collections
_pausedCollections[collectionId] = true;
}
emit CollectionsPaused(collectionIds, _msgSender());
}
unpauseCollections keyboard_arrow_up
Modifiers help
onlyPauser checks for the following:
null
Source Code
function unpauseCollections(uint256[] memory collectionIds) public onlyPauser {
for (uint256 i = 0; i < collectionIds.length; i++) {
uint256 collectionId = collectionIds[i];
require(!isNFT(collectionId)); // only works on collections
_pausedCollections[collectionId] = false;
}
emit CollectionsUnpaused(collectionIds, _msgSender());
}
collectionOf keyboard_arrow_up
isFungible keyboard_arrow_up
ownerOf keyboard_arrow_up
Requirements help
null
Source Code
function ownerOf(uint256 tokenId) public view returns (address) {
require(isNFT(tokenId));
address tokenOwner = _owners[tokenId];
require(tokenOwner != address(0x0));
return tokenOwner;
}
safeTransferFrom keyboard_arrow_up
safeBatchTransferFrom keyboard_arrow_up
Parameters help
Requirements help
One or more of the following:
-
_operatorApprovals for from for sender
must be equal to
true
- OR
from
must be equal to
sender
null
Source Code
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) public whenNotPaused {
for (uint256 i = 0; i < ids.length; ++i) {
require(!idPaused(ids[i]));
}
super.safeBatchTransferFrom(from, to, ids, values, data);
}
balanceOf keyboard_arrow_up
Requirements help
Source Code
function balanceOf(address tokenOwner, uint256 id)
public
view
returns (uint256)
{
require(tokenOwner != address(0x0));
if (isNFT(id)) {
return _owners[id] == tokenOwner ? 1 : 0;
}
return _balances[id][tokenOwner];
}
balanceOfBatch keyboard_arrow_up
Requirements help
Source Code
function balanceOfBatch(address[] memory tokenOwners, uint256[] memory ids)
public
view
returns (uint256[] memory)
{
require(tokenOwners.length == ids.length);
uint256[] memory balances = new uint256[](tokenOwners.length);
for (uint256 i = 0; i < tokenOwners.length; ++i) {
require(tokenOwners[i] != address(0x0));
uint256 id = ids[i];
if (isNFT(id)) {
balances[i] = _owners[id] == tokenOwners[i] ? 1 : 0;
} else {
balances[i] = _balances[id][tokenOwners[i]];
}
}
return balances;
}
setApprovalForAll keyboard_arrow_up
Source Code
function setApprovalForAll(address to, bool approved) public whenNotPaused {
super.setApprovalForAll(to, approved);
}
isApprovedForAll keyboard_arrow_up
balanceOf keyboard_arrow_up
Requirements help
Source Code
function balanceOf(address tokenOwner) public view returns (uint256) {
require(tokenOwner != address(0x0));
return _nftBalances[tokenOwner];
}
approve keyboard_arrow_up
getApproved keyboard_arrow_up
transferFrom keyboard_arrow_up
safeTransferFrom keyboard_arrow_up
safeTransferFrom keyboard_arrow_up
supportsInterface keyboard_arrow_up
Source Code
function supportsInterface(bytes4 interfaceId) public view returns (bool) {
return (// ERC165 interface id
interfaceId == 0x01ffc9a7 ||
// ERC721 interface id
interfaceId == 0x80ac58cd ||
// ERC721Metadata interface id
interfaceId == 0x5b5e139f ||
// ERC721Exists interface id
interfaceId == 0x4f558e79 ||
// ERC1155 interface id
interfaceId == 0xd9b67a26 ||
// ERC1155AssetCollections interface id
interfaceId == 0x09ce5c46 ||
// ERC1155MetadataURI interface id
interfaceId == 0x0e89341c);
}
exists keyboard_arrow_up
idPaused keyboard_arrow_up
createCollection keyboard_arrow_up
Modifiers help
onlyMinter checks for the following:
null
Requirements help
Source Code
function createCollection(uint256 collectionId, bytes32 byteUri)
external
onlyMinter
{
require(_ipfsMigrated ? uint256(byteUri) > 0 : uint256(byteUri) == 0);
require(!isNFT(collectionId));
_setURI(collectionId, byteUri);
}
batchMint keyboard_arrow_up
Parameters help
Modifiers help
onlyMinter checks for the following:
null
Requirements help
Source Code
function batchMint(
address[] memory to,
uint256[] memory ids,
bytes32[] memory uris,
uint256[] memory values,
bool safe
) public onlyMinter {
require(
ids.length == to.length &&
ids.length == uris.length &&
ids.length == values.length
);
for (uint256 i = 0; i < ids.length; i++) {
if (isNFT(ids[i]) && values[i] == 1) {
_mintNonFungible(to[i], ids[i], uris[i], safe);
} else if (isFungible(ids[i]) && uint256(uris[i]) == 0) {
_mintFungible(to[i], ids[i], values[i]);
} else {
revert();
}
}
}
mintNonFungible keyboard_arrow_up
Modifiers help
onlyMinter checks for the following:
null
Requirements help
Source Code
function mintNonFungible(
address to,
uint256 tokenId,
bytes32 byteUri,
bool safe
) external onlyMinter {
require(isNFT(tokenId)); // solium-disable-line error-reason
_mintNonFungible(to, tokenId, byteUri, safe);
}
mintFungible keyboard_arrow_up
Modifiers help
onlyMinter checks for the following:
null
Source Code
function mintFungible(
address to,
uint256 collection,
uint256 value
) external onlyMinter {
require(isFungible(collection));
_mintFungible(to, collection, value);
}
setUriPrefix keyboard_arrow_up
setIPFSUriPrefix keyboard_arrow_up
setURI keyboard_arrow_up
migrateToIPFS keyboard_arrow_up
uri keyboard_arrow_up
name keyboard_arrow_up
symbol keyboard_arrow_up
Internal Functions
Internal functions are parts of the contract that can't be used directly, but instead are used by the public functions listed above.
internal DeltaTimeInventory._mintNonFungible keyboard_arrow_up
Requirements help
Source Code
function _mintNonFungible(
address to,
uint256 id,
bytes32 byteUri,
bool safe
) internal {
require(to != address(0x0));
require(!exists(id));
uint256 collection = id & NF_COLLECTION_MASK;
_owners[id] = to;
_nftBalances[to] = SafeMath.add(_nftBalances[to], 1);
_balances[collection][to] = SafeMath.add(_balances[collection][to], 1);
emit Transfer(address(0x0), to, id);
emit TransferSingle(_msgSender(), address(0x0), to, id, 1);
_setURI(id, byteUri);
if (safe) {
require( // solium-disable-line error-reason
_checkERC1155AndCallSafeTransfer(
_msgSender(),
address(0x0),
to,
id,
1,
"",
false,
false
),
"failCheck"
);
}
}
internal DeltaTimeInventory._mintFungible keyboard_arrow_up
Source Code
function _mintFungible(
address to,
uint256 collection,
uint256 value
) internal {
require(to != address(0x0));
require(value > 0);
_balances[collection][to] = SafeMath.add(_balances[collection][to], value);
emit TransferSingle(_msgSender(), address(0x0), to, collection, value);
require( // solium-disable-line error-reason
_checkERC1155AndCallSafeTransfer(
_msgSender(),
address(0x0),
to,
collection,
value,
"",
false,
false
),
"failCheck"
);
}
internal DeltaTimeInventory._setURI keyboard_arrow_up
Source Code
function _setURI(uint256 id, bytes32 byteUri) internal {
if (uint256(byteUri) > 0) {
_uris[id] = byteUri;
emit URI(_fullUriFromHash(byteUri), id);
} else {
emit URI(_fullUriFromId(id), id);
}
}
internal DeltaTimeInventory._fullUriFromHash keyboard_arrow_up
internal DeltaTimeInventory._fullUriFromId keyboard_arrow_up
internal AssetsInventory._setApprovalForAll keyboard_arrow_up
Source Code
function _setApprovalForAll(
address sender,
address operator,
bool approved
) internal {
_operatorApprovals[sender][operator] = approved;
emit ApprovalForAll(sender, operator, approved);
}
internal AssetsInventory.isNFT keyboard_arrow_up
internal AssetsInventory._transferFrom keyboard_arrow_up
Parameters help
Requirements help
Source Code
function _transferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data,
bool safe
) internal {
require(to != address(0x0));
require(isNFT(tokenId));
address sender = _msgSender();
bool operatable = (from == sender ||
_operatorApprovals[from][sender] == true);
_transferNonFungible(from, to, tokenId, operatable);
emit Transfer(from, to, tokenId);
emit TransferSingle(sender, from, to, tokenId, 1);
require(
_checkERC1155AndCallSafeTransfer(
sender,
from,
to,
tokenId,
1,
data,
true,
safe
)
);
}
internal AssetsInventory._transferNonFungible keyboard_arrow_up
Requirements help
One or more of the following:
-
sender
must be equal to
the result of calling getApproved with tokenId
- OR
sender
must be equal to
the result of calling ownerOf with tokenId
- ORoperatable must be true
Source Code
function _transferNonFungible(
address from,
address to,
uint256 id,
bool operatable
) internal {
require(from == _owners[id]);
address sender = _msgSender();
require(operatable || ownerOf(id) == sender || getApproved(id) == sender);
// clear approval
if (_tokenApprovals[id] != address(0x0)) {
_tokenApprovals[id] = address(0x0);
}
uint256 nfCollection = id & NF_COLLECTION_MASK;
_balances[nfCollection][from] = SafeMath.sub(
_balances[nfCollection][from],
1
);
_balances[nfCollection][to] = SafeMath.add(_balances[nfCollection][to], 1);
_nftBalances[from] = SafeMath.sub(_nftBalances[from], 1);
_nftBalances[to] = SafeMath.add(_nftBalances[to], 1);
_owners[id] = to;
}
internal AssetsInventory._transferFungible keyboard_arrow_up
Parameters help
Source Code
function _transferFungible(
address from,
address to,
uint256 collectionId,
uint256 value
) internal {
_balances[collectionId][from] = SafeMath.sub(
_balances[collectionId][from],
value
);
_balances[collectionId][to] = SafeMath.add(
_balances[collectionId][to],
value
);
}
internal AssetsInventory._checkERC721AndCallSafeTransfer keyboard_arrow_up
Parameters help
Source Code
function _checkERC721AndCallSafeTransfer(
address operator,
address from,
address to,
uint256 tokenId,
bytes memory data
) internal returns (bool) {
if (!Address.isContract(to)) {
return true;
}
return (IERC721Receiver(to).onERC721Received(operator, from, tokenId, data) ==
0x150b7a02); // 0x150b7a02: ERC721 receive magic value
}
internal AssetsInventory._checkERC1155AndCallSafeTransfer keyboard_arrow_up
Parameters help
Source Code
function _checkERC1155AndCallSafeTransfer(
address operator,
address from,
address to,
uint256 id,
uint256 value,
bytes memory data,
bool erc721,
bool erc721Safe
) internal returns (bool) {
if (!Address.isContract(to)) {
return true;
}
if (erc721) {
if (!_checkIsERC1155Receiver(to)) {
if (erc721Safe) {
return _checkERC721AndCallSafeTransfer(operator, from, to, id, data);
} else {
return true;
}
}
}
return
IERC1155TokenReceiver(to).onERC1155Received(
operator,
from,
id,
value,
data
) == 0xf23a6e61; // 0xf23a6e61: ERC1155 receive magic value
}
internal AssetsInventory._checkERC1155AndCallSafeBatchTransfer keyboard_arrow_up
Parameters help
Source Code
function _checkERC1155AndCallSafeBatchTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal returns (bool) {
if (!Address.isContract(to)) {
return true;
}
bytes4 retval = IERC1155TokenReceiver(to).onERC1155BatchReceived(
operator,
from,
ids,
values,
data
);
return (retval == 0xbc197c81); // 0xbc197c81: ERC1155 batch receive magic value
}
internal AssetsInventory._checkIsERC1155Receiver keyboard_arrow_up
Source Code
function _checkIsERC1155Receiver(address _contract)
internal
view
returns (bool)
{
bytes4 erc1155ReceiverID = 0x4e2312e0;
bytes4 INTERFACE_ID_ERC165 = 0x01ffc9a7;
bool success;
uint256 result;
// solium-disable-next-line security/no-inline-assembly
assembly {
let x := mload(0x40) // Find empty storage location using "free memory pointer"
mstore(x, INTERFACE_ID_ERC165) // Place signature at beginning of empty storage
mstore(add(x, 0x04), erc1155ReceiverID) // Place first argument directly next to signature
success := staticcall(
10000, // 10k gas
_contract, // To addr
x, // Inputs are stored at location x
0x24, // Inputs are 36 bytes long
x, // Store output over input (saves space)
0x20
) // Outputs are 32 bytes long
result := mload(x) // Load the result
}
// (10000 / 63) "not enough for supportsInterface(...)" // consume all gas, so caller can potentially know that there was not enough gas
assert(gasleft() > 158);
return success && result == 1;
}
internal Context.constructor keyboard_arrow_up
internal Context._msgSender keyboard_arrow_up
internal Context._msgData keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
internal Pausable.constructor keyboard_arrow_up
internal Context.constructor keyboard_arrow_up
internal Context._msgSender keyboard_arrow_up
internal Context._msgData keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
internal PauserRole.constructor keyboard_arrow_up
internal PauserRole._addPauser keyboard_arrow_up
internal PauserRole._removePauser keyboard_arrow_up
internal Context.constructor keyboard_arrow_up
internal Context._msgSender keyboard_arrow_up
internal Context._msgData keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
internal ERC20Fees.constructor keyboard_arrow_up
Requirements help
Source Code
constructor(address gasTokenAddress, address payoutWallet) internal {
setGasToken(gasTokenAddress);
setPayoutWallet(payoutWallet);
}
internal ERC20Fees._preRelayedCall keyboard_arrow_up
Source Code
function _preRelayedCall(bytes memory context) internal returns (bytes32) {
(address from, uint256 maxPossibleCharge) = abi.decode(
context,
(address, uint256)
);
// The maximum token charge is pre-charged from the user
require(
_gasToken.transferFrom(
from,
_payoutWallet,
(maxPossibleCharge * _gasPriceScaling) / GAS_PRICE_SCALING_SCALE
)
);
}
internal ERC20Fees._postRelayedCall keyboard_arrow_up
Source Code
function _postRelayedCall(
bytes memory context,
bool,
uint256 actualCharge,
bytes32
) internal {
(
address from,
uint256 maxPossibleCharge,
uint256 transactionFee,
uint256 gasPrice
) = abi.decode(context, (address, uint256, uint256, uint256));
// actualCharge is an _estimated_ charge, which assumes postRelayedCall will use all available gas.
// This implementation's gas cost can be roughly estimated as 10k gas, for the two SSTORE operations in an
// ERC20 transfer.
uint256 overestimation = _computeCharge(
SafeMath.sub(POST_RELAYED_CALL_MAX_GAS, 10000),
gasPrice,
transactionFee
);
actualCharge = SafeMath.sub(actualCharge, overestimation);
// After the relayed call has been executed and the actual charge estimated, the excess pre-charge is returned
require(
_gasToken.transferFrom(
_payoutWallet,
from,
(SafeMath.sub(maxPossibleCharge, actualCharge) * _gasPriceScaling) /
GAS_PRICE_SCALING_SCALE
)
);
}
internal GSNRecipient._upgradeRelayHub keyboard_arrow_up
Requirements help
Source Code
function _upgradeRelayHub(address newRelayHub) internal {
address currentRelayHub = _relayHub;
require(
newRelayHub != address(0),
"GSNRecipient: new RelayHub is the zero address"
);
require(
newRelayHub != currentRelayHub,
"GSNRecipient: new RelayHub is the current one"
);
emit RelayHubChanged(currentRelayHub, newRelayHub);
_relayHub = newRelayHub;
}
internal GSNRecipient._withdrawDeposits keyboard_arrow_up
internal GSNRecipient._msgSender keyboard_arrow_up
internal GSNRecipient._msgData keyboard_arrow_up
internal GSNRecipient._preRelayedCall keyboard_arrow_up
internal GSNRecipient._postRelayedCall keyboard_arrow_up
Parameters help
Source Code
function _postRelayedCall(
bytes memory context,
bool success,
uint256 actualCharge,
bytes32 preRetVal
) internal;
internal GSNRecipient._approveRelayedCall keyboard_arrow_up
internal GSNRecipient._approveRelayedCall keyboard_arrow_up
internal GSNRecipient._rejectRelayedCall keyboard_arrow_up
internal GSNRecipient._computeCharge keyboard_arrow_up
Source Code
function _computeCharge(
uint256 gas,
uint256 gasPrice,
uint256 serviceFee
) internal pure returns (uint256) {
// The fee is expressed as a percentage. E.g. a value of 40 stands for a 40% fee, so the recipient will be
// charged for 1.4 times the spent amount.
return (gas * gasPrice * (100 + serviceFee)) / 100;
}
internal GSNRecipient._getRelayedCallSender keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function _getRelayedCallSender() private pure returns (address payable result) {
// We need to read 20 bytes (an address) located at array index msg.data.length - 20. In memory, the array
// is prefixed with a 32-byte length value, so we first add 32 to get the memory read index. However, doing
// so would leave the address in the upper 20 bytes of the 32-byte word, which is inconvenient and would
// require bit shifting. We therefore subtract 12 from the read index so the address lands on the lower 20
// bytes. This can always be done due to the 32-byte prefix.
// The final memory read index is msg.data.length - 20 + 32 - 12 = msg.data.length. Using inline assembly is the
// easiest/most-efficient way to perform this operation.
// These fields are not accessible from assembly
bytes memory array = msg.data;
uint256 index = msg.data.length;
// solhint-disable-next-line no-inline-assembly
assembly {
// Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
result := and(
mload(add(array, index)),
0xffffffffffffffffffffffffffffffffffffffff
)
}
return result;
}
internal GSNRecipient._getRelayedCallData keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function _getRelayedCallData() private pure returns (bytes memory) {
// RelayHub appends the sender address at the end of the calldata, so in order to retrieve the actual msg.data,
// we must strip the last 20 bytes (length of an address type) from it.
uint256 actualDataLength = msg.data.length - 20;
bytes memory actualData = new bytes(actualDataLength);
for (uint256 i = 0; i < actualDataLength; ++i) {
actualData[i] = msg.data[i];
}
return actualData;
}
internal Context.constructor keyboard_arrow_up
internal Context._msgSender keyboard_arrow_up
internal Context._msgData keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
internal Ownable.constructor keyboard_arrow_up
internal Ownable._transferOwnership keyboard_arrow_up
Source Code
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
internal Context.constructor keyboard_arrow_up
internal Context._msgSender keyboard_arrow_up
internal Context._msgData keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
internal MinterRole.constructor keyboard_arrow_up
internal MinterRole._addMinter keyboard_arrow_up
internal MinterRole._removeMinter keyboard_arrow_up
internal Context.constructor keyboard_arrow_up
internal Context._msgSender keyboard_arrow_up
internal Context._msgData keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}