Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions contracts/ERC721a/ArchetypeErc721a.sol
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,8 @@ contract ArchetypeErc721a is
validateMint(invite, config, auth, _minted, signature, args, cost);

address msgSender = _msgSender();
address effectiveEoa = getEffectiveEoaWallet(msgSender);
if (invite.limit < invite.maxSupply) {
_minted[effectiveEoa][auth.key] += totalQuantity;
_minted[msgSender][auth.key] += totalQuantity;
}
if (invite.maxSupply < UINT32_MAX) {
_listSupply[auth.key] += totalQuantity;
Expand Down Expand Up @@ -236,9 +235,8 @@ contract ArchetypeErc721a is
: tokenIds.length / burnInvite.ratio;
_mint(msgSender, quantity);

address effectiveEoa = getEffectiveEoaWallet(msgSender);
if (burnInvite.limit < config.maxSupply) {
_minted[effectiveEoa][keccak256(abi.encodePacked("burn", auth.key))] += quantity;
_minted[msgSender][keccak256(abi.encodePacked("burn", auth.key))] += quantity;
}

updateBalances(
Expand Down Expand Up @@ -302,8 +300,7 @@ contract ArchetypeErc721a is
}

function minted(address minter, bytes32 key) external view returns (uint256) {
address effectiveEoa = getEffectiveEoaWallet(minter);
return _minted[effectiveEoa][key];
return _minted[minter][key];
}

function listSupply(bytes32 key) external view returns (uint256) {
Expand Down
24 changes: 4 additions & 20 deletions contracts/ERC721a/ArchetypeLogicErc721a.sol
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ abstract contract ArchetypeLogicErc721a {
uint128 cost
) internal view {
address msgSender = _msgSender();
address effectiveEoa = getEffectiveEoaWallet(msgSender);
if (args.affiliate != address(0)) {
if (
args.affiliate == PLATFORM || args.affiliate == args.owner || args.affiliate == msgSender
Expand All @@ -238,11 +237,11 @@ abstract contract ArchetypeLogicErc721a {
}

if (!i.isBlacklist) {
if (!verify(auth, i.tokenAddress, effectiveEoa)) {
if (!verify(auth, i.tokenAddress, msgSender)) {
revert WalletUnauthorizedToMint();
}
} else {
if (verify(auth, i.tokenAddress, effectiveEoa)) {
if (verify(auth, i.tokenAddress, msgSender)) {
revert Blacklisted();
}
}
Expand All @@ -256,7 +255,7 @@ abstract contract ArchetypeLogicErc721a {
}

if (i.limit < i.maxSupply) {
uint256 totalAfterMint = minted[effectiveEoa][auth.key] + args.quantity;
uint256 totalAfterMint = minted[msgSender][auth.key] + args.quantity;

if (totalAfterMint > i.limit) {
revert NumberOfMintsExceeded();
Expand Down Expand Up @@ -352,9 +351,8 @@ abstract contract ArchetypeLogicErc721a {
revert MaxBatchSizeExceeded();
}

address effectiveEoa = getEffectiveEoaWallet(msgSender);
if (burnInvite.limit < config.maxSupply) {
uint256 totalAfterMint = minted[effectiveEoa][keccak256(abi.encodePacked("burn", auth.key))] +
uint256 totalAfterMint = minted[msgSender][keccak256(abi.encodePacked("burn", auth.key))] +
quantity;

if (totalAfterMint > burnInvite.limit) {
Expand Down Expand Up @@ -556,20 +554,6 @@ abstract contract ArchetypeLogicErc721a {
}
}

function getEffectiveEoaWallet(address msgSender) public view returns (address) {
try DELEGATE_RESOLVER.delegatedWalletsByRights(msgSender, _AGW_LINK_RIGHTS) returns (address[] memory agwDelegates) {
// Use first delegated wallet if set
if(agwDelegates.length > 0) {
return agwDelegates[0];
}
} catch {
// If delegation check fails, silently fall back to msgSender
}

// Return msgSender if delegation fails or no delegates found
return msgSender;
}

function verify(
Auth calldata auth,
address tokenAddress,
Expand Down
Loading