Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #5 from paritytech/sd-implement-upcoming-api-changes
Browse files Browse the repository at this point in the history
Remove deprecated ext_ functions and add gas as parameter to ext_gas_…
  • Loading branch information
Stefie authored Jun 23, 2020
2 parents 679c5ff + 7decb50 commit 1759b14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
17 changes: 1 addition & 16 deletions packages/as-contracts/assembly/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,11 @@ export declare function ext_deposit_event(
data_len: i32
): void;

// Decodes the given buffer as a `T::Call` and adds it to the list
// of to-be-dispatched calls.
export declare function ext_dispatch_call(
call_ptr: i32,
call_len: i32
): void;

// Stores the amount of gas left into the scratch buffer.
export declare function ext_gas_left(): void;

// Stores the gas price for the current transaction into the scratch buffer.
export declare function ext_gas_price(): void;

// Retrieve the value under the given key from the **runtime** storage and return 0.
// If there is no entry under the given key then this function will return 1 and
// clear the scratch buffer.
export declare function ext_get_runtime_storage(
key_ptr: i32,
key_len: i32
): void;
export declare function ext_gas_price(gas: u64,): void;

// Retrieve the value under the given key from the storage or return 0.
export declare function ext_get_storage(
Expand Down
6 changes: 2 additions & 4 deletions packages/as-contracts/assembly/lib/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { numberToBytes } from '@substrate/as-utils';
// import {
// ext_call,
// ext_deposit_event,
// ext_dispatch_call,
// ext_get_runtime_storage,
// ext_instantiate,
// ext_restore_to,
// ext_return
Expand Down Expand Up @@ -90,8 +88,8 @@ export namespace contract {
* @description
* Returns the gas price for the current transaction.
*/
export function getGasPrice(): Uint8Array {
ext_gas_price();
export function getGasPrice(gas: u64): Uint8Array {
ext_gas_price(gas);
return storage.getScratchBuffer();
}

Expand Down

0 comments on commit 1759b14

Please sign in to comment.