-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NEAR Cross Contract 리서치 #32
Comments
Cross Contract CallContract내에서 배포되어있는 Contract와 Query 또는 Interact 하는 것을 말한다.
구현 예시 // Public - query external greeting
pub fn query_greeting(&self) -> Promise {
// Create a promise to call HelloNEAR.get_greeting()
let promise = hello_near::ext(self.hello_account.clone())
.with_static_gas(Gas(5*TGAS))
.get_greeting();
return promise.then( // Create a promise to callback query_greeting_callback
Self::ext(env::current_account_id())
.with_static_gas(Gas(5*TGAS))
.query_greeting_callback()
)
} call back 예시 #[private] // Public - but only callable by env::current_account_id()
pub fn query_greeting_callback(&self, #[callback_result] call_result: Result<String, PromiseError>) -> String {
// Check if the promise succeeded by calling the method outlined in external.rs
if call_result.is_err() {
log!("There was an error contacting Hello NEAR");
return "".to_string();
}
// Return the greeting
let greeting: String = call_result.unwrap();
greeting
} 구현 주의 사항
주의 사항
참고사항
example실행 시 주의 사항
"hello_account" : "배포되어있는 contact 주소"
--accountId를 자신의 지갑 주소로 변경시 gas fee 빠져나감 [Ref]
TODOfall back 코드 작성시 user에게 deposit 돌려주는 코드 작성 필요. |
금주 개발 준비 기간 팀 배분입니다.
Token 모델 (FT, NFT) (ex. ERC20 link token specification) (준수, 해빈, 경민, 승준, 은성)
Cross-Contract interaction (영호, 병준) (다음 미팅까지)
리서치 방법
The text was updated successfully, but these errors were encountered: