pub struct VariableRepositoryContract {
    pub access_control: AccessControl,
    pub repository: Repository,
}
Expand description

Variable Repository Contract.

Fields§

§access_control: AccessControl§repository: Repository

Implementations§

source§

impl VariableRepositoryContract

source

pub fn init( &mut self, fiat_conversion: Address, bid_escrow_wallet: Address, voting_ids: Address )

Constructor function.

§Note

Initializes contract elements:

  • Sets the default configuration of the Repository
  • Sets [caller] as the owner of the contract.
  • Adds [caller] to the whitelist.
§Events
source

pub fn update_at( &mut self, key: String, value: Bytes, activation_time: Option<u64> )

Inserts or updates the value under the given key.

§Note
  • The activation time is represented as a unix timestamp.
  • If the activation time is None the value is updated immediately.
  • If some future time in the future is passed as an argument, the Self::get function returns the previously set value.
§Events
§Errors
source

pub fn get(&self, key: String) -> Option<Bytes>

Returns the value stored under the given key.

If the key does not exist, the None value is returned.

source

pub fn get_full_value(&self, key: String) -> Option<Record>

Returns the full (current and future) value stored under the given key. See Record.

If the key does not exist, the None value is returned.

source

pub fn get_key_at(&self, index: u32) -> Option<String>

Returns the value stored under the given index.

Every freshly added key has the previous key index increased by 1. The index range is 0 to #keys-1.

If the given index exceeds #keys-1 the None value is returned.

source

pub fn keys_count(&self) -> u32

Returns the number of existing keys in the Repository.

source

pub fn all_variables(&self) -> BTreeMap<String, Bytes>

Reads all the stored variables and returns a map key to value.

source

pub fn is_whitelisted(&self, address: Address) -> bool

Checks whether the given address is added to the whitelist. Read more.

source

pub fn get_owner(&self) -> Option<Address>

Returns the address of the current owner. Read more.

source

pub fn propose_new_owner(&mut self, owner: Address)

Changes the ownership of the contract. Transfers ownership to the owner. Only the current owner is permitted to call this method. Read more

source

pub fn accept_new_owner(&mut self)

Accepts the new owner proposition. This can be called only by the proposed owner. Read more

source

pub fn add_to_whitelist(&mut self, address: Address)

Adds a new address to the whitelist. Read more

source

pub fn remove_from_whitelist(&mut self, address: Address)

Remove address from the whitelist. Read more

Trait Implementations§

source§

impl Clone for VariableRepositoryContract

source§

fn clone(&self) -> VariableRepositoryContract

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl DynamicInstance for VariableRepositoryContract

source§

fn instance(namespace: &[u8]) -> Self

source§

impl HasEvents for VariableRepositoryContract

source§

fn events() -> Vec<Event>

source§

impl Node for VariableRepositoryContract

source§

const IS_LEAF: bool = false

source§

const COUNT: u32 = 6u32

source§

fn __keys() -> Vec<String>

source§

impl OdraItem for VariableRepositoryContract

source§

impl StaticInstance for VariableRepositoryContract

source§

fn instance<'a>(keys: &'a [&'a str]) -> (Self, &'a [&'a str])

Consumes keys required to create an instance, returns the instance with the remaining keys.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.