embark/packages/plugins
Pascal Precht b4478a9c46 fix(@embark/ens): don't change shape of Smart Contract args in action hooks
This commit fixes the issue that it wasn't possible anymore to use named constructor arguments
in Smart Contract configurations.

For example, the following Smart Contract expects two constructor arguments:

```solidity
contract SomeContract {
  constructor(address[] _addresses, int initialValue) public {}
}
```

The first being a list of addresses, the second one a number. This can be configured as:

```js
SomeContract: {
  args: [
    ["$MyToken2", "$SimpleStorage"],
    123
  ]
}
```

Notice how the order of arguments matters here. `_addresses` come first in the constructor,
so they have to be defined first in the configuration as well.

Another way to configure this is using named arguments, which is what's broken prior to this commit:

```js
SomeContract: {
  args: {
    initialValue: 123,
    _addresses: ["$MyToken2", "$SimpleStorage"]
  }
}
```

Using a notation like this ^ the order no longer matters as Embark will figure out the right
values for the constructor arguments by their names.

The reason this is broken is because there are several modules in Embark that register and
run a `deployment:contract:beforeDeploy` action, which are allowed to mutate this configuration
object. One of those modules is the `ens` module, which searches for ENS names in the arguments
and figure out whether it has to replace it with a resolved address.

One thing that particular module didn't take into account is that `args` could be either and
array, or an object and will always return an array, changing the shape of `args` in case it was
an object.

This is a problem because another module, `ethereum-blockchain-client`, another action is registered
that takes this mutated object in `determineArguments()` and ensure that, if `args` is actually an
object, the values are put in the correct position matching the constructor of the Smart Contract in
question.

One way to solve this was to use the newly introduced [priority](https://github.com/embark-framework/embark/pull/2031) and ensure
that `ens` action is executed after `ethereum-blockchain-client`'s.

However, the actual bug here is that the ENS module changes the shape of `args` in the first place,
so this commit ensures that it preserves it.
2019-11-11 14:01:48 -05:00
..
accounts-manager refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
basic-pipeline chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
coverage chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
debugger refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
deploy-tracker refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
ens fix(@embark/ens): don't change shape of Smart Contract args in action hooks 2019-11-11 14:01:48 -05:00
ethereum-blockchain-client chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
ganache chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
geth refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
graph chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
ipfs chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
mocha-tests chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
parity refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
plugin-cmd chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
profiler chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
scaffolding refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
snark chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
solc chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
solidity chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
solidity-tests build(deps): bump remix-tests from 0.1.14 to 0.1.20 2019-11-08 11:12:43 -06:00
specialconfigs chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
swarm chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
transaction-logger chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
transaction-tracker chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
vyper chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
web3 feat(@embark/plugin): add priority to regsiterActionForEvents 2019-11-08 08:46:32 -05:00
whisper chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
.gitignore build: tidy up the monorepo in prep for v5.0.0-alpha.0 2019-10-01 13:29:53 -05:00