Skip to content

Instantly share code, notes, and snippets.

@bertil291utn
Created February 8, 2023 15:14
Show Gist options
  • Save bertil291utn/96bf43bde142c1a83b2cb39bf931066a to your computer and use it in GitHub Desktop.
Save bertil291utn/96bf43bde142c1a83b2cb39bf931066a to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IERC20.sol";
import "./IERC1155.sol";
contract MultipleEditionClaimable is ReentrancyGuard, Ownable {
//token buy with any erc20 token
// function mintUser(
// uint256 id,
// IERC1155 tokenERC1155Address,
// IERC20 _tokenERC20Address,
// address owner
// ) public {
// if (tokenERC1155Address.getTokenPrice(id) > 0) {
// //approve for this contract address to transfer funds
// _tokenERC20Address.transferFrom(
// msg.sender,
// address(this),
// tokenERC1155Address.getTokenPrice(id)
// );
// }
// tokenERC1155Address.safeTransferFrom(owner, msg.sender, id, 1, "");
// }
function buyNFT(
uint256 id,
IERC1155 tokenERC1155Address,
address NFTOwner
) public payable {
tokenERC1155Address.safeTransferFrom(NFTOwner, msg.sender, id, 1, "");
}
function withdraw() public onlyOwner nonReentrant {
(bool success, ) = address(owner()).call{value: address(this).balance}(
""
);
require(success, "withdraw failed to send");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment