1

I'm trying to build a ERC1155 airdrop contract and need both claimable ( for free ) and payable ( whitelist style ) functions

I put my airdrop token infos in a strut using function call parameters but for an unknown reason, my bool variable ( isPayable ) returns an error on compilation

TypeError: Member "paidable" not found or not visible after argument-dependent lookup in struct AirDropperErc1155.AirDrop storage pointer. --> contracts/CWS.sol:101:9: | 101 | airDrop.paidable = paidable; | ^^^^^^^^^^^^^^^^

Any idea on how to solve that ?

function addErc1155Airdrop(
    uint256 airdropId,
    ERC1155 token,
    uint256 tokenId,
    uint256 amount,
    bytes32 merkleRoot,
    uint256 expirationSeconds,
    bool paidable,
    uint256 piecePrice
)
external
{
    require(!isPaused[0], "Paused");

    AirDrop storage airDrop = airDrops[airdropId];
    require(address(airDrop.token) == address(0), "Airdrop already exists");
  

    token.safeTransferFrom(msg.sender, address(this), tokenId, amount, "");
    airDrop.token = token;
    airDrop.tokenId = tokenId;
    airDrop.creator = msg.sender;
    airDrop.merkleRoot = merkleRoot;
    airDrop.amount = amount;
    airDrop.paidable = paidable;
    airDrop.piecePrice = piecePrice;
    
    if (expirationSeconds > 0) {
        airDrop.expirationTimestamp = uint64(block.timestamp + expirationSeconds);
    } else {
        airDrop.expirationTimestamp = uint64(block.timestamp + DEFAULT_AIRDROP_EXPIRATION);
    }
    emit AddedAirdrop(airdropId, token, tokenId, amount, paidable);
}

Would really appreciate your help on this one Much of love Tomy

1 Answer 1

1

I answered my question, seem that I had to declare that in my strut above

struct AirDrop {
        ERC1155 token;              // 20 bytes
        uint256 tokenId;
        uint64 expirationTimestamp; // 8 bytes
        bytes32 merkleRoot;
        uint256 amount;
        address creator;
        mapping(uint256 => uint256) claimedBitMap;
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.