Skip to content

Commit

Permalink
Fix stateMutability calculation for constructors (#762).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Apr 4, 2020
1 parent 6caf7c2 commit d7c8b35
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ Changelog

This change log is managed by `scripts/cmds/update-versions` but may be manually updated.

ethers/v5.0.0-beta.180 (2020-04-03 21:40)
-----------------------------------------

- Correctly return the Provider in NonceManager. ([6caf7c2](https://github.com/ethers-io/ethers.js/commit/6caf7c292cd5f03741cd6b30053c3325c4f30a81))
- Fail earlier when resolving an ENS name that is not a string. ([2882546](https://github.com/ethers-io/ethers.js/commit/28825463517f8821392464ec2283ee59c431d928))
- Fixed mutabilityState calculation for function fragments. ([#762](https://github.com/ethers-io/ethers.js/issues/762); [6526de0](https://github.com/ethers-io/ethers.js/commit/6526de016fda5403474dad61ee59acc62ee25ebc))
- Force Log properties to be non-optional. ([#415](https://github.com/ethers-io/ethers.js/issues/415); [da412f6](https://github.com/ethers-io/ethers.js/commit/da412f660723d1c411484e74970ce4eb166374c2))
- Fixed Signer call not forwarding blockTag. ([#768](https://github.com/ethers-io/ethers.js/issues/768); [053a2d7](https://github.com/ethers-io/ethers.js/commit/053a2d7fcdb4ca4c9bfd0bee0f42e0187d3db477))

ethers/v5.0.0-beta.179 (2020-03-31 23:40)
-----------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions packages/abi/src.ts/fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ function verifyState(value: any): { constant: boolean, payable: boolean, stateMu
result.payable = !!value.payable;

// If payable we can assume non-constant; otherwise we can't assume
if (value.constant == null && !result.payable) {
if (value.constant == null && !result.payable && value.type !== "constructor") {
throw new Error("unable to determine stateMutability");
}

Expand All @@ -648,7 +648,7 @@ function verifyState(value: any): { constant: boolean, payable: boolean, stateMu
result.payable = !result.constant;
result.stateMutability = (result.constant ? "view": "payable");

} else {
} else if (value.type !== "constructor") {
throw new Error("unable to determine stateMutability");
}

Expand Down

0 comments on commit d7c8b35

Please sign in to comment.