Module sui::borrow
A simple library that enables hot-potato-locked borrow mechanics.
With Programmable transactions, it is possible to borrow a value within a transaction, use it and put back in the end. Hot-potato Borrow makes sure the object is returned and was not swapped for another one.
use std::ascii;
use std::bcs;
use std::option;
use std::string;
use std::vector;
use sui::address;
use sui::hex;
use sui::object;
use sui::tx_context;
Struct Referent
An object wrapping a T and providing the borrow API.
public struct Referent<T: key, store> has store
Click to open
Fields
- id: address
- value: std::option::Option<T>
Struct Borrow
A hot potato making sure the object is put back once borrowed.
public struct Borrow
Click to open
Fields
- ref: address
- obj: sui::object::ID