1
- pragma solidity ^ 0.5.17 ;
1
+ pragma solidity ^ 0.6.10 ;
2
+ // SPDX-License-Identifier: GPL-3.0
2
3
3
4
import "@daostack/infra-experimental/contracts/Reputation.sol " ;
4
5
import "./DAOToken.sol " ;
5
6
import "./Vault.sol " ;
6
7
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol " ;
7
8
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol " ;
8
- import "@openzeppelin/upgrades/contracts/Initializable.sol " ;
9
9
10
10
11
11
/**
12
12
* @title An Avatar holds tokens, reputation and ether for a controller
13
13
*/
14
- contract Avatar is Initializable , Ownable {
14
+ contract Avatar is Initializable , OwnableUpgradeSafe {
15
15
using SafeERC20 for IERC20 ;
16
16
17
17
string public orgName;
@@ -29,10 +29,11 @@ contract Avatar is Initializable, Ownable {
29
29
/**
30
30
* @dev enables an avatar to receive ethers
31
31
*/
32
- function () external payable {
33
- if (msg .sender != address (vault)) {
32
+ /* solhint-disable */
33
+ receive () external payable {
34
+ if (msg .sender != address (vault)) {
34
35
// 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 } ("" );
36
37
require (success, "sendEther failed. " );
37
38
}
38
39
}
@@ -50,7 +51,8 @@ contract Avatar is Initializable, Ownable {
50
51
orgName = _orgName;
51
52
nativeToken = _nativeToken;
52
53
nativeReputation = _nativeReputation;
53
- Ownable.initialize (_owner);
54
+ __Ownable_init_unchained ();
55
+ transferOwnership (_owner);
54
56
vault = new Vault ();
55
57
vault.initialize (address (this ));
56
58
}
@@ -60,8 +62,8 @@ contract Avatar is Initializable, Ownable {
60
62
* @param _contract the contract's address to call
61
63
* @param _data ABI-encoded contract call to call `_contract` address.
62
64
* @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.
65
67
*/
66
68
function genericCall (address _contract , bytes calldata _data , uint256 _value )
67
69
external
@@ -71,7 +73,7 @@ contract Avatar is Initializable, Ownable {
71
73
vault.sendEther (_value, address (this ));
72
74
}
73
75
// solhint-disable-next-line avoid-call-value
74
- (success, returnValue) = _contract.call. value ( _value) (_data);
76
+ (success, returnValue) = _contract.call { value: _value} (_data);
75
77
emit GenericCall (_contract, _data, _value, success);
76
78
}
77
79
0 commit comments