-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
5,131 additions
and
1,504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"senderAddress": "0x7e614ec62cfd5761f20a9c5a2fe2bc0ac7431918", | ||
"data": "0xa9059cbb00000000000000000000000100000000000000000000000000000000000000060000000000000000000000000000000000000000000000000de0b6b3a7640000", | ||
"blockNumber": 4086410 | ||
} | ||
"senderAddress": "0x01114f4bda09ed6c6715cf0baf606b5bce1dc96a", | ||
"blockNumber": 5511415 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
{ | ||
"1": { | ||
"contractAddress": "0x48c80F1f4D53D5951e5D5438B54Cba84f29F32a5", | ||
"contractUploadBlock": 2378196 | ||
"contractAddress": "0xe94327d07fc17907b4db788e5adf2ed424addff6", | ||
"contractUploadBlock": 4086425 | ||
}, | ||
"3": { | ||
"contractAddress": "0x39E082EEdc796835d444dB92dF9Ee1Ca5F64Cf66", | ||
"contractUploadBlock": 2055651 | ||
"contractAddress": "0xf52e614de10a602458472299dacf21316a9b7292", | ||
"contractUploadBlock": 2055625 | ||
}, | ||
"4": { | ||
"contractAddress": "0xF1FaC99605cd371e0274D847a88BAe09C84934cc", | ||
"contractUploadBlock": 1228061 | ||
}, | ||
"10101": { | ||
"contractAddress": "0x0bd7b480637a77d9c4226a2b793768fc6c849124", | ||
"contractUploadBlock": 2 | ||
"contractAddress": "0x01f72ef9f920056f40de19c6940ba571bae1ab7f", | ||
"contractUploadBlock": 1227488 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"1": { | ||
"contractAddress": "0x48c80F1f4D53D5951e5D5438B54Cba84f29F32a5", | ||
"contractUploadBlock": 2378196 | ||
}, | ||
"3": { | ||
"contractAddress": "0x7a305d9b681fb164dc5ad628b5992177dc66aec8", | ||
"contractUploadBlock": 1383780 | ||
}, | ||
"4": { | ||
"contractAddress": "0x9a2517fDEb1B1759D005BD50a0DDC3eeA7fA4FDF", | ||
"contractUploadBlock": 2180437 | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
const path = require("path"); | ||
const abi = require("augur-abi"); | ||
const repFreeze = require("../data/freeze-rep.json"); | ||
const freezeRep = require("../data/freeze-rep.json"); | ||
const legacyRep = require("../data/legacy-rep.json"); | ||
|
||
module.exports.REP_CONTRACT_ADDRESS = ((require("../build/contracts/RepToken").networks || {})[process.env.EXPECTED_NETWORK_ID] || {}).address || "0x"; | ||
// const networkID = augur.rpc.getNetworkID(); | ||
// const universe = augur.contracts.addresses[networkID].Universe; | ||
// module.exports.REP_CONTRACT_ADDRESS = augur.api.Universe.getReputationToken({ universe }, (err, reputationToken) => { | ||
// if (err) return console.error(err); | ||
// module.exports.REP_CONTRACT_ADDRESS = reputationToken; | ||
// }); | ||
|
||
module.exports.LEGACY_REP_FREEZE_BLOCK = repFreeze.blockNumber; | ||
module.exports.LEGACY_REP_FREEZE_ADDRESS = repFreeze.senderAddress; | ||
module.exports.LEGACY_REP_FROZEN_REP_RECIPIENT_ADDRESS = "0xe1e212c353f7a682693c198ba5ff85849f8300cc"; | ||
module.exports.LEGACY_REP_FREEZE_BLOCK = freezeRep.blockNumber; | ||
module.exports.LEGACY_REP_FREEZE_ADDRESS = freezeRep.senderAddress; | ||
|
||
module.exports.LEGACY_REP_CONTRACT_ADDRESS = (legacyRep[process.env.EXPECTED_NETWORK_ID] || {}).contractAddress; | ||
module.exports.LEGACY_REP_CONTRACT_UPLOAD_BLOCK = (legacyRep[process.env.EXPECTED_NETWORK_ID] || {}).contractUploadBlock; | ||
const networkID = process.env.EXPECTED_NETWORK_ID; | ||
|
||
module.exports.LEGACY_REP_CONTRACT_ADDRESS = legacyRep[networkID].contractAddress; | ||
module.exports.LEGACY_REP_CONTRACT_UPLOAD_BLOCK = legacyRep[networkID].contractUploadBlock; | ||
// module.exports.LEGACY_REP_CONTRACT_ADDRESS = augur.contracts.addresses[networkID].LegacyReputationToken; | ||
// module.exports.LEGACY_REP_CONTRACT_UPLOAD_BLOCK = augur.contracts.uploadBlockNumbers[networkID]; | ||
|
||
module.exports.LEGACY_REP_CREATION_OVERFLOW_DATA = "0xa9059cbb00000000000000000000000100000000000000000000000000000000000000060000000000000000000000000000000000000000000000000de0b6b3a7640000"; | ||
module.exports.LEGACY_REP_CREATION_OVERFLOW_AMOUNT = "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000"; | ||
module.exports.LEGACY_REP_TOTAL_SUPPLY = "0x00000000000000000000000000000000000000000009195731e2ce35eb000000"; | ||
module.exports.LEGACY_REP_TRANSFER_SIGNATURE = "0x" + abi.keccak_256("Transfer(address,address,uint256)"); | ||
// module.exports.LEGACY_REP_TRANSFER_SIGNATURE = augur.contracts.abi.events.LegacyReputationToken.Transfer.signature; | ||
module.exports.LEGACY_REP_TEST_TRANSFER_RECIPIENT = "0x7c0d52faab596c08f484e3478aebc6205f3f5d8c"; | ||
|
||
module.exports.ADDRESSES_PER_CHUNK = 25; | ||
module.exports.PARALLEL_TRANSACTIONS = 50; | ||
module.exports.BLOCKS_PER_CHUNK = 5000; | ||
module.exports.REP_ADDRESS_FILE = path.join(__dirname, "..", "data", "all-rep-addresses.txt"); | ||
module.exports.REP_ADDRESS_FILE = path.join(__dirname, "..", "data", "all-rep-addresses-" + process.env.EXPECTED_NETWORK_ID + ".txt"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
const fs = require("fs"); | ||
const async = require("async"); | ||
const BigNumber = require("bignumber.js"); | ||
const speedomatic = require("speedomatic"); | ||
|
||
let totalLegacyRepSupply = new BigNumber(0); | ||
// let totalMigrated = new BigNumber(0); | ||
|
||
function writeAddressListToFile(repAddressFile, allRepAddresses, callback) { | ||
fs.writeFile(repAddressFile, allRepAddresses.join("\n"), "utf8", (err) => callback(err, allRepAddresses)); | ||
} | ||
|
||
function checkRepBalance(augur, address, legacyRepContractAddress, callback) { | ||
if (speedomatic.strip0xPrefix(address).length > 40) { | ||
console.log("skipping invalid address", address); | ||
return callback(null); | ||
} | ||
augur.api.LegacyReputationToken.balanceOf({ _owner: address, tx: { to: legacyRepContractAddress } }, (err, repBalance) => { | ||
if (err) return callback(err); | ||
if (new BigNumber(repBalance, 10).gt(0)) { | ||
totalLegacyRepSupply = totalLegacyRepSupply.plus(new BigNumber(repBalance, 10)); | ||
return callback(null, address); | ||
} | ||
callback(null); | ||
}); | ||
} | ||
|
||
function getAllRepAddresses(augur, allRepAddresses, legacyRepContractAddress, repAddressFile, fromBlock, legacyRepFreezeBlock, blocksPerChunk, callback) { | ||
if (fromBlock > legacyRepFreezeBlock) { | ||
console.log("Total legacy REP supply:", totalLegacyRepSupply.toFixed(), speedomatic.unfix(totalLegacyRepSupply, "string")); | ||
return writeAddressListToFile(repAddressFile, allRepAddresses, callback); | ||
} | ||
const toBlock = Math.min(fromBlock + blocksPerChunk, legacyRepFreezeBlock); | ||
const migratedEventSignature = augur.events.hashEventAbi({ name: "Migrated", inputs: [{ type: "address" }, { type: "uint256" }] }); | ||
augur.rpc.getLogs({ | ||
fromBlock: fromBlock, | ||
toBlock: toBlock, | ||
address: legacyRepContractAddress, | ||
topics: [[augur.contracts.abi.events.LegacyReputationToken.Transfer.signature, migratedEventSignature]], | ||
}, (err, logs) => { | ||
if (err) return callback(err); | ||
console.log("got", logs.length, "transfer or migrated logs between blocks", fromBlock, "and", toBlock); | ||
if (!logs.length) return getAllRepAddresses(augur, allRepAddresses, legacyRepContractAddress, repAddressFile, toBlock + 1, legacyRepFreezeBlock, blocksPerChunk, callback); | ||
async.eachSeries(logs, (log, nextLog) => { | ||
const toAddress = speedomatic.formatEthereumAddress((log.topics[0] === migratedEventSignature) ? log.topics[1] : log.topics[2]); | ||
if (allRepAddresses.indexOf(toAddress) !== -1) return async.setImmediate(() => nextLog()); | ||
checkRepBalance(augur, toAddress, legacyRepContractAddress, (err, address) => { | ||
if (err) return nextLog(err); | ||
if (address) allRepAddresses.push(address); | ||
nextLog(); | ||
}); | ||
}, (err) => { | ||
if (err) return callback(err); | ||
getAllRepAddresses(augur, allRepAddresses, legacyRepContractAddress, repAddressFile, toBlock + 1, legacyRepFreezeBlock, blocksPerChunk, callback); | ||
}); | ||
}); | ||
} | ||
|
||
module.exports.writeAddressListToFile = writeAddressListToFile; | ||
module.exports.checkRepBalance = checkRepBalance; | ||
module.exports.getAllRepAddresses = getAllRepAddresses; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.