Address Contract Verified
Address
0x83B0DE2C73805CDd267ce96d2eba6852e063D9Bf
Balance
0 ETH
Nonce
862
Code Size
2719 bytes
Creator
0x47285056...534f at tx 0x4e3aa33c...1ab832
Indexed Transactions
0
Contract Bytecode
2719 bytes
0x6080604052600436106100b55760003560e01c8063da20ec6a11610069578063ec253dbc1161004e578063ec253dbc146101ad578063f4b61222146101cd578063f9f6b49b146101e057600080fd5b8063da20ec6a14610177578063e06118b71461018d57600080fd5b8063466634291161009a57806346663429146100ff5780636f058fd21461011f578063a6d23e101461015757600080fd5b80631b7ab660146100c15780633fafa127146100d657600080fd5b366100bc57005b600080fd5b6100d46100cf366004610764565b610210565b005b3480156100e257600080fd5b506100ec60035481565b6040519081526020015b60405180910390f35b34801561010b57600080fd5b506100d461011a366004610865565b61031f565b34801561012b57600080fd5b5061013f61013a366004610901565b6103ac565b6040516001600160a01b0390911681526020016100f6565b34801561016357600080fd5b5060005461013f906001600160a01b031681565b34801561018357600080fd5b506100ec60015481565b34801561019957600080fd5b5060025461013f906001600160a01b031681565b3480156101b957600080fd5b5061013f6101c836600461091e565b61043d565b6100d46101db366004610937565b610488565b3480156101ec57600080fd5b506102006101fb366004610901565b610515565b60405190151581526020016100f6565b600061023387878760405161022692919061096f565b604051809103902061059f565b905061024387338387878761031f565b600061028760008989898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105b392505050565b9050816001600160a01b0316816001600160a01b031614610309576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f436f6e74726163742061646472657373206d69736d617463680000000000000060448201526064015b60405180910390fd5b61031588826001610488565b5050505050505050565b6002546040517f466634290000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634666342990610372908990899089908990899089906004016109c5565b600060405180830381600087803b15801561038c57600080fd5b505af11580156103a0573d6000803e3d6000fd5b50505050505050505050565b6002546040517f6f058fd20000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526000921690636f058fd2906024015b6020604051808303816000875af1158015610413573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104379190610a2a565b92915050565b6002546040517fec253dbc000000000000000000000000000000000000000000000000000000008152600481018390526000916001600160a01b03169063ec253dbc906024016103f4565b6000546001546040517f8690b8c9000000000000000000000000000000000000000000000000000000008152600481018690526001600160a01b038581166024830152604482019290925260648101849052911690638690b8c99034906084016000604051808303818588803b15801561050157600080fd5b505af1158015610315573d6000803e3d6000fd5b6002546040517ff9f6b49b0000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152600092169063f9f6b49b906024016020604051808303816000875af115801561057b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104379190610a47565b60006105ac83833061067e565b9392505050565b6000834710156105f8576040517fe4bbecac00000000000000000000000000000000000000000000000000000000815247600482015260248101859052604401610300565b8151600003610633576040517f4ca249dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8282516020840186f590506001600160a01b0381166105ac576040517f741752c200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f8301126106e857600080fd5b813567ffffffffffffffff80821115610703576107036106a8565b604051601f8301601f19908116603f0116810190828211818310171561072b5761072b6106a8565b8160405283815286602085880101111561074457600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060a0878903121561077d57600080fd5b86359550602087013567ffffffffffffffff8082111561079c57600080fd5b818901915089601f8301126107b057600080fd5b8135818111156107bf57600080fd5b8a60208285010111156107d157600080fd5b6020830197508096505060408901359150808211156107ef57600080fd5b6107fb8a838b016106d7565b9450606089013591508082111561081157600080fd5b61081d8a838b016106d7565b9350608089013591508082111561083357600080fd5b5061084089828a016106d7565b9150509295509295509295565b6001600160a01b038116811461086257600080fd5b50565b60008060008060008060c0878903121561087e57600080fd5b8635955060208701356108908161084d565b945060408701356108a08161084d565b9350606087013567ffffffffffffffff808211156108bd57600080fd5b6108c98a838b016106d7565b945060808901359150808211156108df57600080fd5b6108eb8a838b016106d7565b935060a089013591508082111561083357600080fd5b60006020828403121561091357600080fd5b81356105ac8161084d565b60006020828403121561093057600080fd5b5035919050565b60008060006060848603121561094c57600080fd5b83359250602084013561095e8161084d565b929592945050506040919091013590565b8183823760009101908152919050565b6000815180845260005b818110156109a557602081850181015186830182015201610989565b506000602082860101526020601f19601f83011685010191505092915050565b86815260006001600160a01b03808816602084015280871660408401525060c060608301526109f760c083018661097f565b8281036080840152610a09818661097f565b905082810360a0840152610a1d818561097f565b9998505050505050505050565b600060208284031215610a3c57600080fd5b81516105ac8161084d565b600060208284031215610a5957600080fd5b815180151581146105ac57600080fdfea264697066735822122060d95f7dd6d61f07e08acba9d0963e608ff87324b2fd017cb3308a5c56bde0ea64736f6c63430008180033
Verified Source Code Full Match
Compiler: v0.8.24+commit.e11b9ed9
EVM: paris
Optimization: Yes (1000 runs)
Payable.sol 34 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
/// @title Payable
/// @author Smithii
import {IPayments} from "../interfaces/marketplace/IPayments.sol";
abstract contract Payable {
address public payments = address(0);
bytes32 public serviceId;
constructor(address _payments, string memory _serviceId) {
payments = _payments;
serviceId = keccak256(abi.encodePacked(_serviceId));
}
///
/// @param _projectId the project id
/// @param _token the token address
/// @param qty the qty of items to pay
function payService(
bytes32 _projectId,
address _token,
uint256 qty
) public payable {
IPayments(payments).payService{value: msg.value}(
_projectId,
_token,
serviceId,
qty
);
}
receive() external payable {}
}
Indexable.sol 61 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
/// @title Indexable
/// @author Smithii
import {IIndexer} from "../interfaces/marketplace/IIndexer.sol";
abstract contract Indexable {
address public indexer = address(0);
bytes32 public projectId;
/// errors
error NotPtojectOwner();
constructor(address _indexer) {
indexer = _indexer;
}
modifier onlyProjectOwner(address _address) {
if (getProjectAddressOwner(_address) != msg.sender)
revert NotPtojectOwner();
_;
}
/// Registers the project in the Indexer
/// @param _projectId the project id
/// @param _owner the owner of the project
/// @param _contract the contract address
/// @param _contractType the contract type eg. ERC20, ERC721
function registerProject(
bytes32 _projectId,
address _owner,
address _contract,
string memory _contractType,
string memory _name,
string memory _symbol
) public {
IIndexer(indexer).registerProject(
_projectId,
_owner,
_contract,
_contractType,
_name,
_symbol
);
}
///
/// @param _projectAddress the project address
function isContractRegistered(
address _projectAddress
) public returns (bool) {
return IIndexer(indexer).isContractRegistered(_projectAddress);
}
///
/// @param _projectId the project id
function getProjectOwner(bytes32 _projectId) public returns (address) {
return IIndexer(indexer).getProjectOwner(_projectId);
}
function getProjectAddressOwner(
address _projectAddress
) public returns (address) {
return IIndexer(indexer).getProjectAddressOwner(_projectAddress);
}
}
ERC20TokenFactory.sol 73 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
/*
&&&&&& &&&&& &%
&&&&&&&&&&&&&&& && &&&&&&&&&&%
&&&&&&& &&&&& #&&&&&&&&&&&&&
&&&&& &&&&&&& && &&&& &% &&&&&&&
&&. &&&&&&&&&& & %&&&&&&& &&&&
&&&& *&&&&&&&&& &&&&&&&&& &&&&
.&&& &&&&&&&& &&&&&&&& &&&
.&&&&&&& &&&&&&& &&&%
&&&&&& &&&&&&
&&&&& /&&&&.
&&&& %&&& #&&&,
&&&&( &&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&
&&&% &&&&&&&&&&&&&&&&&&&&&&&&& &&&
&&& &&&* &&&&&&&&&&&&&&&&&&&&& &&*
&&& .&&&&&& &&&&&&&&&&&&&&&&&&&& &&&&& &&
&&& #&&&&&& &&&&&&&&&&&&&&&&&&&&& &&&&& &&
&&& &&&& &&&&&&&&&&&&&&&&&&&&&& #&& &&&
&&& &&&&&&&&&&&&&&&&&&&&&&&&, *&&&
(&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&%
&&&&&&&&&&&&&&&&& &&&&&
&&&&&&&&&&&&&&&&&& %&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#
&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&
*/
/*
* Factory contract
* This contract is used to deploy smart contracts and register them in the Indexer contract
*/
/// @title ERC20TokenFactory
/// @author Smithii
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
import {Indexable} from "./utils/Indexable.sol";
import {Payable} from "./utils/Payable.sol";
contract ERC20TokenFactory is Payable, Indexable {
constructor(
address _indexer,
address _payments,
string memory _serviceId
) Payable(_payments, _serviceId) Indexable(_indexer) {}
/// Deploys a contract and pays the service creating fee
/// @param _projectId bytes32 projectId
/// @param _byteCode the contract bytecode
/// @param _type the contract type
function deployContract(
bytes32 _projectId,
bytes calldata _byteCode,
string memory _type,
string memory _name,
string memory _symbol
) external payable {
address resultedAddress = Create2.computeAddress(
_projectId,
keccak256(_byteCode)
);
registerProject(_projectId, msg.sender, resultedAddress, _type, _name, _symbol);
address _contract = Create2.deploy(0, _projectId, _byteCode);
require(_contract == resultedAddress, "Contract address mismatch");
/// @notice Pay the total of 1 token creation fee
payService(_projectId, _contract, 1);
}
}
Create2.sol 96 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Create2.sol)
pragma solidity ^0.8.20;
/**
* @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
* `CREATE2` can be used to compute in advance the address where a smart
* contract will be deployed, which allows for interesting new mechanisms known
* as 'counterfactual interactions'.
*
* See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
* information.
*/
library Create2 {
/**
* @dev Not enough balance for performing a CREATE2 deploy.
*/
error Create2InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev There's no code to deploy.
*/
error Create2EmptyBytecode();
/**
* @dev The deployment failed.
*/
error Create2FailedDeployment();
/**
* @dev Deploys a contract using `CREATE2`. The address where the contract
* will be deployed can be known in advance via {computeAddress}.
*
* The bytecode for a contract can be obtained from Solidity with
* `type(contractName).creationCode`.
*
* Requirements:
*
* - `bytecode` must not be empty.
* - `salt` must have not been used for `bytecode` already.
* - the factory must have a balance of at least `amount`.
* - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
*/
function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {
if (address(this).balance < amount) {
revert Create2InsufficientBalance(address(this).balance, amount);
}
if (bytecode.length == 0) {
revert Create2EmptyBytecode();
}
/// @solidity memory-safe-assembly
assembly {
addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)
}
if (addr == address(0)) {
revert Create2FailedDeployment();
}
}
/**
* @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
* `bytecodeHash` or `salt` will result in a new destination address.
*/
function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {
return computeAddress(salt, bytecodeHash, address(this));
}
/**
* @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
* `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
*/
function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40) // Get free memory pointer
// | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |
// |-------------------|---------------------------------------------------------------------------|
// | bytecodeHash | CCCCCCCCCCCCC...CC |
// | salt | BBBBBBBBBBBBB...BB |
// | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |
// | 0xFF | FF |
// |-------------------|---------------------------------------------------------------------------|
// | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |
// | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |
mstore(add(ptr, 0x40), bytecodeHash)
mstore(add(ptr, 0x20), salt)
mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes
let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff
mstore8(start, 0xff)
addr := keccak256(start, 85)
}
}
}
IIndexer.sol 77 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
/*
* IIndexer Inteface
*/
/// @title IIndexer
/// @author Smithii
interface IIndexer {
/// Structs
struct Contract {
address contractAddress;
string contracType;
string name;
string symbol;
}
struct Project {
address owner;
Contract[] contracts;
}
/// Errors
error ProjectContractAlreadyRegistered();
error ProjectIndexAlreadyRegistered();
/// Events
event ProjectRegistered(
bytes32 projectId,
address owner,
address contractAddress,
string contractType
);
/// Register a project in the Indexer
/// @param _projectId bytes32 projectId
/// @param _owner the owner of the project
/// @param _contract the contract address
function registerProject(
bytes32 _projectId,
address _owner,
address _contract,
string memory _contractType,
string memory _name,
string memory _symbol
) external;
/// Check if the ProjectIndex is registered
/// @param _projectId bytes32 projectId
/// @return bool if the proyect is aleady registered
function isProjectIndexRegistered(
bytes32 _projectId
) external returns (bool);
/// Check if a contract is registered in the project
/// @param _contract the contract address
/// @return bool if the proyect is aleady registered`
function isContractRegistered(address _contract) external returns (bool);
/// @param _projectId the project Index
function getProjectOwner(bytes32 _projectId) external returns (address);
///
/// @param _projectAddress address of the project
function getProjectAddressOwner(
address _projectAddress
) external returns (address);
///
/// @param _projectAddress address of the project
/// @return address the owner of the project
/// @return address[] the contracts of the project
function getProjectInfoByProjectAddress(
address _projectAddress
) external returns (address, Contract[] memory);
///
/// @param _projectId bytes32 projectId
/// @return address the owner of the project
/// @return address[] the contracts of the project
function getProjectInfoByIndex(
bytes32 _projectId
) external returns (address, Contract[] memory);
}
IPayments.sol 85 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
/*
* IPayments interface
*/
/// @title Payments
/// @author Smithii
interface IPayments {
struct Service {
bytes32 serviceId;
uint256 pricePerItem;
bool active;
}
struct Invoice {
address user;
Service service;
uint256 qty;
uint256 total;
uint256 timestamp;
}
/// Events
event ServiceAdded(bytes32 serviceId, string name, uint256 price);
event ServiceSet(bytes32 serviceId, bool active);
event ServicePaid(
bytes32 projectId,
address contractAddress,
bytes32 serviceId,
address user,
uint256 amount,
uint256 timestamp
);
event ServiceWithdraw(
bytes32 projectId,
address contractAddress,
bytes32 serviceId,
uint256 amount
);
/// Errors
error ServiceNotActive(bytes32 serviceId);
error InvalidTotalAmount();
error ServiceAlreadyPaid(
bytes32 projectId,
address contractAddress,
bytes32 serviceId
);
/// Add a service to the payment program
/// @param _serviceId the service id
/// @param _pricePerItem the price per item
function addService(bytes32 _serviceId, uint256 _pricePerItem) external;
/// Set the service active status
/// @param _serviceId the service id
/// @param _active the active status
function setService(bytes32 _serviceId, bool _active) external;
/// function payService by projectId and contract address
/// @param _projectId bytes32 projectId
/// @param _contract the contract address
/// @param _serviceId the service id
/// @param _qty the qty of items to pay
function payService(
bytes32 _projectId,
address _contract,
bytes32 _serviceId,
uint256 _qty
) external payable;
/// Withdraw per invoice
/// @param _projectId the project id
/// @param _contract the contract address
/// @param _serviceId the service id
/// @param _to the address to withdraw the balance
function withdraw(
bytes32 _projectId,
address _contract,
bytes32 _serviceId,
address payable _to
) external;
/// Withdraw the contract balance
/// @param _to the address to withdraw the balance
function withdrawAll(address payable _to) external;
}
Read Contract
indexer 0xe06118b7 → address
payments 0xa6d23e10 → address
projectId 0x3fafa127 → bytes32
serviceId 0xda20ec6a → bytes32
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
deployContract 0x1b7ab660
bytes32 _projectId
bytes _byteCode
string _type
string _name
string _symbol
getProjectAddressOwner 0x6f058fd2
address _projectAddress
returns: address
getProjectOwner 0xec253dbc
bytes32 _projectId
returns: address
isContractRegistered 0xf9f6b49b
address _projectAddress
returns: bool
payService 0xf4b61222
bytes32 _projectId
address _token
uint256 qty
registerProject 0x46663429
bytes32 _projectId
address _owner
address _contract
string _contractType
string _name
string _symbol
Recent Transactions
No transactions found for this address