POL Price: $0.218716 (+0.18%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Redeem Vouchers658867062024-12-24 22:49:14119 days ago1735080554IN
0xcBB46073...67AebdB90
0 POL0.003643843.26841277
Redeem Vouchers600974872024-08-02 7:32:29264 days ago1722583949IN
0xcBB46073...67AebdB90
0 POL0.005123276.33585886
Redeem Vouchers561664182024-04-23 15:10:33364 days ago1713885033IN
0xcBB46073...67AebdB90
0 POL0.01275166190
Redeem Vouchers556525212024-04-10 5:08:04378 days ago1712725684IN
0xcBB46073...67AebdB90
0 POL0.01086587161.90173294
Redeem Vouchers553904242024-04-03 7:39:14385 days ago1712129954IN
0xcBB46073...67AebdB90
0 POL0.00922008137.37941831
Redeem Vouchers551498732024-03-27 20:02:06391 days ago1711569726IN
0xcBB46073...67AebdB90
0 POL0.01051293156.64293814
Redeem Vouchers551310832024-03-27 8:08:03391 days ago1711526883IN
0xcBB46073...67AebdB90
0 POL0.00963431242.73302141
Redeem Vouchers551310822024-03-27 8:07:59391 days ago1711526879IN
0xcBB46073...67AebdB90
0 POL0.02044151242.73302141
Redeem Vouchers551078382024-03-26 17:22:32392 days ago1711473752IN
0xcBB46073...67AebdB90
0 POL0.00705612105.13636311
Redeem Vouchers550752672024-03-25 20:42:48393 days ago1711399368IN
0xcBB46073...67AebdB90
0 POL0.00252730.00693156
Redeem Vouchers550270932024-03-24 13:05:01394 days ago1711285501IN
0xcBB46073...67AebdB90
0 POL0.0040987661.07161106
Redeem Vouchers546795482024-03-15 7:47:12404 days ago1710488832IN
0xcBB46073...67AebdB90
0 POL0.01120717166.98715746
Redeem Vouchers545908522024-03-13 1:51:47406 days ago1710294707IN
0xcBB46073...67AebdB90
0 POL0.006241693
Redeem Vouchers542632122024-03-04 17:07:21414 days ago1709572041IN
0xcBB46073...67AebdB90
0 POL0.0127448189.8978377
Redeem Vouchers542624232024-03-04 16:38:27414 days ago1709570307IN
0xcBB46073...67AebdB90
0 POL0.02067076307.9948043
Redeem Vouchers542618992024-03-04 16:18:47414 days ago1709569127IN
0xcBB46073...67AebdB90
0 POL0.02172574257.98252545
Redeem Vouchers540490412024-02-28 7:04:09420 days ago1709103849IN
0xcBB46073...67AebdB90
0 POL0.0050535775.29838996
Redeem Vouchers540075392024-02-27 5:27:35421 days ago1709011655IN
0xcBB46073...67AebdB90
0 POL0.0047987971.50213378
Redeem Vouchers539916962024-02-26 19:53:50421 days ago1708977230IN
0xcBB46073...67AebdB90
0 POL0.0048481372.23732689
Redeem Vouchers539880632024-02-26 17:40:11421 days ago1708969211IN
0xcBB46073...67AebdB90
0 POL0.0049647673.97512056
Redeem Vouchers539832392024-02-26 14:40:55421 days ago1708958455IN
0xcBB46073...67AebdB90
0 POL0.0047685871.052002
Redeem Vouchers539592652024-02-26 0:21:09422 days ago1708906869IN
0xcBB46073...67AebdB90
0 POL0.002417636.02236112
Redeem Vouchers538713882024-02-23 17:45:03424 days ago1708710303IN
0xcBB46073...67AebdB90
0 POL0.0052029377.52385547
Redeem Vouchers538592742024-02-23 10:30:45424 days ago1708684245IN
0xcBB46073...67AebdB90
0 POL0.0060157889.6353174
Redeem Vouchers538390712024-02-22 22:00:46425 days ago1708639246IN
0xcBB46073...67AebdB90
0 POL0.00676882100.85559074
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VoucherBananaRedeemer

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 200 runs

Other Settings:
istanbul EvmVersion, None license
File 1 of 10 : voucherBananaRedeemer.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

/*
  WL voucher banana redeemer by gaspacho.eth
*/

import "IERC20.sol";
import "IERC1155.sol";
import "IERC721.sol";
import "Ownable.sol";
import "ERC1155Holder.sol";


contract VoucherBananaRedeemer is Ownable, ERC1155Holder {
  IERC20 polyBanana;
  IERC1155 pnkAssets;
  uint256 voucherId;
  uint256 voucherPrice;

  constructor(
    address _bananaAddress,
    address _pnkAssetsAddress,
    address _initOwner,
    uint256 _initVoucherId,
    uint256 _initVoucherPrice
  ) Ownable(_initOwner) {
    polyBanana = IERC20(_bananaAddress);
    pnkAssets = IERC1155(_pnkAssetsAddress);
    voucherId = _initVoucherId;
    voucherPrice = _initVoucherPrice;
  }

  // -- Events

  event Redeem(address indexed _from, uint256 _vouchersBurned, uint256 _bananaRedeemed);

  // -- User Functions

  function redeemVouchers(uint256 _amount) external {
    uint256 bananaReward = _amount * voucherPrice;
    pnkAssets.safeTransferFrom(msg.sender, address(this), voucherId, _amount, '');
    polyBanana.transfer(msg.sender, bananaReward);
    emit Redeem(msg.sender, _amount, bananaReward);
  }

  // -- Owner Functions

  function O_setVoucherPrice(uint256 _newPrice) external onlyOwner {
    voucherPrice = _newPrice;
  }

  function O_setVoucherInfo(address _pnkAssetsAddress, uint256 _id) external onlyOwner {
    pnkAssets = IERC1155(_pnkAssetsAddress);
    voucherId = _id;
  }

  function O_setBananaAddress(address _bananaAddress) external onlyOwner {
    polyBanana = IERC20(_bananaAddress);
  }

  function O_rescueERC20(uint256 _amount, address _tokenAddress) external onlyOwner {
    IERC20(_tokenAddress).transfer(owner(), _amount);
  }

  function O_rescueERC721(uint256 _id, address _tokenAddress) external onlyOwner {
    IERC721(_tokenAddress).safeTransferFrom(address(this), owner(), _id);
  }

  function O_rescueERC1155(uint256 _id, uint256 _amount, address _tokenAddress) external onlyOwner {
    IERC1155(_tokenAddress).safeTransferFrom(address(this), owner(), _id, _amount, '');
  }

  // -- View Utils

  function previewRedeem(uint256 _amount) external view returns (uint256) {
    return _amount * voucherPrice;
  }

  function redeemerInfo() external view returns (address, address, uint256, uint256, uint256) {
    return (
      address(polyBanana),
      address(pnkAssets),
      voucherId,
      voucherPrice,
      polyBanana.balanceOf(address(this))
    );
  }
}

File 2 of 10 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

File 3 of 10 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.20;

import {IERC165} from "IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the value of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] calldata accounts,
        uint256[] calldata ids
    ) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
     *
     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens
     * to an untrusted contract, when invoking {onERC1155Received} on the receiver.
     * Ensure to follow the checks-effects-interactions pattern and consider employing
     * reentrancy guards when interacting with untrusted contracts.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `value` amount.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     *
     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens
     * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
     * Ensure to follow the checks-effects-interactions pattern and consider employing
     * reentrancy guards when interacting with untrusted contracts.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `values` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external;
}

