Skip to main content

NonnegativeIntSetAdd

Function NonnegativeIntSetAdd 

Source
pub fn NonnegativeIntSetAdd(
    key: &StorageKeyContractData,
    set_value: Option<&i128>,
    add_value: &i128,
) -> Result<(), SysErr>
Expand description

Sets or modifies a nonnegative integer at the specified storage key. The set_value (if provided) sets the base value, and add_value is added as a delta. The final value must remain nonnegative. Will overwrite any value of that key, even if that value has a different type.

§Arguments

  • key
  • set_value
  • add_value

This is a convenience wrapper around uninit_NonnegativeIntSetAdd that returns the result as SyscallResult<T>.

§Errors

  • kSyscallErrorCodeInvalidSyscallInput: The operation would always result in a negative value (i.e. set_add(1, -2)).