Guest User

Untitled

a guest
Jul 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.33 KB | None | 0 0
  1. [
  2. {
  3. "anonymous": false,
  4. "inputs": [
  5. {
  6. "indexed": false,
  7. "name": "version",
  8. "type": "string"
  9. },
  10. {
  11. "indexed": true,
  12. "name": "implementation",
  13. "type": "address"
  14. }
  15. ],
  16. "name": "Upgraded",
  17. "type": "event"
  18. },
  19. {
  20. "constant": false,
  21. "inputs": [
  22. {
  23. "name": "newOwner",
  24. "type": "address"
  25. }
  26. ],
  27. "name": "transferProxyOwnership",
  28. "outputs": [],
  29. "payable": false,
  30. "stateMutability": "nonpayable",
  31. "type": "function"
  32. },
  33. {
  34. "payable": true,
  35. "stateMutability": "payable",
  36. "type": "fallback"
  37. },
  38. {
  39. "anonymous": false,
  40. "inputs": [
  41. {
  42. "indexed": false,
  43. "name": "previousOwner",
  44. "type": "address"
  45. },
  46. {
  47. "indexed": false,
  48. "name": "newOwner",
  49. "type": "address"
  50. }
  51. ],
  52. "name": "ProxyOwnershipTransferred",
  53. "type": "event"
  54. },
  55. {
  56. "inputs": [
  57. {
  58. "name": "_owner",
  59. "type": "address"
  60. }
  61. ],
  62. "payable": false,
  63. "stateMutability": "nonpayable",
  64. "type": "constructor"
  65. },
  66. {
  67. "constant": false,
  68. "inputs": [
  69. {
  70. "name": "version",
  71. "type": "string"
  72. },
  73. {
  74. "name": "implementation",
  75. "type": "address"
  76. }
  77. ],
  78. "name": "upgradeTo",
  79. "outputs": [],
  80. "payable": false,
  81. "stateMutability": "nonpayable",
  82. "type": "function"
  83. },
  84. {
  85. "constant": false,
  86. "inputs": [
  87. {
  88. "name": "version",
  89. "type": "string"
  90. },
  91. {
  92. "name": "implementation",
  93. "type": "address"
  94. },
  95. {
  96. "name": "data",
  97. "type": "bytes"
  98. }
  99. ],
  100. "name": "upgradeToAndCall",
  101. "outputs": [],
  102. "payable": true,
  103. "stateMutability": "payable",
  104. "type": "function"
  105. },
  106. {
  107. "constant": true,
  108. "inputs": [],
  109. "name": "implementation",
  110. "outputs": [
  111. {
  112. "name": "",
  113. "type": "address"
  114. }
  115. ],
  116. "payable": false,
  117. "stateMutability": "view",
  118. "type": "function"
  119. },
  120. {
  121. "constant": true,
  122. "inputs": [],
  123. "name": "proxyOwner",
  124. "outputs": [
  125. {
  126. "name": "",
  127. "type": "address"
  128. }
  129. ],
  130. "payable": false,
  131. "stateMutability": "view",
  132. "type": "function"
  133. },
  134. {
  135. "constant": true,
  136. "inputs": [],
  137. "name": "upgradeabilityOwner",
  138. "outputs": [
  139. {
  140. "name": "",
  141. "type": "address"
  142. }
  143. ],
  144. "payable": false,
  145. "stateMutability": "view",
  146. "type": "function"
  147. },
  148. {
  149. "constant": true,
  150. "inputs": [],
  151. "name": "version",
  152. "outputs": [
  153. {
  154. "name": "",
  155. "type": "string"
  156. }
  157. ],
  158. "payable": false,
  159. "stateMutability": "view",
  160. "type": "function"
  161. }
  162.  
  163. mapping(bytes32 => uint256) internal uintStorage;
  164. mapping(bytes32 => string) internal stringStorage;
  165. mapping(bytes32 => address) internal addressStorage;
  166. mapping(bytes32 => bytes) internal bytesStorage;
  167. mapping(bytes32 => bool) internal boolStorage;
  168. mapping(bytes32 => int256) internal intStorage;
  169.  
  170. /**
  171. * @dev Tells the address of the owner
  172. * @return the address of the owner
  173. */
  174. function upgradeabilityOwner() public view returns (address) {
  175. return _upgradeabilityOwner;
  176. }
  177.  
  178. /**
  179. * @dev Sets the address of the owner
  180. */
  181. function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
  182. _upgradeabilityOwner = newUpgradeabilityOwner;
  183. }
  184.  
  185. /**
  186. * @dev Fallback function allowing to perform a delegatecall to the given implementation.
  187. * This function will return whatever the implementation call returns
  188. */
  189. function () public payable {
  190. address _impl = implementation();
  191. require(_impl != address(0));
  192. bytes memory data = msg.data;
  193.  
  194. assembly {
  195. let result := delegatecall(gas, _impl, add(data, 0x20), mload(data), 0, 0)
  196. let size := returndatasize
  197.  
  198. let ptr := mload(0x40)
  199. returndatacopy(ptr, 0, size)
  200.  
  201. switch result
  202. case 0 { revert(ptr, size) }
  203. default { return(ptr, size) }
  204. }
  205. }
  206.  
  207. /**
  208. * @dev Tells the address of the implementation where every call will be delegated.
  209. * @return address of the implementation to which it will be delegated
  210. */
  211. function implementation() public view returns (address);
  212.  
  213. // Address of the current implementation
  214. address internal _implementation;
  215.  
  216. /**
  217. * @dev Tells the version name of the current implementation
  218. * @return string representing the name of the current version
  219. */
  220. function version() public view returns (string) {
  221. return _version;
  222. }
  223.  
  224. /**
  225. * @dev Tells the address of the current implementation
  226. * @return address of the current implementation
  227. */
  228. function implementation() public view returns (address) {
  229. return _implementation;
  230. }
  231.  
  232. /**
  233. * @dev Upgrades the implementation address
  234. * @param version representing the version name of the new implementation to be set
  235. * @param implementation representing the address of the new implementation to be set
  236. */
  237. function _upgradeTo(string version, address implementation) internal {
  238. require(_implementation != implementation);
  239. _version = version;
  240. _implementation = implementation;
  241. Upgraded(version, implementation);
  242. }
  243.  
  244. /**
  245. * @dev the constructor sets the original owner of the contract to the sender account.
  246. */
  247. function OwnedUpgradeabilityProxy(address _owner) public {
  248. setUpgradeabilityOwner(_owner);
  249. }
  250.  
  251. /**
  252. * @dev Throws if called by any account other than the owner.
  253. */
  254. modifier onlyProxyOwner() {
  255. require(msg.sender == proxyOwner());
  256. _;
  257. }
  258.  
  259. /**
  260. * @dev Tells the address of the proxy owner
  261. * @return the address of the proxy owner
  262. */
  263. function proxyOwner() public view returns (address) {
  264. return upgradeabilityOwner();
  265. }
  266.  
  267. /**
  268. * @dev Allows the current owner to transfer control of the contract to a newOwner.
  269. * @param newOwner The address to transfer ownership to.
  270. */
  271. function transferProxyOwnership(address newOwner) public onlyProxyOwner {
  272. require(newOwner != address(0));
  273. ProxyOwnershipTransferred(proxyOwner(), newOwner);
  274. setUpgradeabilityOwner(newOwner);
  275. }
  276.  
  277. /**
  278. * @dev Allows the upgradeability owner to upgrade the current version of the proxy.
  279. * @param version representing the version name of the new implementation to be set.
  280. * @param implementation representing the address of the new implementation to be set.
  281. */
  282. function upgradeTo(string version, address implementation) public onlyProxyOwner {
  283. _upgradeTo(version, implementation);
  284. }
  285.  
  286. /**
  287. * @dev Allows the upgradeability owner to upgrade the current version of the proxy and call the new implementation
  288. * to initialize whatever is needed through a low level call.
  289. * @param version representing the version name of the new implementation to be set.
  290. * @param implementation representing the address of the new implementation to be set.
  291. * @param data represents the msg.data to bet sent in the low level call. This parameter may include the function
  292. * signature of the implementation to be called with the needed payload
  293. */
  294. function upgradeToAndCall(string version, address implementation, bytes data) payable public onlyProxyOwner {
  295. upgradeTo(version, implementation);
  296. require(this.call.value(msg.value)(data));
  297. }
  298.  
  299. function EternalStorageProxyForStormMultisender(address _owner) public OwnedUpgradeabilityProxy(_owner) {}
Add Comment
Please, Sign In to add comment