diff --git a/src/storage/storage-abi.json b/src/storage/storage-abi.json index 969eeb843..d6e939d62 100644 --- a/src/storage/storage-abi.json +++ b/src/storage/storage-abi.json @@ -1,198 +1,257 @@ -[{ +[ + { "constant": true, "inputs": [], "name": "hasInitialized", - "outputs": [{ + "outputs": [ + { "name": "", "type": "bool" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, - "inputs": [{ + "inputs": [ + { "name": "_script", "type": "bytes" - }], + } + ], "name": "getEVMScriptExecutor", - "outputs": [{ + "outputs": [ + { "name": "", "type": "address" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "getRecoveryVault", - "outputs": [{ + "outputs": [ + { "name": "", "type": "address" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, - "inputs": [{ + "inputs": [ + { "name": "token", "type": "address" - }], + } + ], "name": "allowRecoverability", - "outputs": [{ + "outputs": [ + { "name": "", "type": "bool" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "appId", - "outputs": [{ + "outputs": [ + { "name": "", "type": "bytes32" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "getInitializationBlock", - "outputs": [{ + "outputs": [ + { "name": "", "type": "uint256" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "name": "_token", "type": "address" - }], + } + ], "name": "transferToVault", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": true, - "inputs": [{ + "inputs": [ + { "name": "_sender", "type": "address" - }, { + }, + { "name": "_role", "type": "bytes32" - }, { + }, + { "name": "_params", "type": "uint256[]" - }], + } + ], "name": "canPerform", - "outputs": [{ + "outputs": [ + { "name": "", "type": "bool" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "getEVMScriptRegistry", - "outputs": [{ + "outputs": [ + { "name": "", "type": "address" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "kernel", - "outputs": [{ + "outputs": [ + { "name": "", "type": "address" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "isPetrified", - "outputs": [{ + "outputs": [ + { "name": "", "type": "bool" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "REGISTER_DATA_ROLE", - "outputs": [{ + "outputs": [ + { "name": "", "type": "bytes32" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "anonymous": false, - "inputs": [{ + "inputs": [ + { "indexed": true, "name": "key", "type": "bytes32" - }], + } + ], "name": "Registered", "type": "event" -}, { + }, + { "anonymous": false, - "inputs": [{ + "inputs": [ + { "indexed": true, "name": "executor", "type": "address" - }, { + }, + { "indexed": false, "name": "script", "type": "bytes" - }, { + }, + { "indexed": false, "name": "input", "type": "bytes" - }, { + }, + { "indexed": false, "name": "returnData", "type": "bytes" - }], + } + ], "name": "ScriptResult", "type": "event" -}, { + }, + { "anonymous": false, - "inputs": [{ + "inputs": [ + { "indexed": true, "name": "vault", "type": "address" - }, { + }, + { "indexed": true, "name": "token", "type": "address" - }, { + }, + { "indexed": false, "name": "amount", "type": "uint256" - }], + } + ], "name": "RecoverToVault", "type": "event" -}, { + }, + { "constant": false, "inputs": [], "name": "initialize", @@ -200,32 +259,42 @@ "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ - "name": "_key", - "type": "bytes32" - }, { - "name": "_value", - "type": "string" - }], - "name": "registerData", + "inputs": [ + { + "name": "_keys", + "type": "bytes32[]" + }, + { + "name": "_values", + "type": "bytes32[]" + } + ], + "name": "changeMultipleSettings", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": true, - "inputs": [{ + "inputs": [ + { "name": "_key", "type": "bytes32" - }], + } + ], "name": "getRegisteredData", - "outputs": [{ + "outputs": [ + { "name": "", - "type": "string" - }], + "type": "bytes32" + } + ], "payable": false, "stateMutability": "view", "type": "function" -}] \ No newline at end of file + } +] diff --git a/src/storage/storage-wrapper.js b/src/storage/storage-wrapper.js index 3fd23721e..efcf142b0 100644 --- a/src/storage/storage-wrapper.js +++ b/src/storage/storage-wrapper.js @@ -1,5 +1,5 @@ import tokens from '@aragon/templates-tokens' -import { soliditySha3 } from '../web3-utils' +import { toHex } from '../web3-utils' import storageAbi from './storage-abi.json' export function testTokensEnabled(network) { @@ -15,13 +15,22 @@ export default { if (!values || values.length === 0) { return } - for (const paramKey of Object.keys(values)) { - upgradeIntents.push([ - storageAddr, - 'registerData', - [soliditySha3(paramKey), values[paramKey]], - ]) - } + + // for (const paramKey of Object.keys(values)) { + // upgradeIntents.push([ + // storageAddr, + // 'registerData', + // [soliditySha3(paramKey), values[paramKey]], + // ]) + // } + const intentKeys = Object.keys(values).map(k => toHex(k)) + const intentValues = Object.values(values).map(v => toHex(v)) + + upgradeIntents.push([ + storageAddr, + 'changeMultipleSettings', + [intentKeys, intentValues], + ]) const upgradePath = await wrapper.getTransactionPathForIntentBasket( upgradeIntents, @@ -41,7 +50,7 @@ export default { }, get: (web3, storageAddr, from, paramName) => getContract(web3, storageAddr) - .methods.getRegisteredData(soliditySha3(paramName)) + .methods.getRegisteredData(toHex(paramName)) .call({ from: from }), subscribe: (web3, storageAddr, paramName, callback) => getContract(web3, storageAddr).events.Registered(paramName, callback), diff --git a/src/web3-utils.js b/src/web3-utils.js index 5aa75a20f..2db5e4f25 100644 --- a/src/web3-utils.js +++ b/src/web3-utils.js @@ -218,5 +218,6 @@ export { isAddress, soliditySha3, toChecksumAddress, + toHex, toWei, } from 'web3-utils'