Skip to content

Instantly share code, notes, and snippets.

@jennharw
Created January 16, 2022 10:16
Show Gist options
  • Save jennharw/db735a8c3a7705946000a4a63747ef5e to your computer and use it in GitHub Desktop.
Save jennharw/db735a8c3a7705946000a4a63747ef5e 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.5.5+commit.47a71e8f.js&optimize=false&runs=200&gist=
pragma solidity >=0.4.24 <0.5.6;
//NFT 발행, Solidity 기초
contract Practice { //Practice 라는 이름의 contract
//Storage variable
uint256 private totalSupply = 10;
string public name = "KlayLion";
address public owner; //contract deployer
mapping (uint256 => string) public tokenURIs; //map
constructor () public {
owner = msg.sender; // 생성자
}
function getTotalSupply() public view returns(uint256){
return totalSupply + 100000;
}
//set value of storage variable
function setTotalSupply(uint256 newSupply) public {
require(owner == msg.sender, 'Not owner'); //조건
totalSupply = newSupply;
}
function setTokenUri(uint256 id, string memory uri) public {
tokenURIs[id] = uri;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment