Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: omni/tokenbridge
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: JoinColony/tokenbridge
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 3 commits
  • 16 files changed
  • 3 contributors

Commits on Feb 5, 2023

  1. Colony styling updates

    arrenv committed Feb 5, 2023
    Copy the full SHA
    60b4e97 View commit details

Commits on Feb 6, 2023

  1. Merge pull request #1 from JoinColony/colony-style-updates

    Colony styling updates
    area authored Feb 6, 2023
    Copy the full SHA
    1911ee5 View commit details

Commits on Oct 5, 2023

  1. Copy the full SHA
    3057283 View commit details
76 changes: 38 additions & 38 deletions alm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
FROM node:12 as contracts

WORKDIR /mono

COPY contracts/package.json contracts/package-lock.json ./contracts/

WORKDIR /mono/contracts
RUN npm install --only=prod

COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile

FROM node:12 as alm-builder

WORKDIR /mono
COPY package.json .
COPY --from=contracts /mono/contracts/build ./contracts/build
COPY commons/package.json ./commons/
COPY alm/package.json ./alm/
COPY yarn.lock .
RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile

COPY ./commons ./commons
COPY ./alm ./alm

ARG DOT_ENV_PATH=./alm/.env
COPY ${DOT_ENV_PATH} ./alm/.env

WORKDIR /mono/alm
RUN yarn run build


FROM node:12 as alm-production
RUN yarn global add serve
WORKDIR /app
COPY --from=alm-builder /mono/alm/build .
CMD serve -p $PORT -s .
FROM node:14 as contracts

WORKDIR /mono

COPY contracts/package.json contracts/package-lock.json ./contracts/

WORKDIR /mono/contracts
RUN npm install --only=prod
#RUN yarn --ignore-engines --frozen-lockfile
COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile

FROM node:12 as alm-builder

WORKDIR /mono
COPY package.json .
COPY --from=contracts /mono/contracts/build ./contracts/build
COPY commons/package.json ./commons/
COPY alm/package.json ./alm/
COPY yarn.lock .
RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile

COPY ./commons ./commons
COPY ./alm ./alm

ARG DOT_ENV_PATH=./alm/.env
COPY ${DOT_ENV_PATH} ./alm/.env

WORKDIR /mono/alm
RUN yarn run build


FROM node:12 as alm-production
RUN yarn global add serve@13
WORKDIR /app
COPY --from=alm-builder /mono/alm/build .
CMD serve -p $PORT -s .
Binary file removed alm/public/favicon.ico
Binary file not shown.
Binary file added alm/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 45 additions & 45 deletions alm/public/index.html
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="AMB Live Monitoring"
/>
<link rel="stylesheet" href="https://unpkg.com/chota@latest">
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
<title>AMB Live Monitoring</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="AMB Live Monitoring"
/>
<link rel="stylesheet" href="https://unpkg.com/chota@latest">
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
<title>Colony AMB Live Monitoring Service</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
30 changes: 15 additions & 15 deletions alm/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"short_name": "ALM",
"name": "AMB Live Monitoring",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
{
"short_name": "ALM",
"name": "AMB Live Monitoring",
"icons": [
{
"src": "favicon.png",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/png"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
55 changes: 38 additions & 17 deletions alm/scripts/createSnapshots.js
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ const {
ALM_HOME_EXPLORER_API
} = process.env

const STARTING_PAGING_SIZE = 10_000_000

const generateSnapshot = async (side, url, bridgeAddress) => {
const snapshotPath = `../src/snapshots/${side}.json`
const snapshotFullPath = path.join(__dirname, snapshotPath)
@@ -25,26 +27,45 @@ const generateSnapshot = async (side, url, bridgeAddress) => {
const web3 = new Web3(new Web3.providers.HttpProvider(url))
const api = side === 'home' ? ALM_HOME_EXPLORER_API : ALM_FOREIGN_EXPLORER_API

const getPastEventsWithFallback = (contract, eventName, options) =>
const getPastEventsWithFallback = async (contract, eventName, options, pagingSize = STARTING_PAGING_SIZE) =>
contract.getPastEvents(eventName, options).catch(async e => {
if (e.message.includes('exceed maximum block range')) {
if (e.message.includes('block range') || e.message.includes('timeout')) {
const abi = contract.options.jsonInterface.find(abi => abi.type === 'event' && abi.name === eventName)

const url = new URL(api)
url.searchParams.append('module', 'logs')
url.searchParams.append('action', 'getLogs')
url.searchParams.append('address', contract.options.address)
url.searchParams.append('fromBlock', options.fromBlock)
url.searchParams.append('toBlock', options.toBlock || 'latest')
url.searchParams.append('topic0', web3.eth.abi.encodeEventSignature(abi))

const logs = await fetch(url).then(res => res.json())

return logs.result.map(log => ({
transactionHash: log.transactionHash,
blockNumber: parseInt(log.blockNumber.slice(2), 16),
returnValues: web3.eth.abi.decodeLog(abi.inputs, log.data, log.topics.slice(1))
}))
const originalToBlock = options.toBlock
options.toBlock = Math.min(options.toBlock, options.fromBlock + pagingSize - 1)
const pastEvents = []

while (options.fromBlock !== originalToBlock) {
const url = new URL(api)
url.searchParams.append('module', 'logs')
url.searchParams.append('action', 'getLogs')
url.searchParams.append('address', contract.options.address)
url.searchParams.append('fromBlock', options.fromBlock)
url.searchParams.append('toBlock', options.toBlock || 'latest')
url.searchParams.append('topic0', web3.eth.abi.encodeEventSignature(abi))
let logs
try {
const fetchRes = await fetch(url)
logs = await fetchRes.json()
} catch (err) {
if (err.message.includes('canceled due to enabled timeout') || err.message.includes('Unexpected token <')) {
logs = await getPastEventsWithFallback(contract, eventName, options, pagingSize / 2)
} else {
throw err
}
}
const res = logs.result.map(log => ({
transactionHash: log.transactionHash,
blockNumber: parseInt(log.blockNumber.slice(2), 16),
returnValues: web3.eth.abi.decodeLog(abi.inputs, log.data, log.topics.slice(1))
}))
pastEvents.push(...res)

options.fromBlock = Math.min(options.toBlock + 1, originalToBlock)
options.toBlock = Math.min(options.fromBlock + pagingSize - 1, originalToBlock)
}
return pastEvents
}
throw e
})
Loading