일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- 러스트기초
- 컨트렉트 배포 자동화
- 스마트컨트렉트테스트
- 스마트 컨트렉트 함수이름 중복
- erc4337 contract
- SBT표준
- chainlink 설명
- ethers typescript
- rust 기초
- 머신러닝기초
- 체인의정석
- 스마트컨트렉트 함수이름 중복 호출
- vue기초
- 스마트컨트렉트 예약어 함수이름 중복
- ethers v6
- erc4337
- 러스트 기초
- git rebase
- 오블완
- ethers type
- Vue
- ethers
- 계정추상화
- ethers websocket
- multicall
- Vue.js
- 티스토리챌린지
- ambiguous function description
- 러스트 기초 학습
- 컨트렉트 동일한 함수이름 호출
- Today
- Total
체인의정석
Solidity 코드 분리하기 , 분리하며 나오는 Contract should be marked as abstract 에러 해결 본문
Solidity 코드 분리하기 , 분리하며 나오는 Contract should be marked as abstract 에러 해결
체인의정석 2022. 7. 6. 13:28Solidity를 오랜만에 보고 있기 때문에 최신 코딩 스타일을 참고하기 위해 소스들을 살펴보았다.
https://github.com/ProjectOpenSea/seaport/tree/main/contracts
GitHub - ProjectOpenSea/seaport: Seaport is a marketplace protocol for safely and efficiently buying and selling NFTs.
Seaport is a marketplace protocol for safely and efficiently buying and selling NFTs. - GitHub - ProjectOpenSea/seaport: Seaport is a marketplace protocol for safely and efficiently buying and sell...
github.com
현재 짜고 있는 컨트렉트는 거래소 관련 컨트렉트이기 때문에 오픈씨의 seaPort를 기준으로 코드를 참고하였다.
먼저 작동이 모두 되는 상태에서 핵심 기능별로 컨트렉트를 분리하였다.
결국 핵심 코드는 Seaport.sol에 두고 나머지 요소들은 lib에는 struct와 enum 등을 모아두었으며 핵심 기능인 conduit은 따로 폴더를 만들고 interfaces에 인터페이스를 모아둔 것을 볼 수 있었다.
이때 Conduit은 다른 컨트렉트로 배포되어 사용된다.
다른 컨트렉트이기 때문에 세부 경로로 들어가도 이렇게 상수와 struct enum을 따로 분리해 둔것을 볼 수 있었다.
일단 코드를 만들때는 이에 따라서 구조체, 상수, 변수 등을 따로 정의해두는 것과 핵심 기능과 인터페이스를 분리하는 식으로 진행을 하였다. 업그레이터블 적용은 아직 되기 전이기 때문에 따로 구조를 분리시키지는 않았다.
분리시킬때 "Contract should be marked as abstract" 에러가 났는데 이러한 에러는 constructor가 없어서 나는 것이였다.
생성자를 안만들어 주면 이런 에러가 난다.
https://ethereum.stackexchange.com/questions/83267/contract-should-be-marked-as-abstract
Contract should be marked as abstract
I'm getting the error: Contract "StarNotary" should be marked as abstract. pragma solidity >=0.4.24; import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract Star...
ethereum.stackexchange.com
추상컨트렉트의 경우
https://www.geeksforgeeks.org/solidity-abstract-contract/
Solidity - Abstract Contract - GeeksforGeeks
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
www.geeksforgeeks.org
위와 같이 따로 배포되지 않는 함수로서 extension에서 주로 쓰인다.
GitHub - OpenZeppelin/openzeppelin-contracts: OpenZeppelin Contracts is a library for secure smart contract development.
OpenZeppelin Contracts is a library for secure smart contract development. - GitHub - OpenZeppelin/openzeppelin-contracts: OpenZeppelin Contracts is a library for secure smart contract development.
github.com
'블록체인 > Solidity' 카테고리의 다른 글
Warning: Return value of low-level calls not used (0) | 2022.07.06 |
---|---|
Solidity constants vs immutable 차이 (0) | 2022.07.06 |
이더리움에서 데이터 서명관련 EIP 정리 (EIP1271 & EIP2098) (0) | 2022.06.27 |
Internal compiler error: Accessors for mapping with dynamically-sized keys not yet implemented 오류 해결 (0) | 2022.06.22 |
web3.utils.soliditySha3 와 ethers.utils.solidityKeccak256 (0) | 2022.06.22 |