From fa657d347ebc38041ff2530d43bc7b7dca30cef0 Mon Sep 17 00:00:00 2001 From: Francisco Giordano Date: Mon, 7 Jun 2021 16:03:45 -0300 Subject: [PATCH] fix storage location for constructor arguments --- CHANGELOG.md | 4 ++++ contracts/Test.sol | 4 ++++ src/core.test.ts.md | 4 ++++ src/core.test.ts.snap | Bin 623 -> 656 bytes src/core.ts | 2 +- 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e13df64..31ee1d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.1.4 + +- Fix storage location for constructor arguments. + ## 0.1.3 - Fix functions with enum and contract arguments. diff --git a/contracts/Test.sol b/contracts/Test.sol index abb76f7..77698cf 100644 --- a/contracts/Test.sol +++ b/contracts/Test.sol @@ -84,3 +84,7 @@ contract Types { function _testContractType(Types t) internal {} function _testMappingType(mapping (uint => uint) storage m) internal {} } + +contract ConstructorStorageLocation { + constructor(string memory name) {} +} diff --git a/src/core.test.ts.md b/src/core.test.ts.md index 55f1272..a6e1d35 100644 --- a/src/core.test.ts.md +++ b/src/core.test.ts.md @@ -141,4 +141,8 @@ Generated by [AVA](https://avajs.dev). return super._testContractType(t);␊ }␊ }␊ + ␊ + contract XConstructorStorageLocation is ConstructorStorageLocation {␊ + constructor(string memory name) ConstructorStorageLocation(name) {}␊ + }␊ ` diff --git a/src/core.test.ts.snap b/src/core.test.ts.snap index f164b995a997b0a8f1e46d1a00c9f579c1259d95..950f608a606c743981e44b2ebe104e1e8156873e 100644 GIT binary patch literal 656 zcmV;B0&o36RzV=Og57^keyv-W^Iy^ck&%dUqJE3 z3lVR;6<nq$)0n*@0)WDGXcx8D%M5y)7RR^50~G+ZGZXvWA>|J zsr7ryvhG_CwOx5&ZQuL3Rj-40e0aLkB|fGc?{xZ@3Nj#=J%u+%-A=20#u{D`htWM#&3nhk>S#b#{x5oMi9je1H&R_l!Fr!DjHArYbl^w zi4S-j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z$&KY*3mY0l*`-VAalN3LtktwKJ?kqL6OQE84_dlYG J{q~Ow002;VEDHbt diff --git a/src/core.ts b/src/core.ts index ea422dc..2a346ee 100644 --- a/src/core.ts +++ b/src/core.ts @@ -139,7 +139,7 @@ function makeConstructor(contract: ContractDefinition, contractMap: ContractMap) const args = []; for (const a of getConstructor(c)!.parameters.parameters) { const name = missingArguments.has(a.name) ? `${c.name}_${a.name}` : a.name; - const type = getType(a, 'calldata'); + const type = getType(a, 'memory'); missingArguments.set(name, type); args.push(name); }