From 0268c570896721bae67303df02e654028972482a Mon Sep 17 00:00:00 2001 From: CruzMolina <7537712+CruzMolina@users.noreply.github.com> Date: Thu, 3 Oct 2019 16:01:50 -0700 Subject: [PATCH 1/2] rm hardcoded demo code & originate contracts using params.data (tezos-contract/lib/execute) --- packages/tezos-contract/lib/execute.js | 216 +------------------------ 1 file changed, 2 insertions(+), 214 deletions(-) diff --git a/packages/tezos-contract/lib/execute.js b/packages/tezos-contract/lib/execute.js index 540b1488aad..0e9dbbcb789 100644 --- a/packages/tezos-contract/lib/execute.js +++ b/packages/tezos-contract/lib/execute.js @@ -239,220 +239,8 @@ var execute = { const testParams = { balance: params.value || "0", - code: [ - { prim: "parameter", args: [{ prim: "int" }] }, - { prim: "storage", args: [{ prim: "int" }] }, - { - prim: "code", - args: [ - [ - [], - [], - [], - [ - { - prim: "PUSH", - args: [{ prim: "int" }, { int: "0" }] - }, - [ - [ - [ - [ - { - prim: "DIP", - args: [[{ prim: "DUP" }]] - }, - { prim: "SWAP" } - ], - { prim: "DIP", args: [[[]]] } - ], - { prim: "CAR" } - ], - [ - [ - [ - [ - { - prim: "DIP", - args: [ - [ - [ - { - prim: "DIP", - args: [[{ prim: "DUP" }]] - }, - { prim: "SWAP" } - ] - ] - ] - }, - { prim: "SWAP" } - ], - { prim: "DIP", args: [[[]]] } - ], - { prim: "CDR" } - ], - [ - [ - [], - [ - { - prim: "DIP", - args: [[{ prim: "DUP" }]] - }, - { prim: "SWAP" } - ], - [], - { - prim: "DIP", - args: [ - [ - [ - { - prim: "DIP", - args: [ - [ - [ - { - prim: "DIP", - args: [ - [ - { - prim: "DUP" - } - ] - ] - }, - { prim: "SWAP" } - ] - ] - ] - }, - { prim: "SWAP" } - ] - ] - ] - }, - [], - { - prim: "DIP", - args: [[{ prim: "DROP" }]] - }, - [], - [ - { prim: "SWAP" }, - { - prim: "DIP", - args: [ - [ - [ - { prim: "SWAP" }, - { - prim: "DIP", - args: [ - [ - { - prim: "DIP", - args: [ - [ - { - prim: "DROP" - } - ] - ] - } - ] - ] - } - ] - ] - ] - } - ], - [], - { - prim: "PUSH", - args: [{ prim: "unit" }, { prim: "Unit" }] - } - ], - { prim: "DROP" }, - [ - [ - { - prim: "NIL", - args: [{ prim: "operation" }] - }, - { - prim: "DIP", - args: [ - [ - [ - [ - { - prim: "DIP", - args: [ - [ - [ - { - prim: "DIP", - args: [ - [ - { - prim: "DUP" - } - ] - ] - }, - { - prim: "SWAP" - } - ] - ] - ] - }, - { prim: "SWAP" } - ], - { - prim: "DIP", - args: [[[]]] - } - ] - ] - ] - } - ], - { prim: "PAIR" } - ] - ], - [], - { - prim: "DIP", - args: [[{ prim: "DROP" }]] - } - ], - [], - { - prim: "DIP", - args: [[{ prim: "DROP" }]] - } - ], - [], - { - prim: "DIP", - args: [[{ prim: "DROP" }]] - } - ], - [], - { - prim: "DIP", - args: [[{ prim: "DROP" }]] - }, - [] - ] - ] - } - ], - init: `${params.arguments}`, // { int: "0" }, // TODO: robust encoding/decoding of deployer params from migration scripts + code: params.data, + init: `${params.arguments}`, // TODO: robust encoding/decoding of deployer params from migration scripts fee: 500000, storageLimit: 50000, gasLimit: 800000 From a5787c1f620544f702fd585f03946b23056bcaf2 Mon Sep 17 00:00:00 2001 From: CruzMolina <7537712+CruzMolina@users.noreply.github.com> Date: Thu, 3 Oct 2019 16:02:27 -0700 Subject: [PATCH 2/2] rename testParams to originateParams (tezos-contract/lib/execute) --- packages/tezos-contract/lib/execute.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/tezos-contract/lib/execute.js b/packages/tezos-contract/lib/execute.js index 0e9dbbcb789..f962dc1dec5 100644 --- a/packages/tezos-contract/lib/execute.js +++ b/packages/tezos-contract/lib/execute.js @@ -237,7 +237,7 @@ var execute = { contract: constructor }); - const testParams = { + const originateParams = { balance: params.value || "0", code: params.data, init: `${params.arguments}`, // TODO: robust encoding/decoding of deployer params from migration scripts @@ -246,7 +246,7 @@ var execute = { gasLimit: 800000 }; - deferred = web3.tez.contract.originate(testParams); + deferred = web3.tez.contract.originate(originateParams); try { const receipt = await deferred;