ERC-1155
constructor() ERC1155("") {}
: 원래는 메타데이터가 들어가야 하는데, 에러를 해결하기 위해서 일단은 비워준 상태로 만든다
public
: 명시하지 않으면 기본적으로 private
으로 설정되기 때문에, 외부에서 읽고 쓸 수 있도록 하려면 public
키워드를 사용해줘야한다
_mint
: 계정 주소,
_mint(address to, uint256 id, uint256 value, bytes data)
uri
함수: uint
형태를 넣을 경우, 오류가 난다. string
으로 변경해줘야한다.
ownable
: 다중상속. 주인인지 아닌지에 따라서 제어할 수 있는 기능을 제공해준다. Contract 선언 시 키워드를 추가해주고, 생성자에도 추가하고 msg.sender
를 포함시켜준다.
setMetadataURI
-> reveal
-> NFT 메타데이터 새로고침
...
> Refresh Metadataimport { FC, useState } from "react";
const App: FC = () => {
const [count, setCount] = useState<number>(0);
const onClickCount = () => {
setCount(count + 1);
};
return (
<div className="bg-red-100">
<div>{count}</div>
<div>
<button onClick={onClickCount}>+</button>
</div>
</div>
);
};
export default App;
interface BoxProps {
bgColor: string;
name: string;
isRounded: boolean;
}
const Box: FC<BoxProps>