-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
266 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
use cosmwasm_std::Storage; | ||
use cw_storage_plus::Map; | ||
|
||
use super::node::TreeNode; | ||
use crate::error::ContractResult; | ||
|
||
use super::node::{TreeNode, NODES}; | ||
|
||
// TODO: REMOVE | ||
#[allow(dead_code)] | ||
pub const TREE: Map<&(u64, i64), TreeNode> = Map::new("tree"); | ||
pub const TREE: Map<&(u64, i64), u64> = Map::new("tree"); | ||
|
||
pub fn get_root_node( | ||
storage: &dyn Storage, | ||
book_id: u64, | ||
tick_id: i64, | ||
) -> ContractResult<TreeNode> { | ||
let root_id = TREE.load(storage, &(book_id, tick_id))?; | ||
Ok(NODES.load(storage, &(book_id, tick_id, root_id))?) | ||
} |