Skip to content

Commit

Permalink
Update README.md (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
decanus authored Jun 19, 2021
1 parent 8983c53 commit a964962
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Weiroll programs consist of a sequence of delegatecalls to library functions in

The easiest way to do this is by wrapping ethers.js contract instances:

```
```javascript
const ethersContract = new ethers.Contract(address, abi);
const contract = weiroll.Contract.fromEthersContract(ethersContract);
```
Expand All @@ -25,26 +25,26 @@ You can repeat this for each library contract you wish to use. A weiroll `Contra
### Planning programs
First, instantiate a planner:

```
```javascript
const planner = new weiroll.Planner();
```

Next, add one or more commands to execute:

```
const ret = planner.addCommand(contract.func(a, b));
```javascript
const ret = planner.add(contract.func(a, b));
```

Return values from one invocation can be used in another one:

```
planner.addCommand(contract.func2(ret));
```javascript
planner.add(contract.func2(ret));
```

Remember to wrap each call to a contract in `planner.addCommand`. Attempting to pass the result of one contract function directly to another will not work - each one needs to be added to the planner!
Remember to wrap each call to a contract in `planner.add`. Attempting to pass the result of one contract function directly to another will not work - each one needs to be added to the planner!

Once you are done planning operations, generate the program:

```
```javascript
const {commands, state} = planner.plan();
```

0 comments on commit a964962

Please sign in to comment.