Skip to content

Instantly share code, notes, and snippets.

@himawari2021
himawari2021 / MyNFT4.sol
Created February 17, 2022 12:15
cursed NFT which can not be transfered
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol";
import "https://github.com/Brechtpd/base64/blob/main/base64.sol";
contract MyNFT4 is ERC721 {
@himawari2021
himawari2021 / MyNFT2.sol
Created February 16, 2022 16:03
Simple NFT
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol";
contract MyNFT2 is ERC721 {
address owner;
@himawari2021
himawari2021 / MyToken4.sol
Created February 13, 2022 08:41
Inflation Token example
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
//the token amount is twice whenever minted. if the mint_count is over 256, token amount is reseted.
contract MyToken4 is ERC20 {
@himawari2021
himawari2021 / BBS.sol
Created February 12, 2022 23:19
simple solidity BBS
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract BBS {
struct Post {
string message;
string name;
@himawari2021
himawari2021 / MyERC20Token3.sol
Created February 12, 2022 16:06
Joke ERC20 Token. The balance of the token is 893 forever.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract MyERC20Token3 {
string public constant name = "YakuzaToken";
string public constant symbol = "YKZ";
uint8 public constant decimals = 18;
@himawari2021
himawari2021 / sample1.py
Last active February 11, 2022 11:09
simple web3.py example for accessing to smart contract on Polygon
from web3 import Web3
from web3.middleware import geth_poa_middleware
#MyStraget.solにweb3.pyでアクセス
def main():
#自分のウォレットのアドレスとプレイベートキー
wallet = "0x...[ウォレットアドレス]"
key = "[プライベートキー]"
@himawari2021
himawari2021 / mystrage.html
Last active February 11, 2022 11:08
simple ethers.js example for accessing to smart contract on Polygon
<html>
<head>
<meta charset="UTF-8">
<script src="https://cdn.ethers.io/lib/ethers-5.2.umd.min.js"></script>
<script type="text/javascript">
var myContract = null;
window.onload = createContract;
@himawari2021
himawari2021 / MyStrage.sol
Created February 7, 2022 17:40
MyStrage.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract MyStrage {
string message = "hello";
function set(string memory _message) public {
message = _message;
}