diff --git a/app/migration.html b/app/migration.html
new file mode 100644
index 0000000..86b656f
--- /dev/null
+++ b/app/migration.html
@@ -0,0 +1,12 @@
+
+
+ Status.im - Survey Migration
+
+
+
+
+
Open the console (F12)
+
+
+
+
diff --git a/app/migration.js b/app/migration.js
new file mode 100644
index 0000000..762062a
--- /dev/null
+++ b/app/migration.js
@@ -0,0 +1,50 @@
+import web3 from "Embark/web3"
+import EmbarkJS from 'Embark/EmbarkJS';
+import PollManager from 'Embark/contracts/PollManager';
+
+
+
+
+EmbarkJS.onReady(async (err) => {
+ const { nPolls, poll } = PollManager.methods;
+
+ console.log("WAIT UNTIL DONE");
+ console.group("Polls and Votes");
+
+
+ const numPolls = await nPolls().call();
+
+ const polls = [];
+ for (let i = 0; i < numPolls; i++) {
+ const p = await poll(i).call();
+
+ console.log(`_polls[${i}] = Poll({canceled: ${p._canceled}, description: "${p._description}", startBlock: ${p._startBlock}, endBlock: ${p._endBlock}, qvResults: ${p._qvResults}, results: ${p._results}, voters: ${p._voters}});`);
+ }
+
+ const events = await PollManager.getPastEvents("allEvents", {fromBlock: 5900136, toBlock: "latest"});
+
+ let votes = [];
+ for (let i = 0; i < events.length; i++){
+ switch(events[i].event){
+ case 'PollCreated':
+ votes.push({});
+ break;
+ case 'Vote':
+ votes[events[i].returnValues.idPoll][events[i].returnValues._voter] = events[i].returnValues.amount;
+ break;
+ case 'Unvote':
+ delete votes[events[i].returnValues.idPoll][events[i].returnValues._voter];
+ break;
+ }
+ }
+
+ for(let i = 0; i < votes.length; i++){
+ for(let address in votes[i]){
+ console.log(`_polls[${i}].votes[${address}] = ${votes[i][address]};`);
+ }
+ }
+
+ console.groupEnd();
+ console.log("DONE");
+
+})
\ No newline at end of file
diff --git a/embark.json b/embark.json
index 2f73ec7..1c8404f 100644
--- a/embark.json
+++ b/embark.json
@@ -2,7 +2,9 @@
"contracts": ["contracts/**"],
"app": {
"js/dapp.js": ["app/dapp.js"],
+ "js/migration.js": ["app/migration.js"],
"index.html": "app/index.html",
+ "migration.html": "app/migration.html",
"images/": ["app/images/**"]
},
"buildDir": "dist/",