add unit tests

pull/2813/head
yann300 2 years ago committed by Aniket
parent 2581a96549
commit 01298a07b4
  1. 4
      libs/remix-lib/src/execution/txListener.ts
  2. 8
      libs/remix-lib/src/util.ts
  3. 1
      libs/remix-lib/test/data/ERC721.ts
  4. 1
      libs/remix-lib/test/data/sampleERC721.ts
  5. 24
      libs/remix-lib/test/util.ts

@ -2,7 +2,7 @@
import { ethers } from 'ethers'
import { toBuffer, addHexPrefix } from 'ethereumjs-util'
import { EventManager } from '../eventManager'
import { compareByteCode } from '../util'
import { compareByteCode, getinputParameters } from '../util'
import { decodeResponse } from './txFormat'
import { getFunction, getReceiveInterface, getConstructorInterface, visitContracts, makeFullTypeDefinition } from './txHelper'
@ -352,7 +352,7 @@ export class TxListener {
const bytecode = contract.object.evm.bytecode.object
let params = null
if (bytecode && bytecode.length) {
params = this._decodeInputParams(inputData.substring(bytecode.length), getConstructorInterface(abi))
params = this._decodeInputParams(getinputParameters(inputData), getConstructorInterface(abi))
}
this._resolvedTransactions[tx.hash] = {
contractName: contract.name,

@ -208,6 +208,14 @@ export function extractinputParameters (value) {
return value.replace(inputParametersExtraction(), '')
}
export function getinputParameters (value) {
const regex = value.match(inputParametersExtraction())
if (regex && regex[1]) {
return regex[1]
} else
return ''
}
/**
* Compare bytecode. return true if the code is equal (handle swarm hash and library references)
* @param {String} code1 - the bytecode that is actually deployed (contains resolved library reference and a potentially different swarmhash)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save