일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 계정추상화
- ethers v6
- redux 기초
- ethers typescript
- 스마트컨트렉트 함수이름 중복 호출
- rust 기초
- cloud hsm 사용하기
- 스마트컨트렉트 예약어 함수이름 중복
- 머신러닝기초
- git rebase
- Vue
- cloud hsm 서명
- 티스토리챌린지
- Vue.js
- SBT표준
- ethers websocket
- cloud hsm
- ambiguous function description
- 체인의정석
- 컨트렉트 동일한 함수이름 호출
- redux toolkit 설명
- 오블완
- erc4337
- 러스트 기초
- 러스트기초
- ethers type
- 러스트 기초 학습
- vue기초
- 스마트 컨트렉트 함수이름 중복
- erc4337 contract
Archives
- Today
- Total
체인의정석
주소가 CA인지 체크하는 방법 본문
728x90
How does a contract find out if another address is a contract?
Is it possible, from within a contract written in Solidity, to check if a contract is placed on a specific address or if this address does not contain any code?
ethereum.stackexchange.com
오픈씨의 wyvernExchange의 경우 아래와 같은 코드가 있었다.
target이 스마트컨트렉트 형태의 지갑이기 때문에 이러한 형태가 있었는데 주소가 포함하는 바이트코드를 체크해서 확인을 하는 방법이다.
따라서 아래 구문을 사용하면 지갑이 CA인지 구분하고 이후 작업을 진행하는 것이 가능하다.
/* Target must exist (prevent malicious selfdestructs just prior to order settlement). */
uint size;
address target = sell.target;
assembly {
size := extcodesize(target)
}
require(size > 0);
728x90
반응형
'블록체인 > Ethers & web3' 카테고리의 다른 글
ethers에서 bigNumber를 number 형태로 고치기 + 테스트 값 비교 (0) | 2022.07.04 |
---|---|
hardhat의 chainID를 수정하여 메타마스크와 연결하기, 메타마스크와 hardhat 테스트 네트워크 연결하는 법 (0) | 2022.06.30 |
DocstringParsingError: Documented parameter "" not found in the parameter list of the function. 오류 해결 (0) | 2022.06.22 |
상용 서비스에 들어가는 Smart Contract 테스트 코드 작성 팁 (0) | 2022.05.30 |
ethers+hardhat) 스마트컨트렉트에서 uint256 배열이 리턴되는 경우의 테스트 코드 (1) | 2022.05.25 |
Comments