1- pragma solidity ^ 0.5.17 ;
1+ pragma solidity ^ 0.6.10 ;
2+ // SPDX-License-Identifier: GPL-3.0
23
34import "@daostack/infra-experimental/contracts/Reputation.sol " ;
45import "./DAOToken.sol " ;
56import "./Vault.sol " ;
67import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol " ;
78import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol " ;
8- import "@openzeppelin/upgrades/contracts/Initializable.sol " ;
99
1010
1111/**
1212 * @title An Avatar holds tokens, reputation and ether for a controller
1313 */
14- contract Avatar is Initializable , Ownable {
14+ contract Avatar is Initializable , OwnableUpgradeSafe {
1515 using SafeERC20 for IERC20 ;
1616
1717 string public orgName;
@@ -29,10 +29,11 @@ contract Avatar is Initializable, Ownable {
2929 /**
3030 * @dev enables an avatar to receive ethers
3131 */
32- function () external payable {
33- if (msg .sender != address (vault)) {
32+ /* solhint-disable */
33+ receive () external payable {
34+ if (msg .sender != address (vault)) {
3435 // solhint-disable-next-line avoid-call-value
35- (bool success , ) = address (vault).call. value ( msg .value ) ("" );
36+ (bool success , ) = address (vault).call { value: msg .value } ("" );
3637 require (success, "sendEther failed. " );
3738 }
3839 }
@@ -50,7 +51,8 @@ contract Avatar is Initializable, Ownable {
5051 orgName = _orgName;
5152 nativeToken = _nativeToken;
5253 nativeReputation = _nativeReputation;
53- Ownable.initialize (_owner);
54+ __Ownable_init_unchained ();
55+ transferOwnership (_owner);
5456 vault = new Vault ();
5557 vault.initialize (address (this ));
5658 }
@@ -60,8 +62,8 @@ contract Avatar is Initializable, Ownable {
6062 * @param _contract the contract's address to call
6163 * @param _data ABI-encoded contract call to call `_contract` address.
6264 * @param _value value (ETH) to transfer with the transaction
63- * @return bool success or fail
64- * bytes - the return bytes of the called contract's function.
65+ * @return success success or fail
66+ * returnValue - the return bytes of the called contract's function.
6567 */
6668 function genericCall (address _contract , bytes calldata _data , uint256 _value )
6769 external
@@ -71,7 +73,7 @@ contract Avatar is Initializable, Ownable {
7173 vault.sendEther (_value, address (this ));
7274 }
7375 // solhint-disable-next-line avoid-call-value
74- (success, returnValue) = _contract.call. value ( _value) (_data);
76+ (success, returnValue) = _contract.call { value: _value} (_data);
7577 emit GenericCall (_contract, _data, _value, success);
7678 }
7779
0 commit comments