StaticPrecompiles.WithPclPrecompile
(s StaticPrecompiles) WithPclPrecompile(bankKeeper, pclKeeper) StaticPrecompiles 이 메서드는 PCL(프로그래밍 가능 규정 준수 계층) 프리컴파일을 StaticPrecompiles 맵에 추가합니다. 프리컴파일을 인스턴스화하고, 필요한 키퍼 의존성을 주입하며, 지정된 온체인 주소에 등록합니다. 이는 전체 프리컴파일 세트를 구성하는 데 사용되는 빌더 패턴의 일부입니다.
파라미터
| 이름 | 타입 | 필수 | 설명 |
|---|---|---|---|
s | StaticPrecompiles | ✓ | 리시버; PCL 프리컴파일이 추가될 프리컴파일 맵입니다. |
bankKeeper | cmn.BankKeeper | ✓ | 토큰 전송을 포함할 수 있는 특정 규정 준수 확인에 사용되는 x/bank 모듈 키퍼입니다. |
pclKeeper | *pclkeeper.Keeper | ✓ | 정책 템플릿, 계약 정책 등록 및 시뮬레이션 엔진에 접근하는 데 사용되는 x/pcl 모듈 키퍼입니다. |
반환값
타입:
StaticPrecompiles 메서드 체이닝을 허용하기 위해 이제 PCL 프리컴파일을 포함하는 수정된 StaticPrecompiles 맵을 반환합니다.
예제
연쇄 호출
이 예시는 `DefaultStaticPrecompiles` 내에서 의도된 사용법을 보여줍니다. 메서드를 연쇄적으로 호출하여 마루 전용 프리컴파일의 최종 세트를 구성합니다.
marooPrecompiles := StaticPrecompiles(precompiles).
WithOkrwPrecompile(bankKeeper, okrwKeeper, accountKeeper).
WithPclPrecompile(bankKeeper, pclKeeper) 수동 구성
이 예시는 개발자가 새롭고 비어있는 프리컴파일 맵에 PCL 프리컴파일만 수동으로 추가하는 방법을 보여줍니다.
customSet := make(precompiletypes.StaticPrecompiles)
// Cast to Maroo's type to access the method
marooSet := types.StaticPrecompiles(customSet)
marooSet.WithPclPrecompile(bankKeeper, pclKeeper)
// The PCL precompile is now in the customSet map