Remix mentés

master
itsfine 2022-02-22 20:21:18 +01:00
parent 7d92cfc376
commit d684dd5043
2 changed files with 144 additions and 0 deletions

71
Donate.sol 100644
View File

@ -0,0 +1,71 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.11;
contract Donatetocontract{
uint256 public sendernumber = 0;
uint256 public minmoney = 0;
uint256 public amountwithdrawed = 0;
uint256 public nrofwithdraw = 0;
string internal message;
uint256 private amountearned = 0;
address private admin;
uint256 private monthlycosts = 30000;
mapping (uint256 => address) internal showaddress;
mapping (uint256 => string) internal showmessage;
mapping (uint256 => uint256) internal showmoney;
constructor() {
admin = 0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db;
}
address payable[] public donators;
function getdonators() public view returns (address payable[] memory){
return donators;
}
function senddonation(string memory _message) public payable{
require(msg.value > minmoney, 'Please do not donate 0 amount!');
sendernumber = sendernumber + 1;
amountearned = amountearned + msg.value;
showaddress[sendernumber] = msg.sender;
message = _message;
showmessage[sendernumber] = message;
showmoney[sendernumber] = msg.value;
donators.push(payable(msg.sender));
}
function adminWithdraw(uint256 _withdrawamount) public returns (bool) {
require(msg.sender == admin, 'You are not the central admin!');
(bool sent,) = msg.sender.call{value: _withdrawamount}("");
amountwithdrawed = amountwithdrawed + _withdrawamount;
return sent;
}
function _showsender(uint256 _sendernumber) public view returns (address cim_ , uint256 osszeg_, string memory uzenet_) {
return (showaddress[_sendernumber], showmoney[_sendernumber], showmessage[_sendernumber]);
}
function _showcontract() public view returns (uint nrofDonation_, uint amountEarned_, uint amountWithdrawed_, uint currentTotal_){
return (sendernumber, amountearned, amountwithdrawed, address(this).balance);
}
function _monthlyresults () private view returns(uint256) {
return amountearned - monthlycosts;
}
function showbalance() public view returns (uint256) {
return address(this).balance;
}
}

73
SafuDot.sol 100644
View File

@ -0,0 +1,73 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.11;
contract SafuDotNFT {
address public admin;
uint256 public maxNFTs;
uint256 public NFTCount;
uint256 public NFTPrice;
mapping (uint256 => string) internal idToHash;
mapping (uint256 => address) internal idToOwner;
uint256 public blockTime;
string private correct_password;
constructor() {
admin = msg.sender;
maxNFTs = 99;
NFTCount = 0;
NFTPrice = 10000000000000000;
blockTime = block.timestamp;
}
function mint(string memory _hashu) external payable {
require(msg.sender == admin, 'You are not the central admin!');
require(blockTime <= block.timestamp + 5 minutes, 'Chill bro!');
require(NFTCount <= 99, 'You shall not pass! All NFTz are minted!');
require(msg.value >= NFTPrice, 'Where are da fundz?');
blockTime = block.timestamp;
NFTCount = NFTCount + 1;
NFTPrice = NFTPrice * 2;
idToOwner[NFTCount] = msg.sender;
idToHash[NFTCount] = _hashu;
}
function transfer(uint256 _tokenId, address _toAddress) external {
require(msg.sender == idToOwner[_tokenId], 'But it is not yours!');
idToOwner[_tokenId] = _toAddress;
}
function adminWithdraw() external returns (bool) {
require(msg.sender == admin, 'You are not the central admin!');
(bool sent,) = msg.sender.call{value: address(this).balance}("");
return sent;
}
function WhoGotchaThat(uint256 _whichOne) public view returns (address) {
return(idToOwner[_whichOne]);
}
function WhatIsTheHash(uint256 _tokenId) public view returns (string memory){
return(idToHash[_tokenId]);
}
function adminChange(address _newAdmin) external returns (bool) {
require(blockTime <= block.timestamp + 6 minutes, 'Welcome to the game!');
admin = _newAdmin;
return true;
}
function set_password() external {
require(msg.sender == admin, 'You are not the central admin!');
correct_password = correct_password;
}
function su1c1d3(address payable _addr, string memory _password) external {
require(msg.sender == admin, 'You are not the central admin!');
require(keccak256(abi.encodePacked(correct_password)) == keccak256(abi.encodePacked(_password)), 'Very sekur.');
selfdestruct(_addr);
}
fallback() external payable {}
receive() external payable {}