Skip to content

v4.1.0

Compare
Choose a tag to compare
@sohkai sohkai released this 09 Mar 10:40
27dbf00

🎊 Special thanks to @ianbrt and @gregzaitsev for helping make this release possible 🎉

SafeERC20: helping you work with tokens, even when Solidity doesn't want to

Interacting with token contracts can be a tricky process when you can't trust their implementation. A number of buggy tokens have been identified on the Ethereum mainnet, with especially high-profile ones deployed having the "no return" bug.

SafeERC20 smooths out interactions with these buggy or otherwise potentially malicious tokens.

A set of "safe" functions, safeTransfer(), safeTransferFrom(), safeApprove(), are available that handle the "no return" bug and enforce boolean returns (such that no reverts are ever thrown).

A further set of staticcall utilities, staticBalanceOf() and staticAllowance(), are available to enforce the view guarantees of these interfaces on Solidity pragmas pre-0.5.

Using SafeERC20 is as simple as:

contract TokenInteraction {
    using SafeERC20 for ERC20;

    function transferTo(ERC20 _token, address _to, uint256 _amount) external {
        require(_token.safeTransfer(_to, _amount));
    }
}

Changes:

  • KernelProxy: emit SetApp event on construction (8982e33): Allows frontends to verify the chain of Kernel upgrades from their creation
  • feat: Add SafeERC20 (e94109f)
  • VaultRecoverable: emit event on successful recovery (ac4e4a3): Makes it easier for frontends to detect when the token recovery functionality was used
  • Modify radspec strings (47cc48a, 3ad9a79, thanks @gregzaitsev!)
  • Create CONTRIBUTING.md (8e2ab29, thanks @ianbrt!)
  • A few other testing related or clean up chores