// Sources flattened with hardhat v2.19.4 https://hardhat.org
// SPDX-License-Identifier: MIT
/*
,, ,,
`7MM `7MM mm db
MM MM MM
MM ,MP'`7MM `7MM ,M""bMM M"""MMV `7MM `7MM ,p6"bo ,pW"Wq.`7MMpMMMb.mmMMmm ,6"Yb. `7MM `7MMpMMMb. .gP"Ya `7Mb,od8
MM ;Y MM MM ,AP MM ' AMV MM MM 6M' OO 6W' `Wb MM MM MM 8) MM MM MM MM ,M' Yb MM' "'
MM;Mm MM MM 8MI MM AMV MM MM 8M 8M M8 MM MM MM ,pm9MM MM MM MM 8M"""""" MM
MM `Mb. MM MM `Mb MM AMV , MM MM YM. , YA. ,A9 MM MM MM 8M MM MM MM MM YM. , MM
.JMML. YA. `Mbod"YML.`Wbmd"MML.AMMmmmM `Mbod"YML. YMbmd' `Ybmd9'.JMML JMML.`Mbmo`Moo9^Yo..JMML..JMML JMML.`Mbmmd'.JMML.
-------------------------- FOR SALE VERSION -------------------------- -------------------------- --------------------------
*/
// File @openzeppelin/contracts/utils/Context.sol@v4.9.3
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @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 @openzeppelin/contracts/access/Ownable.sol@v4.9.3
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @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.
*
* By default, the owner account will be the one that deploys the contract. 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;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @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 {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_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 contracts/BasedKudzuContainer.sol
// Original license: SPDX_License_Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
// Use openzeppelin to inherit battle-tested implementations (ERC20, ERC721, etc)
interface KUDZU {
function approve(address to, uint256 tokenId) external;
function balanceOf(address owner) external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index)
external
view
returns (uint256);
function tokenURI(uint256 tokenId) external view returns (string memory);
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
}
/**
* A smart contract that allows changing a state variable of the contract and tracking the changes
* It also allows the owner to withdraw the Ether in the contract
* @author BuidlGuidl
*/
contract BasedKudzuContainer is Ownable {
KUDZU public kudzuContract = KUDZU(0x94E84f2DBB9b068eA01DB531E7343ec2385B7052);
function isInfected() public view returns (bool) {
return kudzuContract.balanceOf(address(this)) > 0;
}
function infectedWithTokenId() public view returns (uint256) {
if(!isInfected()) {
return 0;
}
return kudzuContract.tokenOfOwnerByIndex(address(this),0);
}
function tokenURI() public view returns (string memory) {
if(!isInfected()) {
return "";
}
return kudzuContract.tokenURI(kudzuContract.tokenOfOwnerByIndex(address(this),0));
}
function infect(address toAddress) public onlyOwner {
require(isInfected(), "not infected yet");
kudzuContract.transferFrom(address(this),toAddress,kudzuContract.tokenOfOwnerByIndex(address(this),0));
}
bool public canPubliclyInfect = false;
function setCanPubliclyInfect(bool _canPubliclyInfect) public onlyOwner {
canPubliclyInfect = _canPubliclyInfect;
}
function publiclyInfect(address toAddress) public {
require(isInfected(), "not infected yet");
require(canPubliclyInfect, "public infection is disabled by owner for this container");
kudzuContract.transferFrom(address(this),toAddress,kudzuContract.tokenOfOwnerByIndex(address(this),0));
}
constructor(address _owner) {
transferOwnership(_owner);
}
function execute(address _to, uint256 _value, bytes memory _data) public payable onlyOwner {
// Call the external contract
(bool success, ) = _to.call{value: _value}(_data);
require(success, "Failed to execute contract");
}
receive() external payable {}
}
// File contracts/BasedKudzuContainerForSale.sol
// Original license: SPDX_License_Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
// Use openzeppelin to inherit battle-tested implementations (ERC20, ERC721, etc)
/**
* A smart contract that allows changing a state variable of the contract and tracking the changes
* It also allows the owner to withdraw the Ether in the contract
* @author BuidlGuidl
*/
contract BasedKudzuContainerForSale is BasedKudzuContainer {
address public benificiary = 0x00080706a7D99CBC163D52dcF435205B1aD940D1; //safe.buidlguidl.eth
uint256 public price = 0;
function isForSale() public view returns (bool) {
return price > 0.000001 ether;
}
function setPrice(uint256 _price) public onlyOwner {
price = _price;
}
function purchase() public payable {
require(msg.value >= price, "not enough base ether sent");
price=0;
canPubliclyInfect=false;
address previousOwner = owner();
_transferOwnership(msg.sender);
uint256 onePercent = msg.value / 100;
(bool success, ) = previousOwner.call{value: msg.value-onePercent}("");
require(success, "purchase failed");
(bool success2, ) = benificiary.call{value: onePercent}("");
require(success2, "purchase failed");
}
constructor(address _owner) BasedKudzuContainer(_owner){}
}
{
"compilationTarget": {
"BasedKudzuContainerForSale.sol": "BasedKudzuContainerForSale"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"benificiary","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canPubliclyInfect","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"toAddress","type":"address"}],"name":"infect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"infectedWithTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isForSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isInfected","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kudzuContract","outputs":[{"internalType":"contract KUDZU","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"toAddress","type":"address"}],"name":"publiclyInfect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"purchase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_canPubliclyInfect","type":"bool"}],"name":"setCanPubliclyInfect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]