|
FROM node:14-alpine |
|
WORKDIR /app |
|
RUN npm install --save eth-ens-namehash content-hash @zoltu/ethereum-abi-encoder |
|
RUN echo $'\n\ |
|
import Contenthash from "content-hash"\n\ |
|
import Namehash from "eth-ens-namehash"\n\ |
|
import AbiEncoder from "@zoltu/ethereum-abi-encoder"\n\ |
|
\n\ |
|
function stringToBytes(hex) {\n\ |
|
const match = /^(?:0x)?([a-fA-F0-9]*)$/.exec(hex)\n\ |
|
if (match === null) throw new Error(`Expected a hex string encoded byte array with an optional "0x" prefix but received ${hex}`)\n\ |
|
const normalized = match[1]\n\ |
|
if (normalized.length % 2) throw new Error(`Hex string encoded byte array must be an even number of charcaters long.`)\n\ |
|
const bytes = []\n\ |
|
for (let i = 0; i < normalized.length; i += 2) {\n\ |
|
bytes.push(Number.parseInt(`${normalized[i]}${normalized[i + 1]}`, 16))\n\ |
|
}\n\ |
|
return new Uint8Array(bytes)\n\ |
|
}\n\ |
|
\n\ |
|
const nameHash = Namehash.hash("augur2.eth")\n\ |
|
console.log(`\x1b[1mName Hash (augur2.eth)\x1b[0m: ${nameHash}`)\n\ |
|
const tradingNameHash = Namehash.hash("trading.augur2.eth")\n\ |
|
console.log(`\x1b[1mName Hash (trading.augur2.eth)\x1b[0m: ${tradingNameHash}`)\n\ |
|
const reportingNameHash = Namehash.hash("reporting.augur2.eth")\n\ |
|
console.log(`\x1b[1mName Hash (reporting.augur2.eth)\x1b[0m: ${reportingNameHash}`)\n\ |
|
\n\ |
|
const tradingContentHash = `0x${Contenthash.fromIpfs(process.env.TRADING_CIDV0_IPFS_HASH)}`\n\ |
|
const reportingContentHash = `0x${Contenthash.fromIpfs(process.env.REPORTING_CIDV0_IPFS_HASH)}`\n\ |
|
console.log(`\x1b[1mContent Hash (Trading)\x1b[0m: ${tradingContentHash}`)\n\ |
|
console.log(`\x1b[1mContent Hash (Reporting)\x1b[0m: ${reportingContentHash}`)\n\ |
|
\n\ |
|
const rootMethodCall = AbiEncoder.encodeMethod(0x304e6ade, [{ name: "node", type: "bytes32" }, { name: "hash", type: "bytes" }], [BigInt(nameHash), stringToBytes(tradingContentHash)])\n\ |
|
console.log(`\x1b[1mTransaction (augur2.eth)\x1b[0m: ${Array.from(rootMethodCall).map(x => x.toString(16).padStart(2, "0")).join("")}`)\n\ |
|
const tradingMethodCall = AbiEncoder.encodeMethod(0x304e6ade, [{ name: "node", type: "bytes32" }, { name: "hash", type: "bytes" }], [BigInt(tradingNameHash), stringToBytes(tradingContentHash)])\n\ |
|
console.log(`\x1b[1mTransaction (trading.augur2.eth)\x1b[0m: ${Array.from(tradingMethodCall).map(x => x.toString(16).padStart(2, "0")).join("")}`)\n\ |
|
const reportingMethodCall = AbiEncoder.encodeMethod(0x304e6ade, [{ name: "node", type: "bytes32" }, { name: "hash", type: "bytes" }], [BigInt(reportingNameHash), stringToBytes(reportingContentHash)])\n\ |
|
console.log(`\x1b[1mTransaction (reporting.augur2.eth)\x1b[0m: ${Array.from(reportingMethodCall).map(x => x.toString(16).padStart(2, "0")).join("")}`)\n\ |
|
' >> /app/index.mjs |
|
|
|
ENTRYPOINT [ "node", "index.mjs" ] |
@MicahZoltu
I want you to add the following text to the end of
2. In Aragon: Console => Act => Agent
(you can change the wording).FWIW I wanted to make a pull request to do this but I couldn't. As you might already know you cannot make a pull request on a Gist. I didn't know that.