Skip to content

Commit

Permalink
merge pull master
Browse files Browse the repository at this point in the history
  • Loading branch information
austinabell committed Nov 29, 2021
1 parent a323ba8 commit b833d9f
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- Fix codegen for methods inside a `#[near_bindgen]` to allow using `mut self` which will generate the same code as `self` and will not persist state. [PR 616](https://github.com/near/near-sdk-rs/pull/616).
- Make function call terminology consistent by switching from method name usages. [PR 633](https://github.com/near/near-sdk-rs/pull/633).
- This is only a breaking change if inspecting the `VmAction`s of receipts in mocked environments. All other changes are positional argument names.
- Add consts for near, yocto, and tgas. [PR 640](https://github.com/near/near-sdk-rs/pull/640).
- `near_sdk::ONE_NEAR`, `near_sdk::ONE_YOCTO`, `near_sdk::Gas::ONE_TERA`

## `4.0.0-pre.4` [10-15-2021]
- Unpin `syn` dependency in macros from `=1.0.57` to be more composable with other crates. [PR 605](https://github.com/near/near-sdk-rs/pull/605)
Expand Down
Binary file modified examples/callback-results/res/callback_results.wasm
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified examples/fungible-token/res/defi.wasm
Binary file not shown.
Binary file modified examples/fungible-token/res/fungible_token.wasm
Binary file not shown.
Binary file modified examples/non-fungible-token/res/approval_receiver.wasm
Binary file not shown.
Binary file modified examples/non-fungible-token/res/non_fungible_token.wasm
Binary file not shown.
Binary file modified examples/non-fungible-token/res/token_receiver.wasm
Binary file not shown.
4 changes: 2 additions & 2 deletions near-sdk/src/store/lazy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ where
T: BorshSerialize,
{
/// Key bytes to index the contract's storage.
storage_key: Vec<u8>,
storage_key: Box<[u8]>,
#[borsh_skip]
/// Cached value which is lazily loaded and deserialized from storage.
cache: OnceCell<CacheEntry<T>>,
Expand All @@ -81,7 +81,7 @@ where
S: IntoStorageKey,
{
Self {
storage_key: key.into_storage_key(),
storage_key: key.into_storage_key().into_boxed_slice(),
cache: OnceCell::from(CacheEntry::new_modified(Some(value))),
}
}
Expand Down
5 changes: 5 additions & 0 deletions near-sdk/src/types/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
#[repr(transparent)]
pub struct Gas(pub u64);

impl Gas {
/// One Tera gas, which is 10^12 gas units.
pub const ONE_TERA: Gas = Gas(1_000_000_000_000);
}

impl Serialize for Gas {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
Expand Down
6 changes: 6 additions & 0 deletions near-sdk/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ pub type Timestamp = u64;

/// Raw type for 32 bytes of the hash.
pub type CryptoHash = [u8; 32];

/// Balance of one Yocto NEAR, which is the smallest denomination. This value is 10^-24 of one NEAR.
pub const ONE_YOCTO: Balance = 1;

/// Balance of one NEAR, which is 10^24 Yocto NEAR.
pub const ONE_NEAR: Balance = 1_000_000_000_000_000_000_000_000;

0 comments on commit b833d9f

Please sign in to comment.