Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruseinov committed Feb 11, 2024
1 parent 0fdddc3 commit cd9d44e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions examples/versioned/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use near_sdk::borsh::{BorshDeserialize, BorshSerialize};
use near_sdk::store::FrangibleMap;
use near_sdk::store::UnorderedMap;
use near_sdk::{env, log, near_bindgen, AccountId, NearToken};

/// An example of a versioned contract. This is a simple contract that tracks how much
Expand Down Expand Up @@ -33,7 +33,7 @@ impl VersionedContract {
}
}

fn funders(&self) -> &FrangibleMap<AccountId, NearToken> {
fn funders(&self) -> &UnorderedMap<AccountId, NearToken> {
match self {
Self::V0(contract) => &contract.funders,
Self::V1(contract) => &contract.funders,
Expand All @@ -50,25 +50,25 @@ impl Default for VersionedContract {
#[derive(BorshDeserialize, BorshSerialize)]
#[borsh(crate = "near_sdk::borsh")]
pub struct ContractV0 {
funders: FrangibleMap<AccountId, NearToken>,
funders: UnorderedMap<AccountId, NearToken>,
}

impl Default for ContractV0 {
fn default() -> Self {
Self { funders: FrangibleMap::new(b"f") }
Self { funders: UnorderedMap::new(b"f") }
}
}

#[derive(BorshDeserialize, BorshSerialize)]
#[borsh(crate = "near_sdk::borsh")]
pub struct Contract {
funders: FrangibleMap<AccountId, NearToken>,
funders: UnorderedMap<AccountId, NearToken>,
nonce: u64,
}

impl Default for Contract {
fn default() -> Self {
Self { funders: FrangibleMap::new(b"f"), nonce: 0 }
Self { funders: UnorderedMap::new(b"f"), nonce: 0 }
}
}

Expand Down Expand Up @@ -133,7 +133,7 @@ mod tests {
#[test]
fn contract_v0_interactions() {
let mut contract = {
let mut funders = FrangibleMap::new(b"f");
let mut funders = UnorderedMap::new(b"f");
funders.insert(bob(), NearToken::from_yoctonear(8));
VersionedContract::V0(ContractV0 { funders })
};
Expand Down

0 comments on commit cd9d44e

Please sign in to comment.