File 4 of 10 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 5 of 10 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
     *   a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or
     *   {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
     *   a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 6 of 10 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 7 of 10 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 8 of 10 : ERC1155Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/utils/ERC1155Holder.sol)

pragma solidity ^0.8.20;

import {IERC165, ERC165} from "ERC165.sol";
import {IERC1155Receiver} from "IERC1155Receiver.sol";

/**
 * @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
 *
 * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
 * stuck.
 */
abstract contract ERC1155Holder is ERC165, IERC1155Receiver {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
    }

    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
}

File 9 of 10 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 10 of 10 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.20;

import {IERC165} from "IERC165.sol";

/**
 * @dev Interface that must be implemented by smart contracts in order to receive
 * ERC-1155 token transfers.
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

Settings
{
  "evmVersion": "istanbul",
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "libraries": {
    "voucherBananaRedeemer.sol": {}
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_bananaAddress","type":"address"},{"internalType":"address","name":"_pnkAssetsAddress","type":"address"},{"internalType":"address","name":"_initOwner","type":"address"},{"internalType":"uint256","name":"_initVoucherId","type":"uint256"},{"internalType":"uint256","name":"_initVoucherPrice","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":false,"internalType":"uint256","name":"_vouchersBurned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_bananaRedeemed","type":"uint256"}],"name":"Redeem","type":"event"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"O_rescueERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"O_rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"O_rescueERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bananaAddress","type":"address"}],"name":"O_setBananaAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pnkAssetsAddress","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"O_setVoucherInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newPrice","type":"uint256"}],"name":"O_setVoucherPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"redeemVouchers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"redeemerInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50604051610d2c380380610d2c83398101604081905261002f91610113565b826001600160a01b03811661005e57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b610067816100a7565b50600180546001600160a01b039687166001600160a01b031991821617909155600280549590961694169390931790935550600391909155600455610169565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b038116811461010e57600080fd5b919050565b600080600080600060a0868803121561012b57600080fd5b610134866100f7565b9450610142602087016100f7565b9350610150604087016100f7565b6060870151608090970151959894975095949392505050565b610bb4806101786000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c8063b4e7a54511610097578063d1c570ea11610066578063d1c570ea14610212578063f23a6e6114610225578063f2fde38b14610244578063f7aef5551461025757600080fd5b8063b4e7a545146101a1578063b7bbca8b146101b4578063bc197c81146101c7578063c7b06d59146101ff57600080fd5b806365a685e3116100d357806365a685e314610158578063715018a61461016b5780638da5cb5b14610173578063b0ae27fe1461018e57600080fd5b806301ffc9a7146100fa5780634cdad5061461012257806351c3004614610143575b600080fd5b61010d610108366004610794565b610292565b60405190151581526020015b60405180910390f35b6101356101303660046107c5565b6102c9565b604051908152602001610119565b6101566101513660046107fa565b6102d9565b005b61015661016636600461082f565b61035b565b610156610389565b6000546040516001600160a01b039091168152602001610119565b61015661019c366004610859565b61039d565b6101566101af3660046107c5565b6103c7565b6101566101c2366004610874565b6104f8565b6101e66101d53660046109d7565b63bc197c8160e01b95945050505050565b6040516001600160e01b03199091168152602001610119565b61015661020d3660046107c5565b610597565b610156610220366004610874565b6105a4565b6101e6610233366004610a81565b63f23a6e6160e01b95945050505050565b610156610252366004610859565b610639565b61025f61067c565b604080516001600160a01b039687168152959094166020860152928401919091526060830152608082015260a001610119565b60006001600160e01b03198216630271189760e51b14806102c357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000600454826102c39190610ae6565b6102e1610717565b806001600160a01b031663f242432a306103036000546001600160a01b031690565b86866040518563ffffffff1660e01b81526004016103249493929190610b0b565b600060405180830381600087803b15801561033e57600080fd5b505af1158015610352573d6000803e3d6000fd5b50505050505050565b610363610717565b600280546001600160a01b0319166001600160a01b039390931692909217909155600355565b610391610717565b61039b6000610744565b565b6103a5610717565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600454826103d79190610ae6565b600254600354604051637921219560e11b81529293506001600160a01b039091169163f242432a9161041191339130918890600401610b0b565b600060405180830381600087803b15801561042b57600080fd5b505af115801561043f573d6000803e3d6000fd5b505060015460405163a9059cbb60e01b8152336004820152602481018590526001600160a01b03909116925063a9059cbb91506044016020604051808303816000875af1158015610494573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b89190610b43565b50604080518381526020810183905233917fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a929910160405180910390a25050565b610500610717565b806001600160a01b031663a9059cbb6105216000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af115801561056e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105929190610b43565b505050565b61059f610717565b600455565b6105ac610717565b806001600160a01b03166342842e0e306105ce6000546001600160a01b031690565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101859052606401600060405180830381600087803b15801561061d57600080fd5b505af1158015610631573d6000803e3d6000fd5b505050505050565b610641610717565b6001600160a01b03811661067057604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61067981610744565b50565b600154600254600354600480546040516370a0823160e01b8152309281019290925260009485948594859485946001600160a01b0394851694909316929084906370a0823190602401602060405180830381865afa1580156106e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107069190610b65565b945094509450945094509091929394565b6000546001600160a01b0316331461039b5760405163118cdaa760e01b8152336004820152602401610667565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156107a657600080fd5b81356001600160e01b0319811681146107be57600080fd5b9392505050565b6000602082840312156107d757600080fd5b5035919050565b80356001600160a01b03811681146107f557600080fd5b919050565b60008060006060848603121561080f57600080fd5b8335925060208401359150610826604085016107de565b90509250925092565b6000806040838503121561084257600080fd5b61084b836107de565b946020939093013593505050565b60006020828403121561086b57600080fd5b6107be826107de565b6000806040838503121561088757600080fd5b82359150610897602084016107de565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156108df576108df6108a0565b604052919050565b600082601f8301126108f857600080fd5b8135602067ffffffffffffffff821115610914576109146108a0565b8160051b6109238282016108b6565b928352848101820192828101908785111561093d57600080fd5b83870192505b8483101561095c57823582529183019190830190610943565b979650505050505050565b600082601f83011261097857600080fd5b813567ffffffffffffffff811115610992576109926108a0565b6109a5601f8201601f19166020016108b6565b8181528460208386010111156109ba57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156109ef57600080fd5b6109f8866107de565b9450610a06602087016107de565b9350604086013567ffffffffffffffff80821115610a2357600080fd5b610a2f89838a016108e7565b94506060880135915080821115610a4557600080fd5b610a5189838a016108e7565b93506080880135915080821115610a6757600080fd5b50610a7488828901610967565b9150509295509295909350565b600080600080600060a08688031215610a9957600080fd5b610aa2866107de565b9450610ab0602087016107de565b93506040860135925060608601359150608086013567ffffffffffffffff811115610ada57600080fd5b610a7488828901610967565b80820281158282048414176102c357634e487b7160e01b600052601160045260246000fd5b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b600060208284031215610b5557600080fd5b815180151581146107be57600080fd5b600060208284031215610b7757600080fd5b505191905056fea264697066735822122036f63e597c937699760bf56261ef2b97d84b403073cb1ff34755280fbf4b8e5b64736f6c63430008170033000000000000000000000000bc91347e80886453f3f8bbd6d7ac07c122d87735000000000000000000000000543dc6ca8381e8a1dd425bd7a686d5d7295f950e000000000000000000000000a6fd3673aa4ecf066b3eae30d41cc773495071e800000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000056bc75e2d63100000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063b4e7a54511610097578063d1c570ea11610066578063d1c570ea14610212578063f23a6e6114610225578063f2fde38b14610244578063f7aef5551461025757600080fd5b8063b4e7a545146101a1578063b7bbca8b146101b4578063bc197c81146101c7578063c7b06d59146101ff57600080fd5b806365a685e3116100d357806365a685e314610158578063715018a61461016b5780638da5cb5b14610173578063b0ae27fe1461018e57600080fd5b806301ffc9a7146100fa5780634cdad5061461012257806351c3004614610143575b600080fd5b61010d610108366004610794565b610292565b60405190151581526020015b60405180910390f35b6101356101303660046107c5565b6102c9565b604051908152602001610119565b6101566101513660046107fa565b6102d9565b005b61015661016636600461082f565b61035b565b610156610389565b6000546040516001600160a01b039091168152602001610119565b61015661019c366004610859565b61039d565b6101566101af3660046107c5565b6103c7565b6101566101c2366004610874565b6104f8565b6101e66101d53660046109d7565b63bc197c8160e01b95945050505050565b6040516001600160e01b03199091168152602001610119565b61015661020d3660046107c5565b610597565b610156610220366004610874565b6105a4565b6101e6610233366004610a81565b63f23a6e6160e01b95945050505050565b610156610252366004610859565b610639565b61025f61067c565b604080516001600160a01b039687168152959094166020860152928401919091526060830152608082015260a001610119565b60006001600160e01b03198216630271189760e51b14806102c357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000600454826102c39190610ae6565b6102e1610717565b806001600160a01b031663f242432a306103036000546001600160a01b031690565b86866040518563ffffffff1660e01b81526004016103249493929190610b0b565b600060405180830381600087803b15801561033e57600080fd5b505af1158015610352573d6000803e3d6000fd5b50505050505050565b610363610717565b600280546001600160a01b0319166001600160a01b039390931692909217909155600355565b610391610717565b61039b6000610744565b565b6103a5610717565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600454826103d79190610ae6565b600254600354604051637921219560e11b81529293506001600160a01b039091169163f242432a9161041191339130918890600401610b0b565b600060405180830381600087803b15801561042b57600080fd5b505af115801561043f573d6000803e3d6000fd5b505060015460405163a9059cbb60e01b8152336004820152602481018590526001600160a01b03909116925063a9059cbb91506044016020604051808303816000875af1158015610494573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b89190610b43565b50604080518381526020810183905233917fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a929910160405180910390a25050565b610500610717565b806001600160a01b031663a9059cbb6105216000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af115801561056e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105929190610b43565b505050565b61059f610717565b600455565b6105ac610717565b806001600160a01b03166342842e0e306105ce6000546001600160a01b031690565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101859052606401600060405180830381600087803b15801561061d57600080fd5b505af1158015610631573d6000803e3d6000fd5b505050505050565b610641610717565b6001600160a01b03811661067057604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61067981610744565b50565b600154600254600354600480546040516370a0823160e01b8152309281019290925260009485948594859485946001600160a01b0394851694909316929084906370a0823190602401602060405180830381865afa1580156106e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107069190610b65565b945094509450945094509091929394565b6000546001600160a01b0316331461039b5760405163118cdaa760e01b8152336004820152602401610667565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156107a657600080fd5b81356001600160e01b0319811681146107be57600080fd5b9392505050565b6000602082840312156107d757600080fd5b5035919050565b80356001600160a01b03811681146107f557600080fd5b919050565b60008060006060848603121561080f57600080fd5b8335925060208401359150610826604085016107de565b90509250925092565b6000806040838503121561084257600080fd5b61084b836107de565b946020939093013593505050565b60006020828403121561086b57600080fd5b6107be826107de565b6000806040838503121561088757600080fd5b82359150610897602084016107de565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156108df576108df6108a0565b604052919050565b600082601f8301126108f857600080fd5b8135602067ffffffffffffffff821115610914576109146108a0565b8160051b6109238282016108b6565b928352848101820192828101908785111561093d57600080fd5b83870192505b8483101561095c57823582529183019190830190610943565b979650505050505050565b600082601f83011261097857600080fd5b813567ffffffffffffffff811115610992576109926108a0565b6109a5601f8201601f19166020016108b6565b8181528460208386010111156109ba57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156109ef57600080fd5b6109f8866107de565b9450610a06602087016107de565b9350604086013567ffffffffffffffff80821115610a2357600080fd5b610a2f89838a016108e7565b94506060880135915080821115610a4557600080fd5b610a5189838a016108e7565b93506080880135915080821115610a6757600080fd5b50610a7488828901610967565b9150509295509295909350565b600080600080600060a08688031215610a9957600080fd5b610aa2866107de565b9450610ab0602087016107de565b93506040860135925060608601359150608086013567ffffffffffffffff811115610ada57600080fd5b610a7488828901610967565b80820281158282048414176102c357634e487b7160e01b600052601160045260246000fd5b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b600060208284031215610b5557600080fd5b815180151581146107be57600080fd5b600060208284031215610b7757600080fd5b505191905056fea264697066735822122036f63e597c937699760bf56261ef2b97d84b403073cb1ff34755280fbf4b8e5b64736f6c63430008170033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000bc91347e80886453f3f8bbd6d7ac07c122d87735000000000000000000000000543dc6ca8381e8a1dd425bd7a686d5d7295f950e000000000000000000000000a6fd3673aa4ecf066b3eae30d41cc773495071e800000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000056bc75e2d63100000

-----Decoded View---------------
Arg [0] : _bananaAddress (address): 0xbC91347e80886453F3f8bBd6d7aC07C122D87735
Arg [1] : _pnkAssetsAddress (address): 0x543dc6cA8381E8A1Dd425bD7a686d5D7295F950e
Arg [2] : _initOwner (address): 0xa6fD3673Aa4ecf066B3eAe30D41cC773495071E8
Arg [3] : _initVoucherId (uint256): 5
Arg [4] : _initVoucherPrice (uint256): 100000000000000000000

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000bc91347e80886453f3f8bbd6d7ac07c122d87735
Arg [1] : 000000000000000000000000543dc6ca8381e8a1dd425bd7a686d5d7295f950e
Arg [2] : 000000000000000000000000a6fd3673aa4ecf066b3eae30d41cc773495071e8
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [4] : 0000000000000000000000000000000000000000000000056bc75e2d63100000


Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.