Skip to content

Commit

Permalink
cross contract interface moved to separated file
Browse files Browse the repository at this point in the history
  • Loading branch information
garikbesson committed Aug 7, 2024
1 parent fb271d0 commit 966b9c9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
8 changes: 8 additions & 0 deletions contract-simple-rs/src/external_contract.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use near_sdk::ext_contract;

// Validator interface, for cross-contract calls
#[ext_contract(hello_near)]
trait HelloNear {
fn get_greeting(&self) -> String;
fn set_greeting(&self, greeting: String);
}
10 changes: 1 addition & 9 deletions contract-simple-rs/src/high_level.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
// Find all our documentation at https://docs.near.org
use near_sdk::ext_contract;
use near_sdk::{env, log, near, Promise, PromiseError};

use crate::{Contract, ContractExt, FIVE_TGAS};

// Validator interface, for cross-contract calls
#[ext_contract(hello_near)]
trait HelloNear {
fn get_greeting(&self) -> String;
fn set_greeting(&self, greeting: String);
}
use crate::{Contract, ContractExt, hello_near, FIVE_TGAS};

#[near]
impl Contract {
Expand Down
3 changes: 3 additions & 0 deletions contract-simple-rs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Find all our documentation at https://docs.near.org
use near_sdk::{env, near, AccountId, Gas, PanicOnDefault, NearToken};

pub mod external_contract;
pub use crate::external_contract::*;

pub mod high_level;
pub mod low_level;

Expand Down

0 comments on commit 966b9c9

Please sign in to comment.