Skip to content

Commit

Permalink
Added u8 array
Browse files Browse the repository at this point in the history
  • Loading branch information
BlobMaster41 committed Dec 29, 2024
1 parent 1526b7e commit 951e70a
Show file tree
Hide file tree
Showing 14 changed files with 571 additions and 44 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@btc-vision/btc-runtime",
"version": "1.3.18",
"version": "1.3.19",
"description": "Bitcoin Smart Contract Runtime",
"main": "btc/index.ts",
"scripts": {
Expand Down
26 changes: 15 additions & 11 deletions runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,26 @@ export * from './memory/Uint8ArrayMerger';
/** Storage */
export * from './storage/StoredU256';
export * from './storage/StoredU64';
export * from './storage/StoredU16Array';
export * from './storage/StoredU32Array';
export * from './storage/StoredBooleanArray';
export * from './storage/StoredU128Array';
export * from './storage/StoredU256Array';
export * from './storage/StoredString';
export * from './storage/StoredAddress';
export * from './storage/StoredBoolean';
export * from './storage/Serializable';
export * from './storage/StoredAddressArray';

export * from './storage/StorageBacked';
export * from './storage/StorageSlot';
export * from './storage/StorageStruct';
export * from './storage/StorageLayout';
export * from './storage/StorageValue';
/** Arrays */
export * from './storage/arrays/StoredAddressArray';
export * from './storage/arrays/StoredU8Array';
export * from './storage/arrays/StoredU16Array';
export * from './storage/arrays/StoredU32Array';
export * from './storage/arrays/StoredBooleanArray';
export * from './storage/arrays/StoredU128Array';
export * from './storage/arrays/StoredU256Array';

/** Storage Utils */
export * from './storage/utils/StorageBacked';
export * from './storage/utils/StorageSlot';
export * from './storage/utils/StorageStruct';
export * from './storage/utils/StorageLayout';
export * from './storage/utils/StorageValue';

/** Shared libraries */
export * from './shared-libraries/TransferHelper';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { u256 } from '@btc-vision/as-bignum/assembly';
import { BytesWriter } from '../buffer/BytesWriter';
import { Blockchain } from '../env';
import { Address } from '../types/Address';
import { Revert } from '../types/Revert';
import { SafeMath } from '../types/SafeMath';
import { BytesWriter } from '../../buffer/BytesWriter';
import { Blockchain } from '../../env';
import { Address } from '../../types/Address';
import { Revert } from '../../types/Revert';
import { SafeMath } from '../../types/SafeMath';

/**
* @class StoredAddressArray
Expand Down Expand Up @@ -35,7 +35,11 @@ export class StoredAddressArray {
* @param {Uint8Array} subPointer - The sub-pointer for memory slot addressing.
* @param {Address} defaultValue - The default Address value if storage is uninitialized.
*/
constructor(public pointer: u16, public subPointer: Uint8Array, private defaultValue: Address) {
constructor(
public pointer: u16,
public subPointer: Uint8Array,
private defaultValue: Address,
) {
// Initialize the base pointer
const writer = new BytesWriter(32);
writer.writeU16(pointer);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { u256 } from '@btc-vision/as-bignum/assembly';
import { BytesWriter } from '../buffer/BytesWriter';
import { Blockchain } from '../env';
import { Revert } from '../types/Revert';
import { SafeMath } from '../types/SafeMath';
import { BytesWriter } from '../../buffer/BytesWriter';
import { Blockchain } from '../../env';
import { Revert } from '../../types/Revert';
import { SafeMath } from '../../types/SafeMath';

/**
* @class StoredBooleanArray
Expand Down Expand Up @@ -33,7 +33,11 @@ export class StoredBooleanArray {
* @param {Uint8Array} subPointer - The sub-pointer for memory slot addressing.
* @param {u256} defaultValue - The default u256 value if storage is uninitialized.
*/
constructor(public pointer: u16, public subPointer: Uint8Array, private defaultValue: u256) {
constructor(
public pointer: u16,
public subPointer: Uint8Array,
private defaultValue: u256,
) {
// Initialize the base u256 pointer using the primary pointer and subPointer
const writer = new BytesWriter(32);
writer.writeU16(pointer);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { u128, u256 } from '@btc-vision/as-bignum/assembly';
import { Blockchain } from '../env';
import { BytesWriter } from '../buffer/BytesWriter';
import { SafeMath } from '../types/SafeMath';
import { Revert } from '../types/Revert';
import { Blockchain } from '../../env';
import { BytesWriter } from '../../buffer/BytesWriter';
import { SafeMath } from '../../types/SafeMath';
import { Revert } from '../../types/Revert';

/**
* @class StoredU128Array
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { u256 } from '@btc-vision/as-bignum/assembly';
import { Blockchain } from '../env';
import { BytesWriter } from '../buffer/BytesWriter';
import { SafeMath } from '../types/SafeMath';
import { Revert } from '../types/Revert';
import { Blockchain } from '../../env';
import { BytesWriter } from '../../buffer/BytesWriter';
import { SafeMath } from '../../types/SafeMath';
import { Revert } from '../../types/Revert';

/**
* @class StoredU16Array
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { u256 } from '@btc-vision/as-bignum/assembly';
import { Blockchain } from '../env';
import { BytesWriter } from '../buffer/BytesWriter';
import { SafeMath } from '../types/SafeMath';
import { Revert } from '../types/Revert';
import { Blockchain } from '../../env';
import { BytesWriter } from '../../buffer/BytesWriter';
import { SafeMath } from '../../types/SafeMath';
import { Revert } from '../../types/Revert';

/**
* @class StoredU256Array
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { u256 } from '@btc-vision/as-bignum/assembly';
import { Blockchain } from '../env';
import { BytesWriter } from '../buffer/BytesWriter';
import { SafeMath } from '../types/SafeMath';
import { Revert } from '../types/Revert';
import { Blockchain } from '../../env';
import { BytesWriter } from '../../buffer/BytesWriter';
import { SafeMath } from '../../types/SafeMath';
import { Revert } from '../../types/Revert';

/**
* @class StoredU32Array
Expand Down
Loading

0 comments on commit 951e70a

Please sign in to comment.