From 7decb503eb3ac84a621729bc3d566a6f688aa028 Mon Sep 17 00:00:00 2001 From: Stefanie Doll Date: Tue, 23 Jun 2020 10:51:10 +0200 Subject: [PATCH] Remove deprecated ext_ functions and add gas as parameter to ext_gas_price --- packages/as-contracts/assembly/env.ts | 17 +---------------- packages/as-contracts/assembly/lib/contract.ts | 6 ++---- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/packages/as-contracts/assembly/env.ts b/packages/as-contracts/assembly/env.ts index a9bad98..819b9a7 100644 --- a/packages/as-contracts/assembly/env.ts +++ b/packages/as-contracts/assembly/env.ts @@ -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( diff --git a/packages/as-contracts/assembly/lib/contract.ts b/packages/as-contracts/assembly/lib/contract.ts index 840a3e4..69878d6 100644 --- a/packages/as-contracts/assembly/lib/contract.ts +++ b/packages/as-contracts/assembly/lib/contract.ts @@ -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 @@ -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(); }