Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: updates changeset
  • Loading branch information
balajipachai committed Jun 1, 2023
commit d2811937f7d535556db9582902c96f72e8382012
39 changes: 1 addition & 38 deletions .changeset/big-plums-cover.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,4 @@
---
'openzeppelin-solidity': major
---

Replaces abi.encodeWithSelector & abi.encodeWithSignature with abi.encodeCall

- WHAT the breaking change is

- The change replaces all occurences of abi.encodeWithSelector & abi.encodeWithSignature with abi.ecnodeCall

- WHY the change was made

- `abi.encodeWithSelector & abi.encodeWithSignature` can use with `interface.<function>.selector` to prevent `typo error`, but it `doesn't provide type checking`.

- HOW a consumer should update their code

````
interface miniERC20 {

function transfer(address to, uint256 value) external;
}

// works successfully
function transferData(uint256 to, uint256 value) public pure returns (bytes memory) {
return abi.encodeWithSelector(miniERC20.transfer.selector, to, value);
}```
````

`abi.encodeCall` provides type checking during compile time.

```
function transferData(uint256 to, uint256 value) public pure returns (bytes memory) {
return abi.encodeCall(miniERC20.transfer, (to, value));
}
```

```
error[5407]: TypeError: Cannot implicitly convert component at position 0 from "uint256" to "address".
```

`abi.encodeCall(function pointer, (function arguments...))`
Replaces abi.encodeWithSelector & abi.encodeWithSignature with abi.encodeCall