编译器
0.6.12+commit.27d51765
文件 1 的 30:Address.sol
pragma solidity ^0.6.2;
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
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 的 30:BaseRelayRecipient.sol
pragma solidity ^0.6.2;
import "./interfaces/IRelayRecipient.sol";
abstract contract BaseRelayRecipient is IRelayRecipient {
address public trustedForwarder;
function isTrustedForwarder(address forwarder) public override view returns(bool) {
return forwarder == trustedForwarder;
}
function _msgSender() internal override virtual view returns (address payable ret) {
if (msg.data.length >= 24 && isTrustedForwarder(msg.sender)) {
assembly {
ret := shr(96,calldataload(sub(calldatasize(),20)))
}
} else {
return msg.sender;
}
}
function _msgData() internal override virtual view returns (bytes memory ret) {
if (msg.data.length >= 24 && isTrustedForwarder(msg.sender)) {
assembly {
let ptr := mload(0x40)
let size := sub(calldatasize(),20)
mstore(ptr, 0x20)
mstore(add(ptr,32), size)
calldatacopy(add(ptr,64), 0, size)
return(ptr, add(size,64))
}
} else {
return msg.data;
}
}
}
文件 3 的 30:BlackholePrevention.sol
pragma solidity >=0.6.0;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
contract BlackholePrevention {
using Address for address payable;
using SafeERC20 for IERC20;
event WithdrawStuckEther(address indexed receiver, uint256 amount);
event WithdrawStuckERC20(address indexed receiver, address indexed tokenAddress, uint256 amount);
event WithdrawStuckERC721(address indexed receiver, address indexed tokenAddress, uint256 indexed tokenId);
function _withdrawEther(address payable receiver, uint256 amount) internal virtual {
require(receiver != address(0x0), "BHP:E-403");
if (address(this).balance >= amount) {
receiver.sendValue(amount);
emit WithdrawStuckEther(receiver, amount);
}
}
function _withdrawERC20(address payable receiver, address tokenAddress, uint256 amount) internal virtual {
require(receiver != address(0x0), "BHP:E-403");
if (IERC20(tokenAddress).balanceOf(address(this)) >= amount) {
IERC20(tokenAddress).safeTransfer(receiver, amount);
emit WithdrawStuckERC20(receiver, tokenAddress, amount);
}
}
function _withdrawERC721(address payable receiver, address tokenAddress, uint256 tokenId) internal virtual {
require(receiver != address(0x0), "BHP:E-403");
if (IERC721(tokenAddress).ownerOf(tokenId) == address(this)) {
IERC721(tokenAddress).transferFrom(address(this), receiver, tokenId);
emit WithdrawStuckERC721(receiver, tokenAddress, tokenId);
}
}
}
文件 4 的 30:Context.sol
pragma solidity ^0.6.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
文件 5 的 30:Counters.sol
pragma solidity ^0.6.0;
import "../math/SafeMath.sol";
library Counters {
using SafeMath for uint256;
struct Counter {
uint256 _value;
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
counter._value += 1;
}
function decrement(Counter storage counter) internal {
counter._value = counter._value.sub(1);
}
}
文件 6 的 30:ERC165.sol
pragma solidity ^0.6.0;
import "./IERC165.sol";
contract ERC165 is IERC165 {
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
mapping(bytes4 => bool) private _supportedInterfaces;
constructor () internal {
_registerInterface(_INTERFACE_ID_ERC165);
}
function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return _supportedInterfaces[interfaceId];
}
function _registerInterface(bytes4 interfaceId) internal virtual {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
}
文件 7 的 30:ERC721.sol
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/introspection/ERC165.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/EnumerableMap.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using SafeMath for uint256;
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
event TransferBatch(address indexed from, address indexed to, uint256 startTokenId, uint256 count);
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
mapping (address => EnumerableSet.UintSet) private _holderTokens;
EnumerableMap.UintToAddressMap private _tokenOwners;
mapping (uint256 => address) private _tokenApprovals;
mapping (address => mapping (address => bool)) private _operatorApprovals;
string private _name;
string private _symbol;
mapping(uint256 => string) private _tokenURIs;
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_registerInterface(_INTERFACE_ID_ERC721);
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
function balanceOf(address owner) public view override returns (uint256) {
require(owner != address(0), "ERC721:E-403");
return _holderTokens[owner].length();
}
function ownerOf(uint256 tokenId) public view override returns (address) {
return _tokenOwners.get(tokenId, "ERC721:E-405");
}
function name() public view override returns (string memory) {
return _name;
}
function symbol() public view override returns (string memory) {
return _symbol;
}
function tokenURI(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), "ERC721:E-405");
return _tokenURIs[tokenId];
}
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) {
return _holderTokens[owner].at(index);
}
function totalSupply() public view override returns (uint256) {
return _tokenOwners.length();
}
function tokenByIndex(uint256 index) public view override returns (uint256) {
(uint256 tokenId, ) = _tokenOwners.at(index);
return tokenId;
}
function approve(address to, uint256 tokenId) public virtual override {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721:E-111");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721:E-105");
_approve(to, tokenId);
}
function getApproved(uint256 tokenId) public view override returns (address) {
require(_exists(tokenId), "ERC721:E-405");
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721:E-111");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address owner, address operator) public view override returns (bool) {
return _operatorApprovals[owner][operator];
}
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721:E-105");
_transfer(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721:E-105");
_safeTransfer(from, to, tokenId, _data);
}
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721:E-402");
}
function _exists(uint256 tokenId) internal view returns (bool) {
return _tokenOwners.contains(tokenId);
}
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
require(_exists(tokenId), "ERC721:E-405");
address owner = ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
_mint(to, tokenId);
require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721:E-402");
}
function _safeMintBatch(address to, uint256 startTokenId, uint256 count, bytes memory _data) internal virtual {
_mintBatch(to, startTokenId, count);
require(_checkOnERC721Received(address(0), to, startTokenId, _data), "ERC721:E-402");
}
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721:E-403");
require(!_exists(tokenId), "ERC721:E-407");
_holderTokens[to].add(tokenId);
_tokenOwners.set(tokenId, to);
emit Transfer(address(0), to, tokenId);
}
function _mintBatch(address to, uint256 startTokenId, uint256 count) internal virtual {
require(to != address(0), "ERC721:E-403");
require(!_exists(startTokenId), "ERC721:E-407");
for (uint i = 0; i < count; i++) {
uint256 tokenId = startTokenId.add(i);
_holderTokens[to].add(tokenId);
_tokenOwners.set(tokenId, to);
}
emit TransferBatch(address(0), to, startTokenId, count);
}
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ownerOf(tokenId) == from, "ERC721:E-102");
require(to != address(0), "ERC721:E-403");
_approve(address(0), tokenId);
_holderTokens[from].remove(tokenId);
_holderTokens[to].add(tokenId);
_tokenOwners.set(tokenId, to);
emit Transfer(from, to, tokenId);
}
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721:E-405");
_tokenURIs[tokenId] = _tokenURI;
}
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
private returns (bool)
{
if (!to.isContract()) {
return true;
}
bytes memory returndata = to.functionCall(abi.encodeWithSelector(
IERC721Receiver(to).onERC721Received.selector,
_msgSender(),
from,
tokenId,
_data
), "ERC721:E-402");
bytes4 retval = abi.decode(returndata, (bytes4));
return (retval == _ERC721_RECEIVED);
}
function _approve(address to, uint256 tokenId) private {
_tokenApprovals[tokenId] = to;
emit Approval(ownerOf(tokenId), to, tokenId);
}
}
文件 8 的 30:EnumerableMap.sol
pragma solidity ^0.6.0;
library EnumerableMap {
struct MapEntry {
bytes32 _key;
bytes32 _value;
}
struct Map {
MapEntry[] _entries;
mapping (bytes32 => uint256) _indexes;
}
function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
uint256 keyIndex = map._indexes[key];
if (keyIndex == 0) {
map._entries.push(MapEntry({ _key: key, _value: value }));
map._indexes[key] = map._entries.length;
return true;
} else {
map._entries[keyIndex - 1]._value = value;
return false;
}
}
function _remove(Map storage map, bytes32 key) private returns (bool) {
uint256 keyIndex = map._indexes[key];
if (keyIndex != 0) {
uint256 toDeleteIndex = keyIndex - 1;
uint256 lastIndex = map._entries.length - 1;
MapEntry storage lastEntry = map._entries[lastIndex];
map._entries[toDeleteIndex] = lastEntry;
map._indexes[lastEntry._key] = toDeleteIndex + 1;
map._entries.pop();
delete map._indexes[key];
return true;
} else {
return false;
}
}
function _contains(Map storage map, bytes32 key) private view returns (bool) {
return map._indexes[key] != 0;
}
function _length(Map storage map) private view returns (uint256) {
return map._entries.length;
}
function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
require(map._entries.length > index, "EnumerableMap: index out of bounds");
MapEntry storage entry = map._entries[index];
return (entry._key, entry._value);
}
function _get(Map storage map, bytes32 key) private view returns (bytes32) {
return _get(map, key, "EnumerableMap: nonexistent key");
}
function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
uint256 keyIndex = map._indexes[key];
require(keyIndex != 0, errorMessage);
return map._entries[keyIndex - 1]._value;
}
struct UintToAddressMap {
Map _inner;
}
function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
return _set(map._inner, bytes32(key), bytes32(uint256(value)));
}
function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
return _remove(map._inner, bytes32(key));
}
function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
return _contains(map._inner, bytes32(key));
}
function length(UintToAddressMap storage map) internal view returns (uint256) {
return _length(map._inner);
}
function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
(bytes32 key, bytes32 value) = _at(map._inner, index);
return (uint256(key), address(uint256(value)));
}
function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
return address(uint256(_get(map._inner, bytes32(key))));
}
function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
return address(uint256(_get(map._inner, bytes32(key), errorMessage)));
}
}
文件 9 的 30:EnumerableSet.sol
pragma solidity ^0.6.0;
library EnumerableSet {
struct Set {
bytes32[] _values;
mapping (bytes32 => uint256) _indexes;
}
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
function _remove(Set storage set, bytes32 value) private returns (bool) {
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
bytes32 lastvalue = set._values[lastIndex];
set._values[toDeleteIndex] = lastvalue;
set._indexes[lastvalue] = toDeleteIndex + 1;
set._values.pop();
delete set._indexes[value];
return true;
} else {
return false;
}
}
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
struct AddressSet {
Set _inner;
}
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
struct UintSet {
Set _inner;
}
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
文件 10 的 30:IBasketManager.sol
pragma solidity >=0.6.0;
interface IBasketManager {
event ControllerSet(address indexed controller);
event PausedStateSet(bool isPaused);
event NewSmartBasket(address indexed contractAddress, uint256 indexed tokenId, address indexed smartBasket);
event BasketAdd(address indexed contractAddress, uint256 indexed tokenId, address basketTokenAddress, uint256 basketTokenId);
event BasketRemove(address indexed receiver, address indexed contractAddress, uint256 indexed tokenId, address basketTokenAddress, uint256 basketTokenId);
function isPaused() external view returns (bool);
function getTokenTotalCount(address contractAddress, uint256 tokenId) external view returns (uint256);
function getTokenCountByType(address contractAddress, uint256 tokenId, address basketTokenAddress, uint256 basketTokenId) external returns (uint256);
function addToBasket(address contractAddress, uint256 tokenId, address basketTokenAddress, uint256 basketTokenId) external returns (bool);
function removeFromBasket(address receiver, address contractAddress, uint256 tokenId, address basketTokenAddress, uint256 basketTokenId) external returns (bool);
function executeForAccount(address contractAddress, uint256 tokenId, address externalAddress, uint256 ethValue, bytes memory encodedParams) external returns (bytes memory);
function getBasketAddressById(address contractAddress, uint256 tokenId) external returns (address);
function withdrawEther(address contractAddress, uint256 tokenId, address payable receiver, uint256 amount) external;
function withdrawERC20(address contractAddress, uint256 tokenId, address payable receiver, address tokenAddress, uint256 amount) external;
function withdrawERC721(address contractAddress, uint256 tokenId, address payable receiver, address nftTokenAddress, uint256 nftTokenId) external;
}
文件 11 的 30:IChargedParticles.sol
pragma solidity >=0.6.0;
interface IChargedParticles {
function getStateAddress() external view returns (address stateAddress);
function getSettingsAddress() external view returns (address settingsAddress);
function baseParticleMass(address contractAddress, uint256 tokenId, string calldata walletManagerId, address assetToken) external returns (uint256);
function currentParticleCharge(address contractAddress, uint256 tokenId, string calldata walletManagerId, address assetToken) external returns (uint256);
function currentParticleKinetics(address contractAddress, uint256 tokenId, string calldata walletManagerId, address assetToken) external returns (uint256);
function currentParticleCovalentBonds(address contractAddress, uint256 tokenId, string calldata basketManagerId) external view returns (uint256);
function energizeParticle(
address contractAddress,
uint256 tokenId,
string calldata walletManagerId,
address assetToken,
uint256 assetAmount,
address referrer
) external returns (uint256 yieldTokensAmount);
function dischargeParticle(
address receiver,
address contractAddress,
uint256 tokenId,
string calldata walletManagerId,
address assetToken
) external returns (uint256 creatorAmount, uint256 receiverAmount);
function dischargeParticleAmount(
address receiver,
address contractAddress,
uint256 tokenId,
string calldata walletManagerId,
address assetToken,
uint256 assetAmount
) external returns (uint256 creatorAmount, uint256 receiverAmount);
function dischargeParticleForCreator(
address receiver,
address contractAddress,
uint256 tokenId,
string calldata walletManagerId,
address assetToken,
uint256 assetAmount
) external returns (uint256 receiverAmount);
function releaseParticle(
address receiver,
address contractAddress,
uint256 tokenId,
string calldata walletManagerId,
address assetToken
) external returns (uint256 creatorAmount, uint256 receiverAmount);
function releaseParticleAmount(
address receiver,
address contractAddress,
uint256 tokenId,
string calldata walletManagerId,
address assetToken,
uint256 assetAmount
) external returns (uint256 creatorAmount, uint256 receiverAmount);
function covalentBond(
address contractAddress,
uint256 tokenId,
string calldata basketManagerId,
address nftTokenAddress,
uint256 nftTokenId
) external returns (bool success);
function breakCovalentBond(
address receiver,
address contractAddress,
uint256 tokenId,
string calldata basketManagerId,
address nftTokenAddress,
uint256 nftTokenId
) external returns (bool success);
event UniverseSet(address indexed universeAddress);
event ChargedStateSet(address indexed chargedState);
event ChargedSettingsSet(address indexed chargedSettings);
event LeptonTokenSet(address indexed leptonToken);
}
文件 12 的 30:IChargedSettings.sol
pragma solidity >=0.6.0;
import "./IWalletManager.sol";
import "./IBasketManager.sol";
interface IChargedSettings {
function isContractOwner(address contractAddress, address account) external view returns (bool);
function getCreatorAnnuities(address contractAddress, uint256 tokenId) external view returns (address creator, uint256 annuityPct);
function getCreatorAnnuitiesRedirect(address contractAddress, uint256 tokenId) external view returns (address);
function getTempLockExpiryBlocks() external view returns (uint256);
function getTimelockApprovals(address operator) external view returns (bool timelockAny, bool timelockOwn);
function getAssetRequirements(address contractAddress, address assetToken) external view
returns (string memory requiredWalletManager, bool energizeEnabled, bool restrictedAssets, bool validAsset, uint256 depositCap, uint256 depositMin, uint256 depositMax);
function getNftAssetRequirements(address contractAddress, address nftTokenAddress) external view
returns (string memory requiredBasketManager, bool basketEnabled, uint256 maxNfts);
function isWalletManagerEnabled(string calldata walletManagerId) external view returns (bool);
function getWalletManager(string calldata walletManagerId) external view returns (IWalletManager);
function isNftBasketEnabled(string calldata basketId) external view returns (bool);
function getBasketManager(string calldata basketId) external view returns (IBasketManager);
function setCreatorAnnuities(address contractAddress, uint256 tokenId, address creator, uint256 annuityPercent) external;
function setCreatorAnnuitiesRedirect(address contractAddress, uint256 tokenId, address creator, address receiver) external;
function setRequiredWalletManager(address contractAddress, string calldata walletManager) external;
function setRequiredBasketManager(address contractAddress, string calldata basketManager) external;
function setAssetTokenRestrictions(address contractAddress, bool restrictionsEnabled) external;
function setAllowedAssetToken(address contractAddress, address assetToken, bool isAllowed) external;
function setAssetTokenLimits(address contractAddress, address assetToken, uint256 depositMin, uint256 depositMax) external;
function setMaxNfts(address contractAddress, address nftTokenAddress, uint256 maxNfts) external;
function enableNftContracts(address[] calldata contracts) external;
function setPermsForCharge(address contractAddress, bool state) external;
function setPermsForBasket(address contractAddress, bool state) external;
function setPermsForTimelockAny(address contractAddress, bool state) external;
function setPermsForTimelockSelf(address contractAddress, bool state) external;
event DepositCapSet(address assetToken, uint256 depositCap);
event TempLockExpirySet(uint256 expiryBlocks);
event WalletManagerRegistered(string indexed walletManagerId, address indexed walletManager);
event BasketManagerRegistered(string indexed basketId, address indexed basketManager);
event RequiredWalletManagerSet(address indexed contractAddress, string walletManager);
event RequiredBasketManagerSet(address indexed contractAddress, string basketManager);
event AssetTokenRestrictionsSet(address indexed contractAddress, bool restrictionsEnabled);
event AllowedAssetTokenSet(address indexed contractAddress, address assetToken, bool isAllowed);
event AssetTokenLimitsSet(address indexed contractAddress, address assetToken, uint256 assetDepositMin, uint256 assetDepositMax);
event MaxNftsSet(address indexed contractAddress, address indexed nftTokenAddress, uint256 maxNfts);
event TokenCreatorConfigsSet(address indexed contractAddress, uint256 indexed tokenId, address indexed creatorAddress, uint256 annuityPercent);
event TokenCreatorAnnuitiesRedirected(address indexed contractAddress, uint256 indexed tokenId, address indexed redirectAddress);
event PermsSetForCharge(address indexed contractAddress, bool state);
event PermsSetForBasket(address indexed contractAddress, bool state);
event PermsSetForTimelockAny(address indexed contractAddress, bool state);
event PermsSetForTimelockSelf(address indexed contractAddress, bool state);
}
文件 13 的 30:IChargedState.sol
pragma solidity >=0.6.0;
import "./IChargedSettings.sol";
interface IChargedState {
function getDischargeTimelockExpiry(address contractAddress, uint256 tokenId) external view returns (uint256 lockExpiry);
function getReleaseTimelockExpiry(address contractAddress, uint256 tokenId) external view returns (uint256 lockExpiry);
function getBreakBondTimelockExpiry(address contractAddress, uint256 tokenId) external view returns (uint256 lockExpiry);
function isApprovedForDischarge(address contractAddress, uint256 tokenId, address operator) external view returns (bool);
function isApprovedForRelease(address contractAddress, uint256 tokenId, address operator) external view returns (bool);
function isApprovedForBreakBond(address contractAddress, uint256 tokenId, address operator) external view returns (bool);
function isApprovedForTimelock(address contractAddress, uint256 tokenId, address operator) external view returns (bool);
function isEnergizeRestricted(address contractAddress, uint256 tokenId) external view returns (bool);
function isCovalentBondRestricted(address contractAddress, uint256 tokenId) external view returns (bool);
function getDischargeState(address contractAddress, uint256 tokenId, address sender) external view
returns (bool allowFromAll, bool isApproved, uint256 timelock, uint256 tempLockExpiry);
function getReleaseState(address contractAddress, uint256 tokenId, address sender) external view
returns (bool allowFromAll, bool isApproved, uint256 timelock, uint256 tempLockExpiry);
function getBreakBondState(address contractAddress, uint256 tokenId, address sender) external view
returns (bool allowFromAll, bool isApproved, uint256 timelock, uint256 tempLockExpiry);
function setDischargeApproval(address contractAddress, uint256 tokenId, address operator) external;
function setReleaseApproval(address contractAddress, uint256 tokenId, address operator) external;
function setBreakBondApproval(address contractAddress, uint256 tokenId, address operator) external;
function setTimelockApproval(address contractAddress, uint256 tokenId, address operator) external;
function setApprovalForAll(address contractAddress, uint256 tokenId, address operator) external;
function setPermsForRestrictCharge(address contractAddress, uint256 tokenId, bool state) external;
function setPermsForAllowDischarge(address contractAddress, uint256 tokenId, bool state) external;
function setPermsForAllowRelease(address contractAddress, uint256 tokenId, bool state) external;
function setPermsForRestrictBond(address contractAddress, uint256 tokenId, bool state) external;
function setPermsForAllowBreakBond(address contractAddress, uint256 tokenId, bool state) external;
function setDischargeTimelock(
address contractAddress,
uint256 tokenId,
uint256 unlockBlock
) external;
function setReleaseTimelock(
address contractAddress,
uint256 tokenId,
uint256 unlockBlock
) external;
function setBreakBondTimelock(
address contractAddress,
uint256 tokenId,
uint256 unlockBlock
) external;
function setTemporaryLock(
address contractAddress,
uint256 tokenId,
bool isLocked
) external;
event ChargedSettingsSet(address indexed settingsController);
event DischargeApproval(address indexed contractAddress, uint256 indexed tokenId, address indexed owner, address operator);
event ReleaseApproval(address indexed contractAddress, uint256 indexed tokenId, address indexed owner, address operator);
event BreakBondApproval(address indexed contractAddress, uint256 indexed tokenId, address indexed owner, address operator);
event TimelockApproval(address indexed contractAddress, uint256 indexed tokenId, address indexed owner, address operator);
event TokenDischargeTimelock(address indexed contractAddress, uint256 indexed tokenId, address indexed operator, uint256 unlockBlock);
event TokenReleaseTimelock(address indexed contractAddress, uint256 indexed tokenId, address indexed operator, uint256 unlockBlock);
event TokenBreakBondTimelock(address indexed contractAddress, uint256 indexed tokenId, address indexed operator, uint256 unlockBlock);
event TokenTempLock(address indexed contractAddress, uint256 indexed tokenId, uint256 unlockBlock);
event PermsSetForRestrictCharge(address indexed contractAddress, uint256 indexed tokenId, bool state);
event PermsSetForAllowDischarge(address indexed contractAddress, uint256 indexed tokenId, bool state);
event PermsSetForAllowRelease(address indexed contractAddress, uint256 indexed tokenId, bool state);
event PermsSetForRestrictBond(address indexed contractAddress, uint256 indexed tokenId, bool state);
event PermsSetForAllowBreakBond(address indexed contractAddress, uint256 indexed tokenId, bool state);
}
文件 14 的 30:IERC165.sol
pragma solidity ^0.6.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 15 的 30:IERC20.sol
pragma solidity ^0.6.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, 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 sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
文件 16 的 30:IERC721.sol
pragma solidity ^0.6.2;
import "../../introspection/IERC165.sol";
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(address from, address to, uint256 tokenId) external;
function transferFrom(address from, address to, uint256 tokenId) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator) external view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
文件 17 的 30:IERC721Enumerable.sol
pragma solidity ^0.6.2;
import "./IERC721.sol";
interface IERC721Enumerable is IERC721 {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
function tokenByIndex(uint256 index) external view returns (uint256);
}
文件 18 的 30:IERC721Metadata.sol
pragma solidity ^0.6.2;
import "./IERC721.sol";
interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
文件 19 的 30:IERC721Receiver.sol
pragma solidity ^0.6.0;
interface IERC721Receiver {
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)
external returns (bytes4);
}
文件 20 的 30:IProton.sol
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../interfaces/IUniverse.sol";
import "../interfaces/IChargedState.sol";
import "../interfaces/IChargedSettings.sol";
import "../interfaces/IChargedParticles.sol";
import "../lib/BlackholePrevention.sol";
import "../lib/RelayRecipient.sol";
interface IProton is IERC721 {
event UniverseSet(address indexed universe);
event ChargedStateSet(address indexed chargedState);
event ChargedSettingsSet(address indexed chargedSettings);
event ChargedParticlesSet(address indexed chargedParticles);
event PausedStateSet(bool isPaused);
event SalePriceSet(uint256 indexed tokenId, uint256 salePrice);
event CreatorRoyaltiesSet(uint256 indexed tokenId, uint256 royaltiesPct);
event FeesWithdrawn(address indexed receiver, uint256 amount);
event ProtonSold(uint256 indexed tokenId, address indexed oldOwner, address indexed newOwner, uint256 salePrice, address creator, uint256 creatorRoyalties);
event RoyaltiesClaimed(address indexed receiver, uint256 amountClaimed);
function creatorOf(uint256 tokenId) external view returns (address);
function getSalePrice(uint256 tokenId) external view returns (uint256);
function getLastSellPrice(uint256 tokenId) external view returns (uint256);
function getCreatorRoyalties(address account) external view returns (uint256);
function getCreatorRoyaltiesPct(uint256 tokenId) external view returns (uint256);
function getCreatorRoyaltiesReceiver(uint256 tokenId) external view returns (address);
function buyProton(uint256 tokenId) external payable returns (bool);
function claimCreatorRoyalties() external returns (uint256);
function createChargedParticle(
address creator,
address receiver,
address referrer,
string memory tokenMetaUri,
string memory walletManagerId,
address assetToken,
uint256 assetAmount,
uint256 annuityPercent
) external returns (uint256 newTokenId);
function createBasicProton(
address creator,
address receiver,
string memory tokenMetaUri
) external returns (uint256 newTokenId);
function createProton(
address creator,
address receiver,
string memory tokenMetaUri,
uint256 annuityPercent
) external returns (uint256 newTokenId);
function createProtonForSale(
address creator,
address receiver,
string memory tokenMetaUri,
uint256 annuityPercent,
uint256 royaltiesPercent,
uint256 salePrice
) external returns (uint256 newTokenId);
function batchProtonsForSale(
address creator,
uint256 annuityPercent,
uint256 royaltiesPercent,
string[] calldata tokenMetaUris,
uint256[] calldata salePrices
) external;
function setSalePrice(uint256 tokenId, uint256 salePrice) external;
function setRoyaltiesPct(uint256 tokenId, uint256 royaltiesPct) external;
function setCreatorRoyaltiesReceiver(uint256 tokenId, address receiver) external;
}
文件 21 的 30:IRelayRecipient.sol
pragma solidity ^0.6.2;
abstract contract IRelayRecipient {
function isTrustedForwarder(address forwarder) public virtual view returns(bool);
function _msgSender() internal virtual view returns (address payable);
function _msgData() internal virtual view returns (bytes memory);
function versionRecipient() external virtual view returns (string memory);
}
文件 22 的 30:IUniverse.sol
pragma solidity >=0.6.0;
interface IUniverse {
event ChargedParticlesSet(address indexed chargedParticles);
event PhotonSet(address indexed photonToken, uint256 maxSupply);
event ProtonTokenSet(address indexed protonToken);
event LeptonTokenSet(address indexed leptonToken);
event QuarkTokenSet(address indexed quarkToken);
event BosonTokenSet(address indexed bosonToken);
event EsaMultiplierSet(address indexed assetToken, uint256 multiplier);
event ElectrostaticAttraction(address indexed account, address photonSource, uint256 energy, uint256 multiplier);
event ElectrostaticDischarge(address indexed account, address photonSource, uint256 energy);
function onEnergize(
address sender,
address referrer,
address contractAddress,
uint256 tokenId,
string calldata managerId,
address assetToken,
uint256 assetEnergy
) external;
function onDischarge(
address contractAddress,
uint256 tokenId,
string calldata managerId,
address assetToken,
uint256 creatorEnergy,
uint256 receiverEnergy
) external;
function onDischargeForCreator(
address contractAddress,
uint256 tokenId,
string calldata managerId,
address creator,
address assetToken,
uint256 receiverEnergy
) external;
function onRelease(
address contractAddress,
uint256 tokenId,
string calldata managerId,
address assetToken,
uint256 principalEnergy,
uint256 creatorEnergy,
uint256 receiverEnergy
) external;
function onCovalentBond(
address contractAddress,
uint256 tokenId,
string calldata managerId,
address nftTokenAddress,
uint256 nftTokenId
) external;
function onCovalentBreak(
address contractAddress,
uint256 tokenId,
string calldata managerId,
address nftTokenAddress,
uint256 nftTokenId
) external;
function onProtonSale(
address contractAddress,
uint256 tokenId,
address oldOwner,
address newOwner,
uint256 salePrice,
address creator,
uint256 creatorRoyalties
) external;
}
文件 23 的 30:IWalletManager.sol
pragma solidity >=0.6.0;
interface IWalletManager {
event ControllerSet(address indexed controller);
event PausedStateSet(bool isPaused);
event NewSmartWallet(address indexed contractAddress, uint256 indexed tokenId, address indexed smartWallet, address creator, uint256 annuityPct);
event WalletEnergized(address indexed contractAddress, uint256 indexed tokenId, address indexed assetToken, uint256 assetAmount, uint256 yieldTokensAmount);
event WalletDischarged(address indexed contractAddress, uint256 indexed tokenId, address indexed assetToken, uint256 creatorAmount, uint256 receiverAmount);
event WalletDischargedForCreator(address indexed contractAddress, uint256 indexed tokenId, address indexed assetToken, address creator, uint256 receiverAmount);
event WalletReleased(address indexed contractAddress, uint256 indexed tokenId, address indexed receiver, address assetToken, uint256 principalAmount, uint256 creatorAmount, uint256 receiverAmount);
event WalletRewarded(address indexed contractAddress, uint256 indexed tokenId, address indexed receiver, address rewardsToken, uint256 rewardsAmount);
function isPaused() external view returns (bool);
function isReserveActive(address contractAddress, uint256 tokenId, address assetToken) external view returns (bool);
function getReserveInterestToken(address contractAddress, uint256 tokenId, address assetToken) external view returns (address);
function getTotal(address contractAddress, uint256 tokenId, address assetToken) external returns (uint256);
function getPrincipal(address contractAddress, uint256 tokenId, address assetToken) external returns (uint256);
function getInterest(address contractAddress, uint256 tokenId, address assetToken) external returns (uint256 creatorInterest, uint256 ownerInterest);
function getRewards(address contractAddress, uint256 tokenId, address rewardToken) external returns (uint256);
function energize(address contractAddress, uint256 tokenId, address assetToken, uint256 assetAmount) external returns (uint256 yieldTokensAmount);
function discharge(address receiver, address contractAddress, uint256 tokenId, address assetToken, address creatorRedirect) external returns (uint256 creatorAmount, uint256 receiverAmount);
function dischargeAmount(address receiver, address contractAddress, uint256 tokenId, address assetToken, uint256 assetAmount, address creatorRedirect) external returns (uint256 creatorAmount, uint256 receiverAmount);
function dischargeAmountForCreator(address receiver, address contractAddress, uint256 tokenId, address creator, address assetToken, uint256 assetAmount) external returns (uint256 receiverAmount);
function release(address receiver, address contractAddress, uint256 tokenId, address assetToken, address creatorRedirect) external returns (uint256 principalAmount, uint256 creatorAmount, uint256 receiverAmount);
function releaseAmount(address receiver, address contractAddress, uint256 tokenId, address assetToken, uint256 assetAmount, address creatorRedirect) external returns (uint256 principalAmount, uint256 creatorAmount, uint256 receiverAmount);
function withdrawRewards(address receiver, address contractAddress, uint256 tokenId, address rewardsToken, uint256 rewardsAmount) external returns (uint256 amount);
function executeForAccount(address contractAddress, uint256 tokenId, address externalAddress, uint256 ethValue, bytes memory encodedParams) external returns (bytes memory);
function getWalletAddressById(address contractAddress, uint256 tokenId, address creator, uint256 annuityPct) external returns (address);
function withdrawEther(address contractAddress, uint256 tokenId, address payable receiver, uint256 amount) external;
function withdrawERC20(address contractAddress, uint256 tokenId, address payable receiver, address tokenAddress, uint256 amount) external;
function withdrawERC721(address contractAddress, uint256 tokenId, address payable receiver, address nftTokenAddress, uint256 nftTokenId) external;
}
文件 24 的 30:Ownable.sol
pragma solidity ^0.6.0;
import "../GSN/Context.sol";
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
文件 25 的 30:Proton.sol
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "../lib/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../interfaces/IProton.sol";
import "../interfaces/IUniverse.sol";
import "../interfaces/IChargedState.sol";
import "../interfaces/IChargedSettings.sol";
import "../interfaces/IChargedParticles.sol";
import "../lib/BlackholePrevention.sol";
import "../lib/RelayRecipient.sol";
contract Proton is IProton, ERC721, Ownable, RelayRecipient, ReentrancyGuard, BlackholePrevention {
using SafeMath for uint256;
using Address for address payable;
using Counters for Counters.Counter;
uint256 constant internal PERCENTAGE_SCALE = 1e4;
uint256 constant internal MAX_ROYALTIES = 8e3;
IUniverse internal _universe;
IChargedState internal _chargedState;
IChargedSettings internal _chargedSettings;
IChargedParticles internal _chargedParticles;
Counters.Counter internal _tokenIds;
mapping (uint256 => address) internal _tokenCreator;
mapping (uint256 => uint256) internal _tokenCreatorRoyaltiesPct;
mapping (uint256 => address) internal _tokenCreatorRoyaltiesRedirect;
mapping (address => uint256) internal _tokenCreatorClaimableRoyalties;
mapping (uint256 => uint256) internal _tokenSalePrice;
mapping (uint256 => uint256) internal _tokenLastSellPrice;
bool internal _paused;
constructor() public ERC721("Charged Particles - Proton", "PROTON") {}
function creatorOf(uint256 tokenId) external view virtual override returns (address) {
return _tokenCreator[tokenId];
}
function getSalePrice(uint256 tokenId) external view virtual override returns (uint256) {
return _tokenSalePrice[tokenId];
}
function getLastSellPrice(uint256 tokenId) external view virtual override returns (uint256) {
return _tokenLastSellPrice[tokenId];
}
function getCreatorRoyalties(address account) external view virtual override returns (uint256) {
return _tokenCreatorClaimableRoyalties[account];
}
function getCreatorRoyaltiesPct(uint256 tokenId) external view virtual override returns (uint256) {
return _tokenCreatorRoyaltiesPct[tokenId];
}
function getCreatorRoyaltiesReceiver(uint256 tokenId) external view virtual override returns (address) {
return _creatorRoyaltiesReceiver(tokenId);
}
function claimCreatorRoyalties()
external
virtual
override
nonReentrant
whenNotPaused
returns (uint256)
{
return _claimCreatorRoyalties(_msgSender());
}
function createChargedParticle(
address creator,
address receiver,
address referrer,
string memory tokenMetaUri,
string memory walletManagerId,
address assetToken,
uint256 assetAmount,
uint256 annuityPercent
)
external
virtual
override
nonReentrant
whenNotPaused
returns (uint256 newTokenId)
{
newTokenId = _createChargedParticle(
creator,
receiver,
referrer,
tokenMetaUri,
walletManagerId,
assetToken,
assetAmount,
annuityPercent
);
}
function createBasicProton(
address creator,
address receiver,
string memory tokenMetaUri
)
external
virtual
override
whenNotPaused
returns (uint256 newTokenId)
{
newTokenId = _createProton(
creator,
receiver,
tokenMetaUri,
0,
0,
0
);
}
function createProton(
address creator,
address receiver,
string memory tokenMetaUri,
uint256 annuityPercent
)
external
virtual
override
whenNotPaused
returns (uint256 newTokenId)
{
newTokenId = _createProton(
creator,
receiver,
tokenMetaUri,
annuityPercent,
0,
0
);
}
function createProtonForSale(
address creator,
address receiver,
string memory tokenMetaUri,
uint256 annuityPercent,
uint256 royaltiesPercent,
uint256 salePrice
)
external
virtual
override
whenNotPaused
returns (uint256 newTokenId)
{
newTokenId = _createProton(
creator,
receiver,
tokenMetaUri,
annuityPercent,
royaltiesPercent,
salePrice
);
}
function batchProtonsForSale(
address creator,
uint256 annuityPercent,
uint256 royaltiesPercent,
string[] calldata tokenMetaUris,
uint256[] calldata salePrices
)
external
virtual
override
whenNotPaused
{
_batchProtonsForSale(
creator,
annuityPercent,
royaltiesPercent,
tokenMetaUris,
salePrices
);
}
function buyProton(uint256 tokenId)
external
payable
virtual
override
nonReentrant
whenNotPaused
returns (bool)
{
return _buyProton(tokenId);
}
function setSalePrice(uint256 tokenId, uint256 salePrice)
external
virtual
override
whenNotPaused
onlyTokenOwnerOrApproved(tokenId)
{
_setSalePrice(tokenId, salePrice);
}
function setRoyaltiesPct(uint256 tokenId, uint256 royaltiesPct)
external
virtual
override
whenNotPaused
onlyTokenCreator(tokenId)
onlyTokenOwnerOrApproved(tokenId)
{
_setRoyaltiesPct(tokenId, royaltiesPct);
}
function setCreatorRoyaltiesReceiver(uint256 tokenId, address receiver)
external
virtual
override
whenNotPaused
onlyTokenCreator(tokenId)
{
_tokenCreatorRoyaltiesRedirect[tokenId] = receiver;
}
function setPausedState(bool state) external virtual onlyOwner {
_paused = state;
emit PausedStateSet(state);
}
function setUniverse(address universe) external virtual onlyOwner {
_universe = IUniverse(universe);
emit UniverseSet(universe);
}
function setChargedParticles(address chargedParticles) external virtual onlyOwner {
_chargedParticles = IChargedParticles(chargedParticles);
emit ChargedParticlesSet(chargedParticles);
}
function setChargedState(address stateController) external virtual onlyOwner {
_chargedState = IChargedState(stateController);
emit ChargedStateSet(stateController);
}
function setChargedSettings(address settings) external virtual onlyOwner {
_chargedSettings = IChargedSettings(settings);
emit ChargedSettingsSet(settings);
}
function setTrustedForwarder(address _trustedForwarder) external virtual onlyOwner {
trustedForwarder = _trustedForwarder;
}
function withdrawEther(address payable receiver, uint256 amount) external onlyOwner {
_withdrawEther(receiver, amount);
}
function withdrawErc20(address payable receiver, address tokenAddress, uint256 amount) external onlyOwner {
_withdrawERC20(receiver, tokenAddress, amount);
}
function withdrawERC721(address payable receiver, address tokenAddress, uint256 tokenId) external onlyOwner {
_withdrawERC721(receiver, tokenAddress, tokenId);
}
function _setSalePrice(uint256 tokenId, uint256 salePrice) internal virtual {
_chargedState.setTemporaryLock(address(this), tokenId, (salePrice > 0));
_tokenSalePrice[tokenId] = salePrice;
emit SalePriceSet(tokenId, salePrice);
}
function _setRoyaltiesPct(uint256 tokenId, uint256 royaltiesPct) internal virtual {
require(royaltiesPct <= MAX_ROYALTIES, "PRT:E-421");
_tokenCreatorRoyaltiesPct[tokenId] = royaltiesPct;
emit CreatorRoyaltiesSet(tokenId, royaltiesPct);
}
function _creatorRoyaltiesReceiver(uint256 tokenId) internal view virtual returns (address) {
address receiver = _tokenCreatorRoyaltiesRedirect[tokenId];
if (receiver == address(0x0)) {
receiver = _tokenCreator[tokenId];
}
return receiver;
}
function _createChargedParticle(
address creator,
address receiver,
address referrer,
string memory tokenMetaUri,
string memory walletManagerId,
address assetToken,
uint256 assetAmount,
uint256 annuityPercent
)
internal
virtual
returns (uint256 newTokenId)
{
require(address(_chargedParticles) != address(0x0), "PRT:E-107");
newTokenId = _createProton(creator, receiver, tokenMetaUri, annuityPercent, 0, 0);
_chargeParticle(newTokenId, walletManagerId, assetToken, assetAmount, referrer);
}
function _createProton(
address creator,
address receiver,
string memory tokenMetaUri,
uint256 annuityPercent,
uint256 royaltiesPercent,
uint256 salePrice
)
internal
virtual
returns (uint256 newTokenId)
{
_tokenIds.increment();
newTokenId = _tokenIds.current();
_safeMint(receiver, newTokenId, "");
_tokenCreator[newTokenId] = creator;
_setTokenURI(newTokenId, tokenMetaUri);
if (royaltiesPercent > 0) {
_setRoyaltiesPct(newTokenId, royaltiesPercent);
}
if (salePrice > 0) {
_setSalePrice(newTokenId, salePrice);
}
if (annuityPercent > 0) {
_chargedSettings.setCreatorAnnuities(
address(this),
newTokenId,
creator,
annuityPercent
);
}
}
function _batchProtonsForSale(
address creator,
uint256 annuityPercent,
uint256 royaltiesPercent,
string[] calldata tokenMetaUris,
uint256[] calldata salePrices
)
internal
virtual
{
require(tokenMetaUris.length == salePrices.length, "PRT:E-202");
address self = address(this);
uint256 count = tokenMetaUris.length;
for (uint256 i = 0; i < count; i++) {
_tokenIds.increment();
uint256 newTokenId = _tokenIds.current();
_safeMint(creator, newTokenId, "");
_tokenCreator[newTokenId] = creator;
_setTokenURI(newTokenId, tokenMetaUris[i]);
if (royaltiesPercent > 0) {
_setRoyaltiesPct(newTokenId, royaltiesPercent);
}
uint256 salePrice = salePrices[i];
if (salePrice > 0) {
_setSalePrice(newTokenId, salePrice);
}
if (annuityPercent > 0) {
_chargedSettings.setCreatorAnnuities(
self,
newTokenId,
creator,
annuityPercent
);
}
}
}
function _chargeParticle(
uint256 tokenId,
string memory walletManagerId,
address assetToken,
uint256 assetAmount,
address referrer
)
internal
virtual
{
_collectAssetToken(_msgSender(), assetToken, assetAmount);
IERC20(assetToken).approve(address(_chargedParticles), assetAmount);
_chargedParticles.energizeParticle(
address(this),
tokenId,
walletManagerId,
assetToken,
assetAmount,
referrer
);
}
function _buyProton(uint256 tokenId)
internal
virtual
returns (bool)
{
uint256 salePrice = _tokenSalePrice[tokenId];
require(salePrice > 0, "PRT:E-416");
require(msg.value >= salePrice, "PRT:E-414");
uint256 ownerAmount = salePrice;
uint256 creatorAmount;
address oldOwner = ownerOf(tokenId);
address newOwner = _msgSender();
address royaltiesReceiver = _creatorRoyaltiesReceiver(tokenId);
uint256 royaltiesPct = _tokenCreatorRoyaltiesPct[tokenId];
uint256 lastSellPrice = _tokenLastSellPrice[tokenId];
if (royaltiesPct > 0 && lastSellPrice > 0 && salePrice > lastSellPrice) {
creatorAmount = (salePrice - lastSellPrice).mul(royaltiesPct).div(PERCENTAGE_SCALE);
ownerAmount = ownerAmount.sub(creatorAmount);
}
_tokenLastSellPrice[tokenId] = salePrice;
if (address(_universe) != address(0)) {
_universe.onProtonSale(address(this), tokenId, oldOwner, newOwner, salePrice, royaltiesReceiver, creatorAmount);
}
_chargedState.setTemporaryLock(address(this), tokenId, false);
if (creatorAmount > 0) {
_tokenCreatorClaimableRoyalties[royaltiesReceiver] = _tokenCreatorClaimableRoyalties[royaltiesReceiver].add(creatorAmount);
}
_transfer(oldOwner, newOwner, tokenId);
payable(oldOwner).sendValue(ownerAmount);
emit ProtonSold(tokenId, oldOwner, newOwner, salePrice, royaltiesReceiver, creatorAmount);
_refundOverpayment(salePrice);
return true;
}
function _claimCreatorRoyalties(address receiver) internal virtual returns (uint256) {
uint256 claimableAmount = _tokenCreatorClaimableRoyalties[receiver];
require(claimableAmount > 0, "PRT:E-411");
delete _tokenCreatorClaimableRoyalties[receiver];
payable(receiver).sendValue(claimableAmount);
emit RoyaltiesClaimed(receiver, claimableAmount);
}
function _collectAssetToken(address from, address assetToken, uint256 assetAmount) internal virtual {
uint256 _userAssetBalance = IERC20(assetToken).balanceOf(from);
require(assetAmount <= _userAssetBalance, "PRT:E-411");
require(IERC20(assetToken).transferFrom(from, address(this), assetAmount), "PRT:E-401");
}
function _refundOverpayment(uint256 threshold) internal virtual {
uint256 overage = msg.value.sub(threshold);
if (overage > 0) {
payable(_msgSender()).sendValue(overage);
}
}
function _transfer(address from, address to, uint256 tokenId) internal virtual override {
_tokenSalePrice[tokenId] = 0;
_chargedState.setTemporaryLock(address(this), tokenId, false);
super._transfer(from, to, tokenId);
}
function _msgSender()
internal
view
virtual
override(BaseRelayRecipient, Context)
returns (address payable)
{
return BaseRelayRecipient._msgSender();
}
function _msgData()
internal
view
virtual
override(BaseRelayRecipient, Context)
returns (bytes memory)
{
return BaseRelayRecipient._msgData();
}
modifier whenNotPaused() {
require(!_paused, "PRT:E-101");
_;
}
modifier onlyTokenOwnerOrApproved(uint256 tokenId) {
require(_isApprovedOrOwner(_msgSender(), tokenId), "PRT:E-105");
_;
}
modifier onlyTokenCreator(uint256 tokenId) {
require(_tokenCreator[tokenId] == _msgSender(), "PRT:E-104");
_;
}
}
文件 26 的 30:ReentrancyGuard.sol
pragma solidity ^0.6.0;
contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () internal {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
文件 27 的 30:RelayRecipient.sol
pragma solidity >=0.6.0;
import "@opengsn/gsn/contracts/BaseRelayRecipient.sol";
contract RelayRecipient is BaseRelayRecipient {
function versionRecipient() external override view returns (string memory) {
return "1.0.0-beta.1/charged-particles.relay.recipient";
}
}
文件 28 的 30:SafeERC20.sol
pragma solidity ^0.6.0;
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
library SafeERC20 {
using SafeMath for uint256;
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).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
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");
}
}
}
文件 29 的 30:SafeMath.sol
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
文件 30 的 30:Strings.sol
pragma solidity ^0.6.0;
library Strings {
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
uint256 index = digits - 1;
temp = value;
while (temp != 0) {
buffer[index--] = byte(uint8(48 + temp % 10));
temp /= 10;
}
return string(buffer);
}
}
{
"compilationTarget": {
"contracts/tokens/Proton.sol": "Proton"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"chargedParticles","type":"address"}],"name":"ChargedParticlesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"chargedSettings","type":"address"}],"name":"ChargedSettingsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"chargedState","type":"address"}],"name":"ChargedStateSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"royaltiesPct","type":"uint256"}],"name":"CreatorRoyaltiesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"PausedStateSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"},{"indexed":false,"internalType":"uint256","name":"salePrice","type":"uint256"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"uint256","name":"creatorRoyalties","type":"uint256"}],"name":"ProtonSold","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountClaimed","type":"uint256"}],"name":"RoyaltiesClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"SalePriceSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"universe","type":"address"}],"name":"UniverseSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawStuckERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"WithdrawStuckERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawStuckEther","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint256","name":"annuityPercent","type":"uint256"},{"internalType":"uint256","name":"royaltiesPercent","type":"uint256"},{"internalType":"string[]","name":"tokenMetaUris","type":"string[]"},{"internalType":"uint256[]","name":"salePrices","type":"uint256[]"}],"name":"batchProtonsForSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"buyProton","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"claimCreatorRoyalties","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"string","name":"tokenMetaUri","type":"string"}],"name":"createBasicProton","outputs":[{"internalType":"uint256","name":"newTokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"referrer","type":"address"},{"internalType":"string","name":"tokenMetaUri","type":"string"},{"internalType":"string","name":"walletManagerId","type":"string"},{"internalType":"address","name":"assetToken","type":"address"},{"internalType":"uint256","name":"assetAmount","type":"uint256"},{"internalType":"uint256","name":"annuityPercent","type":"uint256"}],"name":"createChargedParticle","outputs":[{"internalType":"uint256","name":"newTokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"string","name":"tokenMetaUri","type":"string"},{"internalType":"uint256","name":"annuityPercent","type":"uint256"}],"name":"createProton","outputs":[{"internalType":"uint256","name":"newTokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"string","name":"tokenMetaUri","type":"string"},{"internalType":"uint256","name":"annuityPercent","type":"uint256"},{"internalType":"uint256","name":"royaltiesPercent","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"createProtonForSale","outputs":[{"internalType":"uint256","name":"newTokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"creatorOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getCreatorRoyalties","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCreatorRoyaltiesPct","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCreatorRoyaltiesReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getLastSellPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getSalePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"chargedParticles","type":"address"}],"name":"setChargedParticles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"settings","type":"address"}],"name":"setChargedSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stateController","type":"address"}],"name":"setChargedState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"setCreatorRoyaltiesReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"state","type":"bool"}],"name":"setPausedState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"royaltiesPct","type":"uint256"}],"name":"setRoyaltiesPct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"setSalePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_trustedForwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"universe","type":"address"}],"name":"setUniverse","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":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"versionRecipient","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawErc20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawEther","outputs":[],"stateMutability":"nonpayable","type":"function"}]