IChainStorageContainer.md 2.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# IChainStorageContainer



> IChainStorageContainer





## Methods

### deleteElementsAfterInclusive

15 16 17 18
```solidity
function deleteElementsAfterInclusive(uint256 _index) external nonpayable
```

Indeavr's avatar
Indeavr committed
19
Removes all objects after and including a given index. Also allows setting the global metadata field.
20 21 22 23 24 25 26 27 28



#### Parameters

| Name | Type | Description |
|---|---|---|
| _index | uint256 | Object index to delete from.

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
### get

```solidity
function get(uint256 _index) external view returns (bytes32)
```

Retrieves an object from the container.



#### Parameters

| Name | Type | Description |
|---|---|---|
| _index | uint256 | Index of the particular object to access.

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bytes32 | 32 byte object value.

### getGlobalMetadata

```solidity
function getGlobalMetadata() external view returns (bytes27)
```

Retrieves the container's global metadata field.




#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bytes27 | Container global metadata field.

### length

```solidity
function length() external view returns (uint256)
```

Retrieves the number of objects stored in the container.




#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint256 | Number of objects in the container.

### push

87 88 89 90
```solidity
function push(bytes32 _object) external nonpayable
```

Indeavr's avatar
Indeavr committed
91
Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the "length" storage slot anyway, which also contains the global metadata (it's an optimization).
92 93 94 95 96 97 98 99 100



#### Parameters

| Name | Type | Description |
|---|---|---|
| _object | bytes32 | A 32 byte value to insert into the container.

101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
### setGlobalMetadata

```solidity
function setGlobalMetadata(bytes27 _globalMetadata) external nonpayable
```

Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data.



#### Parameters

| Name | Type | Description |
|---|---|---|
| _globalMetadata | bytes27 | New global metadata to set.