Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms https://framework.embarklabs.io/
Go to file
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
.github
dapps fix(@embark/ens): don't change shape of Smart Contract args in action hooks 2019-11-11 14:01:48 -05:00
packages fix(@embark/ens): don't change shape of Smart Contract args in action hooks 2019-11-11 14:01:48 -05:00
scripts build: phase 1 of introducing embark-collective 2019-10-01 13:28:13 -05:00
site refactor(@embark/library-manager): restrict versionable packages to only solc 2019-11-08 11:27:20 -06:00
.editorconfig
.eslintrc.json refactor(@embark/library-manager): restrict versionable packages to only solc 2019-11-08 11:27:20 -06:00
.gitattributes build: `* text=auto` -> `* text=auto eol=lf` 2019-09-15 15:17:45 -05:00
.gitignore build: `* text=auto` -> `* text=auto eol=lf` 2019-09-15 15:17:45 -05:00
.npmrc
.yarnrc
CHANGELOG.md chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
CODE_OF_CONDUCT.md
CONTRIBUTING.md docs(contributing): Update the syntax of the header and scope 2019-03-22 13:27:46 -04:00
LICENSE
README.md docs: move root readme into packages/embark and symlink into root 2019-05-21 12:12:15 +02:00
azure-pipelines.yml build: bump all packages' engines settings (#1985) 2019-10-24 09:52:05 -04:00
babel.config.js refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
header.jpg docs: update header image for root README 2019-04-04 12:59:24 -04:00
lerna.json chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
package.json build(deps-dev): satisfy eslint peer dependency in monorepo root 2019-11-08 14:57:56 -06:00
tsconfig.json refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
tslint.json refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
yarn.lock refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00

README.md

Embark

npm Gitter Build Status Open PRs Closed PRs GitHub commit activity the past week, 4 weeks, year Coverage Status Dependabot Status

What is Embark

Embark is a framework that allows you to easily develop and deploy Decentralized Applications (DApps).

A Decentralized Application is a serverless html5 application that uses one or more decentralized technologies.

Embark currently integrates with EVM blockchains (Ethereum), Decentralized Storages (IPFS), and Decentralized communication platforms (Whisper and Orbit). Swarm is supported for deployment.

With Embark you can:

Blockchain (Ethereum)

  • Automatically deploy contracts and make them available in your JS code. Embark watches for changes, and if you update a contract, Embark will automatically redeploy the contracts (if needed) and the dapp.
  • Contracts are available in JS with Promises.
  • Do Test Driven Development with Contracts using Javascript.
  • Keep track of deployed contracts; deploy only when truly needed.
  • Manage different chains (e.g testnet, private net, livenet)
  • Easily manage complex systems of interdependent contracts.

Decentralized Storage (IPFS, Swarm)

  • Easily Store & Retrieve Data on the DApp through EmbarkJS. Including uploading and retrieving files.
  • Deploy the full application to IPFS or Swarm.
  • Import and deploy contracts hosted on Swarm.

Decentralized Communication (Whisper, Orbit)

  • Easily send/receive messages through channels in P2P through Whisper or Orbit.

Web Technologies

  • Integrate with any web technology including React, Foundation, etc..
  • Use any build pipeline or tool you wish, including grunt, gulp and webpack.
$ npm -g install embark

See Complete Documentation.