Skip to content

Commit

Permalink
add missing object function (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 authored Aug 26, 2024
1 parent da7d256 commit 9100f94
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
Binary file modified precompile/binaries/minlib/object.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/object.mv
Binary file not shown.
5 changes: 5 additions & 0 deletions precompile/modules/initia_stdlib/sources/object.move
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ module initia_std::object {
exists<ObjectCore>(object)
}

/// Returns true if there exists an object with resource T.
public fun object_exists<T: key>(object: address): bool {
exists<ObjectCore>(object) && exists_at<T>(object)
}

/// Derives an object address from source material: sha3_256([creator address | seed | 0xFE]).
public fun create_object_address(source: &address, seed: vector<u8>): address {
let bytes = bcs::to_bytes(source);
Expand Down
5 changes: 5 additions & 0 deletions precompile/modules/minitia_stdlib/sources/object.move
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ module minitia_std::object {
exists<ObjectCore>(object)
}

/// Returns true if there exists an object with resource T.
public fun object_exists<T: key>(object: address): bool {
exists<ObjectCore>(object) && exists_at<T>(object)
}

/// Derives an object address from source material: sha3_256([creator address | seed | 0xFE]).
public fun create_object_address(source: &address, seed: vector<u8>): address {
let bytes = bcs::to_bytes(source);
Expand Down

0 comments on commit 9100f94

Please sign in to comment.