Преглед изворни кода

Use Address.sendValue for PaymentSplitter (#2456)

* use Address.sendValue instead of .transfer

* changelog entry

Co-authored-by: Hadrien Croubois <hadrien@openzeppelin.com>
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
Hadrien Croubois пре 4 година
родитељ
комит
b6e5187973
2 измењених фајлова са 3 додато и 1 уклоњено
  1. 1 0
      CHANGELOG.md
  2. 2 1
      contracts/payment/PaymentSplitter.sol

+ 1 - 0
CHANGELOG.md

@@ -7,6 +7,7 @@
  * `ERC20Permit`: added an implementation of the ERC20 permit extension for gasless token approvals. ([#2237](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2237))
  * Presets: added token presets with preminted fixed supply `ERC20PresetFixedSupply` and `ERC777PresetFixedSupply`. ([#2399](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2399))
  * `Address`: added `functionDelegateCall`, similar to the existing `functionCall`. ([#2333](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2333))
+ * `PaymentSplitter`: replace usage of `.transfer()` with `Address.sendValue` for improved compatibility with smart wallets. ([#2455](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2455))
  * `UpgradeableProxy`: bubble revert reasons from initialization calls. ([#2454](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2454)) 
 
 ## 3.3.0 (2020-11-26)

+ 2 - 1
contracts/payment/PaymentSplitter.sol

@@ -4,6 +4,7 @@ pragma solidity >=0.6.0 <0.8.0;
 
 import "../GSN/Context.sol";
 import "../math/SafeMath.sol";
+import "../utils/Address.sol";
 
 /**
  * @title PaymentSplitter
@@ -112,7 +113,7 @@ contract PaymentSplitter is Context {
         _released[account] = _released[account].add(payment);
         _totalReleased = _totalReleased.add(payment);
 
-        account.transfer(payment);
+        Address.sendValue(account, payment);
         emit PaymentReleased(account, payment);
     }