StaticPrecompiles.WithOkrwPrecompile
(s StaticPrecompiles) WithOkrwPrecompile(bankKeeper, okrwKeeper, accountKeeper) StaticPrecompiles 이 메서드는 OKRW 프리컴파일을 StaticPrecompiles 맵에 추가합니다. 프리컴파일을 인스턴스화하고, 필요한 키퍼 의존성을 주입하며, 지정된 온체인 주소에 등록합니다. 이는 전체 프리컴파일 세트를 구성하는 데 사용되는 빌더 패턴의 일부입니다.
파라미터
| 이름 | 타입 | 필수 | 설명 |
|---|---|---|---|
s | StaticPrecompiles | ✓ | 리시버; OKRW 프리컴파일이 추가될 프리컴파일 맵입니다. |
bankKeeper | cmn.BankKeeper | ✓ | OKRW 토큰 전송 및 잔액 조회를 처리하는 데 사용되는 x/bank 모듈 키퍼입니다. |
okrwKeeper | okrwkeeper.Keeper | ✓ | 발행 로직, 권한 및 모듈별 파라미터에 접근하는 데 사용되는 x/okrw 모듈 키퍼입니다. |
accountKeeper | okrwtypes.AccountKeeper | ✓ | 계정 존재 여부 확인 및 기타 계정 관련 작업을 위해 사용되는 x/auth 모듈 키퍼입니다. |
반환값
타입:
StaticPrecompiles 메서드 체이닝을 허용하기 위해 이제 OKRW 프리컴파일을 포함하는 수정된 StaticPrecompiles 맵을 반환합니다.
예제
연쇄 호출
이 예시는 `DefaultStaticPrecompiles` 내에서 의도된 사용법을 보여줍니다. 메서드를 연쇄적으로 호출하여 마루 전용 프리컴파일의 최종 세트를 구성합니다.
marooPrecompiles := StaticPrecompiles(precompiles).
WithOkrwPrecompile(bankKeeper, okrwKeeper, accountKeeper).
WithPclPrecompile(bankKeeper, pclKeeper) 수동 구성
이 예시는 개발자가 새롭고 비어있는 프리컴파일 맵에 OKRW 프리컴파일만 수동으로 추가하는 방법을 보여줍니다.
customSet := make(precompiletypes.StaticPrecompiles)
// Cast to Maroo's type to access the method
marooSet := types.StaticPrecompiles(customSet)
marooSet.WithOkrwPrecompile(bankKeeper, okrwKeeper, accountKeeper)
// The OKRW precompile is now in the customSet map