FactoryErc1155
0x9ea88e599aa5b07dd9a1c7600598e6ea4a96f987
Verification
Verified
v0.8.35+commit.47b9dedd
Type
Contract
2,910 bytes
ABI entries
14
3 read · 4 write
License
none
Contract information
- Address
- 0x9ea88e599aa5b07dd9a1c7600598e6ea4a96f987
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.35+commit.47b9dedd
- Optimization
- Enabled
- Creator
- 0x069A26D244…7Bde044CA0
- Creation tx
- 0xcec597378d…d3724a1d3a
Token
Not a token
This contract does not expose ERC-20 metadata.
Read contract (3)
archetype() → address
deployFee() → uint256
owner() → address
Events (3)
CollectionAddedDeployFeeChangedOwnershipTransferred
ABI
[
{
"inputs": [
{
"internalType": "address",
"name": "archetype_",
"type": "address"
},
{
"internalType": "address",
"name": "owner_",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "InsufficientDeployFee",
"type": "error"
},
{
"inputs": [],
"name": "InvalidOwner",
"type": "error"
},
{
"inputs": [],
"name": "TransferFailed",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "receiver",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "collection",
"type": "address"
}
],
"name": "CollectionAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "oldFee",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "newFee",
"type": "uint256"
}
],
"name": "DeployFeeChanged",
"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"
},
{
"inputs": [],
"name": "archetype",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_receiver",
"type": "address"
},
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "string",
"name": "symbol",
"type": "string"
},
{
"components": [
{
"internalType": "string",
"name": "baseUri",
"type": "string"
},
{
"internalType": "address",
"name": "affiliateSigner",
"type": "address"
},
{
"internalType": "uint32[]",
"name": "maxSupply",
"type": "uint32[]"
},
{
"internalType": "uint16",
"name": "maxBatchSize",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "affiliateFee",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "affiliateDiscount",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "defaultRoyalty",
"type": "uint16"
}
],
"internalType": "struct Config",
"name": "config",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint16",
"name": "ownerBps",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "platformBps",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "partnerBps",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "superAffiliateBps",
"type": "uint16"
},
{
"internalType": "address",
"name": "partner",
"type": "address"
},
{
"internalType": "address",
"name": "superAffiliate",
"type": "address"
},
{
"internalType": "address",
"name": "ownerAltPayout",
"type": "address"
}
],
"internalType": "struct PayoutConfig",
"name": "payoutConfig",
"type": "tuple"
}
],
"name": "createCollection",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "deployFee",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "newFee",
"type": "uint256"
}
],
"name": "setDeployFee",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]Source code
// SPDX-License-Identifier: BUSL-1.1
// Factory v0.9.1
//
// 8888888888 888
// 888 888
// 888 888
// 8888888 8888b. .d8888b 888888 .d88b. 888d888 888 888
// 888 "88b d88P" 888 d88""88b 888P" 888 888
// 888 .d888888 888 888 888 888 888 888 888
// 888 888 888 Y88b. Y88b. Y88..88P 888 Y88b 888
// 888 "Y888888 "Y8888P "Y888 "Y88P" 888 "Y88888
// 888
// Y8b d88P
// "Y88P"
pragma solidity ^0.8.20;
import "./ArchetypeErc1155.sol";
import "./ArchetypeLogicErc1155.sol";
import "openzeppelin-v4/proxy/Clones.sol";
import "openzeppelin-v4/access/Ownable.sol";
error InsufficientDeployFee();
error InvalidOwner();
contract FactoryErc1155 is Ownable {
event CollectionAdded(address indexed sender, address indexed receiver, address collection);
event DeployFeeChanged(uint256 oldFee, uint256 newFee);
address public archetype;
uint256 public deployFee;
constructor(address archetype_, address owner_) {
if (owner_ == address(0)) revert InvalidOwner();
archetype = archetype_;
_transferOwnership(owner_);
}
function createCollection(
address _receiver,
string memory name,
string memory symbol,
Config calldata config,
PayoutConfig calldata payoutConfig
) external payable returns (address) {
if (msg.value < deployFee) {
revert InsufficientDeployFee();
}
bytes32 salt = keccak256(abi.encodePacked(block.timestamp, msg.sender, block.chainid));
address clone = Clones.cloneDeterministic(archetype, salt);
ArchetypeErc1155 token = ArchetypeErc1155(clone);
token.initialize(name, symbol, config, payoutConfig, _receiver);
token.transferOwnership(_receiver);
if (deployFee > 0) {
ArchetypeAddresses memory addrs = ArchetypeErc1155(archetype).archetypeAddresses();
address[] memory recipients = new address[](1);
recipients[0] = addrs.platform;
uint16[] memory splits = new uint16[](1);
splits[0] = 10000;
ArchetypePayouts(addrs.payouts).updateBalances{value: deployFee}(
deployFee,
address(0), // native token
recipients,
splits
);
// Forward any excess payment to the receiver
uint256 excess = msg.value - deployFee;
if (excess > 0) {
_refund(_receiver, excess);
}
} else if (msg.value > 0) {
_refund(_receiver, msg.value);
}
emit CollectionAdded(_msgSender(), _receiver, clone);
return clone;
}
function setDeployFee(uint256 newFee) public onlyOwner {
uint256 oldFee = deployFee;
deployFee = newFee;
emit DeployFeeChanged(oldFee, newFee);
}
function _refund(address to, uint256 refund) internal {
(bool success,) = payable(to).call{value: refund}("");
if (!success) {
revert TransferFailed();
}
}
}
Chain explorer964msChain node78ms