Address Contract Partially Verified
Address
0xD2DF5332431eD0376CB33c1cF7eE870dDdf42547
Balance
0 ETH
Nonce
1
Code Size
5982 bytes
Creator
0x5E80919D...82f0 at tx 0xd9307764...5ab64c
Indexed Transactions
0
Contract Bytecode
5982 bytes
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806368a292121161007157806368a2921214610142578063c58d060114610155578063d5c5122914610168578063ddbde3fc1461017b578063e4ed20b41461018e578063e9d1e8ac146101a157600080fd5b80630d4d1513146100b9578063224c43ed146100ce57806323924225146100e15780634899edf41461010957806355f8ec381461011c578063605d44b11461012f575b600080fd5b6100cc6100c7366004611402565b6101b6565b005b6100cc6100dc366004611402565b610205565b6100f46100ef366004611444565b6103da565b60405190151581526020015b60405180910390f35b6100cc610117366004611444565b6104e2565b6100f461012a366004611444565b61067a565b6100cc61013d366004611470565b6106ee565b6100cc610150366004611402565b610833565b6100cc6101633660046114a9565b6109fb565b6100cc610176366004611470565b610af8565b6100f4610189366004611402565b610c34565b6100cc61019c366004611444565b610d5d565b6101a9610eb6565b6040516101009190611553565b82826101c282826103da565b6101e75760405162461bcd60e51b81526004016101de906115a1565b60405180910390fd5b6101f2858533610ed6565b6101fe85858533610f2b565b5050505050565b60405163a47d29cb60e01b8152600481018390528390839063224c43ed60e01b90839033906001600160a01b0383169063a47d29cb90602401602060405180830381865afa15801561025b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027f91906115d6565b6001600160a01b03161480610302575060405163230448b160e01b81526001600160a01b0382169063230448b1906102bf903390309087906004016115f3565b6020604051808303816000875af11580156102de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103029190611620565b61031e5760405162461bcd60e51b81526004016101de90611642565b868661032a82826103da565b6103465760405162461bcd60e51b81526004016101de906115a1565b600089898960405160200161035d93929190611670565b60408051808303601f19018152828252805160209182012060008181526003835292909220805460ff191690553383529092506001600160a01b038a8116928c92918e16917f0ef2cae6d13eb249f465c79d86f7949d480cf258199637844e42dabb2ab47b5391015b60405180910390a450505050505050505050565b60405163a47d29cb60e01b815260048101829052600090839082906001600160a01b0383169063a47d29cb90602401602060405180830381865afa158015610426573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044a91906115d6565b6001600160a01b0316036104625760009150506104dc565b306001600160a01b0316816001600160a01b03166392f002336040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ce91906115d6565b6001600160a01b0316149150505b92915050565b60405163a47d29cb60e01b815260048101829052829082906312267b7d60e21b90839033906001600160a01b0383169063a47d29cb90602401602060405180830381865afa158015610538573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055c91906115d6565b6001600160a01b031614806105df575060405163230448b160e01b81526001600160a01b0382169063230448b19061059c903390309087906004016115f3565b6020604051808303816000875af11580156105bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105df9190611620565b6105fb5760405162461bcd60e51b81526004016101de90611642565b858561060782826103da565b6106235760405162461bcd60e51b81526004016101de906115a1565b6000600160008a8a60405160200161063c929190611698565b60408051808303601f19018152918152815160209283012083529082019290925201600020805460ff19169115159190911790555050505050505050565b6000828261068882826103da565b6106a45760405162461bcd60e51b81526004016101de906115a1565b6001600086866040516020016106bb929190611698565b60408051808303601f190181529181528151602092830120835290820192909252016000205460ff161595945050505050565b60405163230448b160e01b8152829063605d44b160e01b9082906001600160a01b0382169063230448b19061072b903390309087906004016115f3565b6020604051808303816000875af115801561074a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076e9190611620565b6107a75760405162461bcd60e51b815260206004820152600a60248201526927b7363c9030b236b4b760b11b60448201526064016101de565b600085856040516020016107bc9291906116b5565b60408051808303601f19018152828252805160209182012060008181526004835292909220805460ff191690553383529092506001600160a01b0387811692908916917fd42193e506646ec3d9c2a28112dafeb41c5f02e67aa5d03df76d882a1859c3be91015b60405180910390a3505050505050565b60405163a47d29cb60e01b81526004810183905283908390633451490960e11b90839033906001600160a01b0383169063a47d29cb90602401602060405180830381865afa158015610889573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ad91906115d6565b6001600160a01b03161480610930575060405163230448b160e01b81526001600160a01b0382169063230448b1906108ed903390309087906004016115f3565b6020604051808303816000875af115801561090c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109309190611620565b61094c5760405162461bcd60e51b81526004016101de90611642565b868661095882826103da565b6109745760405162461bcd60e51b81526004016101de906115a1565b600089898960405160200161098b93929190611670565b60408051601f19818403018152828252805160209182012060008181526003835292909220805460ff191660011790553383529092506001600160a01b038a8116928c92918e16917ff3b4e63fce9a8d0707d513fa20e984249fe8dae703c4045fde59bd2c73e5533991016103c6565b8385610a0782826103da565b610a235760405162461bcd60e51b81526004016101de906115a1565b604080517f8bf5fae59cb5ca2871519e23fd0529aefd3463111148223dfad40e81c5a44c76602082015233918101919091526001600160a01b03808a16606083015260808201899052871660a082015260c0810186905260009060e00160408051601f198184030181526020601f88018190048102840181019092528683529250600091610ad39184918a918a908a90819084018382808284376000920191909152508e92508f9150610fad9050565b9050610ae0888a83610ed6565b610aec888a8c33610f2b565b50505050505050505050565b60405163230448b160e01b8152829063d5c5122960e01b9082906001600160a01b0382169063230448b190610b35903390309087906004016115f3565b6020604051808303816000875af1158015610b54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b789190611620565b610bb15760405162461bcd60e51b815260206004820152600a60248201526927b7363c9030b236b4b760b11b60448201526064016101de565b60008585604051602001610bc69291906116b5565b60408051601f19818403018152828252805160209182012060008181526004835292909220805460ff191660011790553383529092506001600160a01b0387811692908916917ff19bb170b2d636683441b2b1edae8ffe70958afa473e2ddd0ea4e327b7ffd29c9101610823565b600080849050600460008685604051602001610c519291906116b5565b60408051601f198184030181529181528151602092830120835290820192909252016000205460ff1615610c89576001915050610d56565b60036000868686604051602001610ca293929190611670565b60408051601f198184030181529181528151602092830120835290820192909252016000205460ff1615610cda576001915050610d56565b60405163a47d29cb60e01b8152600481018590526001600160a01b03808516919083169063a47d29cb90602401602060405180830381865afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4891906115d6565b6001600160a01b0316149150505b9392505050565b60405163a47d29cb60e01b8152600481018290528290829063393b482d60e21b90839033906001600160a01b0383169063a47d29cb90602401602060405180830381865afa158015610db3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd791906115d6565b6001600160a01b03161480610e5a575060405163230448b160e01b81526001600160a01b0382169063230448b190610e17903390309087906004016115f3565b6020604051808303816000875af1158015610e36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5a9190611620565b610e765760405162461bcd60e51b81526004016101de90611642565b8585610e8282826103da565b610e9e5760405162461bcd60e51b81526004016101de906115a1565b60018060008a8a60405160200161063c929190611698565b606060405180606001604052806022815260200161170760229139905090565b610ee1838383610c34565b610f265760405162461bcd60e51b8152602060048201526016602482015275139bdd08185d5d1a1bdc9a5e9959081d1bc81b5a5b9d60521b60448201526064016101de565b505050565b604051615de560e01b81526001600160a01b038381166004830152602482018590528281166044830152859190821690615de5906064016020604051808303816000875af1158015610f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa591906116d7565b505050505050565b6000610fb9838361067a565b6110055760405162461bcd60e51b815260206004820152601a60248201527f5369676e6564206d696e74696e67206e6f7420616c6c6f77656400000000000060448201526064016101de565b60008054878051906020012060405160200161103892919061190160f01b81526002810192909252602282015260420190565b60408051601f1981840301815291815281516020928301206000898152600290935291205490915060ff16156110b05760405162461bcd60e51b815260206004820152601c60248201527f5369676e6564206d696e7420616c72656164792072656465656d65640000000060448201526064016101de565b6000868152600260205260409020805460ff191660011790556110d381866110de565b979650505050505050565b60008060006110ed8585611102565b915091506110fa81611147565b509392505050565b60008082516041036111385760208301516040840151606085015160001a61112c87828585611300565b94509450505050611140565b506000905060025b9250929050565b600081600481111561115b5761115b6116f0565b036111635750565b6001816004811115611177576111776116f0565b036111c45760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016101de565b60028160048111156111d8576111d86116f0565b036112255760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016101de565b6003816004811115611239576112396116f0565b036112915760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016101de565b60048160048111156112a5576112a56116f0565b036112fd5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016101de565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561133757506000905060036113e4565b8460ff16601b1415801561134f57508460ff16601c14155b1561136057506000905060046113e4565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156113b4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166113dd576000600192509250506113e4565b9150600090505b94509492505050565b6001600160a01b03811681146112fd57600080fd5b60008060006060848603121561141757600080fd5b8335611422816113ed565b9250602084013591506040840135611439816113ed565b809150509250925092565b6000806040838503121561145757600080fd5b8235611462816113ed565b946020939093013593505050565b6000806040838503121561148357600080fd5b823561148e816113ed565b9150602083013561149e816113ed565b809150509250929050565b60008060008060008060a087890312156114c257600080fd5b86356114cd816113ed565b95506020870135945060408701356114e4816113ed565b935060608701359250608087013567ffffffffffffffff8082111561150857600080fd5b818901915089601f83011261151c57600080fd5b81358181111561152b57600080fd5b8a602082850101111561153d57600080fd5b6020830194508093505050509295509295509295565b600060208083528351808285015260005b8181101561158057858101830151858201604001528201611564565b506000604082860101526040601f19601f8301168501019250505092915050565b6020808252818101527f50726f6a656374206e6f7420636f72726563746c7920636f6e66696775726564604082015260600190565b6000602082840312156115e857600080fd5b8151610d56816113ed565b6001600160a01b0393841681529190921660208201526001600160e01b0319909116604082015260600190565b60006020828403121561163257600080fd5b81518015158114610d5657600080fd5b60208082526014908201527327b7363c9030b93a34b9ba1037b91030b236b4b760611b604082015260600190565b6001600160601b0319606094851b811682526014820193909352921b16603482015260480190565b60609290921b6001600160601b0319168252601482015260340190565b6001600160601b0319606093841b811682529190921b16601482015260280190565b6000602082840312156116e957600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fdfe5665726973617274417274626c6f636b73496e746567726174696f6e4d696e746572a2646970667358221220e7fd4823ad5656fe27871279719753806aac6456fd33e29eeedbd5b36f35937164736f6c63430008130033
Verified Source Code Partial Match
Compiler: v0.8.19+commit.7dd6d404
EVM: paris
Optimization: Yes (200 runs)
IAdminACLV1.sol 11 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
abstract contract IAdminACLV1 {
function allowed(
address _sender,
address /*_contract*/,
bytes4 _selector
) external view virtual returns (bool);
}
IArtblocksCore.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
abstract contract IArtblocksCore {
address public minterContract;
function projectIdToArtistAddress(
uint256 _projectId
) external view virtual returns (address payable);
function adminACLAllowed(
address _sender,
address _contract,
bytes4 _selector
) public virtual returns (bool);
// solhint-disable-next-line
function mint_Ecf(
address _to,
uint256 _projectId,
address _by
) external virtual returns (uint256 _tokenId);
}
Strings.sol 75 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
ECDSA.sol 218 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
VerisartArtblocksIntegration.sol 331 lines
// SPDX-License-Identifier: MIT
import "./IArtblocksCore.sol";
import "./IAdminACLV1.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
pragma solidity ^0.8.9;
contract VerisartArtblocksIntegration {
bytes32 private constant _DOMAIN_TYPEHASH =
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)"
);
bytes32 private _eip712DomainSeparator =
keccak256(
abi.encode(
_DOMAIN_TYPEHASH,
keccak256("Verisart"),
keccak256("1"),
block.chainid,
address(this),
0xf84c063feaae44fa2f4a846cf2dadc08b50b6a5b0b04bed3d70ed9fa1a199edc // Verisart's EIP712 salt
)
);
bytes32 private constant _MINT_SIGNED_TYPEHASH =
keccak256(
"MintNFT(address sender,address to,uint256 projectId,address core,bytes32 tokenNonce)"
);
/**
* @dev Allows minting via signed mint (an off-chain signature is still required).
* By default, this is enabled for all projects/cores.
* This can be disabled by the artist/admin via `disableSignedMinting`
*/
mapping(bytes32 => bool) private _disableSignedMinting;
mapping(bytes32 => bool) private _signedMints;
/**
* @dev Permissions set at the project level.
*/
mapping(bytes32 => bool) private _mintingPermissionsProjectLevel;
/**
* @dev Permissions set at the contract level.
*/
mapping(bytes32 => bool) private _mintingPermissionsContractLevel;
event PermissionGrantedContract(
address indexed core,
address indexed to,
address by
);
event PermissionRevokedContract(
address indexed core,
address indexed to,
address by
);
event PermissionGrantedProject(
address indexed core,
uint256 indexed projectId,
address indexed to,
address by
);
event PermissionRevokedProject(
address indexed core,
uint256 indexed projectId,
address indexed to,
address by
);
function mintSigned(
address to,
uint256 projectId,
address core,
bytes32 tokenNonce,
bytes calldata signature
) external onlyProjectCorrectlyConfigured(core, projectId) {
bytes memory args = abi.encode(
_MINT_SIGNED_TYPEHASH,
msg.sender,
to,
projectId,
core,
tokenNonce
);
address recoveredAddress = _checkSigned(
args,
tokenNonce,
signature,
core,
projectId
);
_checkAddressCanMint(core, projectId, recoveredAddress);
_mintFromNoPermission(core, projectId, to, msg.sender);
}
function mint(
address core,
uint256 projectId,
address to
) public onlyProjectCorrectlyConfigured(core, projectId) {
_checkAddressCanMint(core, projectId, msg.sender);
_mintFromNoPermission(core, projectId, to, msg.sender);
}
function _mintFromNoPermission(
address core,
uint256 projectId,
address to,
address from
) private {
IArtblocksCore artblocksCore = IArtblocksCore(core);
artblocksCore.mint_Ecf(to, projectId, from);
}
function hasMintingPermission(
address core,
uint256 projectId,
address sender
) public view returns (bool) {
IArtblocksCore artblocksCore = IArtblocksCore(core);
if (
_mintingPermissionsContractLevel[
keccak256(abi.encodePacked(core, sender))
]
) {
return true;
}
if (
_mintingPermissionsProjectLevel[
keccak256(abi.encodePacked(core, projectId, sender))
]
) {
return true;
}
return artblocksCore.projectIdToArtistAddress(projectId) == sender;
}
function grantContractPermission(
address core,
address to
) public onlyAdmin(core, this.grantContractPermission.selector) {
bytes32 permissionHash = keccak256(abi.encodePacked(core, to));
_mintingPermissionsContractLevel[permissionHash] = true;
emit PermissionGrantedContract(core, to, msg.sender);
}
function revokeContractPermission(
address core,
address to
) public onlyAdmin(core, this.revokeContractPermission.selector) {
bytes32 permissionHash = keccak256(abi.encodePacked(core, to));
delete _mintingPermissionsContractLevel[permissionHash];
emit PermissionRevokedContract(core, to, msg.sender);
}
function grantProjectPermission(
address core,
uint256 projectId,
address to
)
public
onlyAdminOrArtist(core, projectId, this.grantProjectPermission.selector)
onlyProjectCorrectlyConfigured(core, projectId)
{
bytes32 permissionHash = keccak256(
abi.encodePacked(core, projectId, to)
);
_mintingPermissionsProjectLevel[permissionHash] = true;
emit PermissionGrantedProject(core, projectId, to, msg.sender);
}
function revokeProjectPermission(
address core,
uint256 projectId,
address to
)
public
onlyAdminOrArtist(
core,
projectId,
this.revokeProjectPermission.selector
)
onlyProjectCorrectlyConfigured(core, projectId)
{
bytes32 permissionHash = keccak256(
abi.encodePacked(core, projectId, to)
);
delete _mintingPermissionsProjectLevel[permissionHash];
emit PermissionRevokedProject(core, projectId, to, msg.sender);
}
modifier onlyAdmin(address core, bytes4 _selector) {
IArtblocksCore artblocksCore = IArtblocksCore(core);
require(
artblocksCore.adminACLAllowed(msg.sender, address(this), _selector),
"Only admin"
);
_;
}
modifier onlyAdminOrArtist(
address core,
uint256 projectId,
bytes4 _selector
) {
IArtblocksCore artblocksCore = IArtblocksCore(core);
require(
artblocksCore.projectIdToArtistAddress(projectId) == msg.sender ||
artblocksCore.adminACLAllowed(
msg.sender,
address(this),
_selector
),
"Only artist or admin"
);
_;
}
/**
* Checks if the project is correctly configured - a sanity check.
* 1. The project must have an artist address set - This confirms the project exists
* 2. The project must have this contract set as the minter - Otherwise we can't mint
*/
function projectCorrectlyConfigured(
address _core,
uint256 _projectId
) public view returns (bool) {
IArtblocksCore artblocksCore = IArtblocksCore(_core);
if (artblocksCore.projectIdToArtistAddress(_projectId) == address(0))
return false;
return artblocksCore.minterContract() == address(this);
}
modifier onlyProjectCorrectlyConfigured(address _core, uint256 _projectId) {
require(
projectCorrectlyConfigured(_core, _projectId),
"Project not correctly configured"
);
_;
}
function allowSignedMinting(
address core,
uint256 projectId
)
public
view
onlyProjectCorrectlyConfigured(core, projectId)
returns (bool)
{
return
!_disableSignedMinting[
keccak256(abi.encodePacked(core, projectId))
];
}
function enableSignedMinting(
address core,
uint256 projectId
)
external
onlyAdminOrArtist(core, projectId, this.enableSignedMinting.selector)
onlyProjectCorrectlyConfigured(core, projectId)
{
_disableSignedMinting[
keccak256(abi.encodePacked(core, projectId))
] = false;
}
function disableSignedMinting(
address core,
uint256 projectId
)
external
onlyAdminOrArtist(core, projectId, this.disableSignedMinting.selector)
onlyProjectCorrectlyConfigured(core, projectId)
{
_disableSignedMinting[
keccak256(abi.encodePacked(core, projectId))
] = true;
}
function _checkAddressCanMint(
address core,
uint256 projectId,
address sender
) private view {
require(
hasMintingPermission(core, projectId, sender),
"Not authorized to mint"
);
}
function minterType() external pure returns (string memory) {
return "VerisartArtblocksIntegrationMinter";
}
function _checkSigned(
bytes memory args,
bytes32 tokenNonce,
bytes memory signature,
address core,
uint256 projectId
) private returns (address) {
require(
allowSignedMinting(core, projectId),
"Signed minting not allowed"
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
_eip712DomainSeparator,
keccak256(args)
)
);
require(
_signedMints[tokenNonce] == false,
"Signed mint already redeemed"
);
_signedMints[tokenNonce] = true;
return ECDSA.recover(digest, signature);
}
}
Read Contract
allowSignedMinting 0x55f8ec38 → bool
hasMintingPermission 0xddbde3fc → bool
minterType 0xe9d1e8ac → string
projectCorrectlyConfigured 0x23924225 → bool
Write Contract 8 functions
These functions modify contract state and require a wallet transaction to execute.
disableSignedMinting 0xe4ed20b4
address core
uint256 projectId
enableSignedMinting 0x4899edf4
address core
uint256 projectId
grantContractPermission 0xd5c51229
address core
address to
grantProjectPermission 0x68a29212
address core
uint256 projectId
address to
mint 0x0d4d1513
address core
uint256 projectId
address to
mintSigned 0xc58d0601
address to
uint256 projectId
address core
bytes32 tokenNonce
bytes signature
revokeContractPermission 0x605d44b1
address core
address to
revokeProjectPermission 0x224c43ed
address core
uint256 projectId
address to
Recent Transactions
No transactions found for this address