Skip to content

Commit

Permalink
Merge branch 'master' into escrow-payment-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
Dadogg80 committed Dec 1, 2021
2 parents b87345b + 2c879a6 commit 93f094f
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/request-node/package.json
Expand Up @@ -55,6 +55,7 @@
"keyv-file": "0.2.0",
"shelljs": "0.8.4",
"tslib": "2.3.1",
"web3-providers-ws": "1.6.1",
"yargs": "16.2.0"
},
"devDependencies": {
Expand Down
27 changes: 25 additions & 2 deletions packages/request-node/src/storageUtils.ts
Expand Up @@ -5,7 +5,8 @@ import * as config from './config';
import Keyv from 'keyv';
import KeyvFile from 'keyv-file';

import hdWalletProvider from '@truffle/hdwallet-provider';
import Web3WsProvider from 'web3-providers-ws';
import HDWalletProvider from '@truffle/hdwallet-provider';

/**
* Get the ethereum storage with values from config
Expand All @@ -28,7 +29,29 @@ export function getEthereumStorage(
};

// Initializes web3 connection object
const provider = new hdWalletProvider(mnemonic, config.getStorageWeb3ProviderUrl());
let provider: HDWalletProvider;
if (config.getStorageWeb3ProviderUrl().match('^wss?://.+')) {
provider = new HDWalletProvider({
mnemonic,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
providerOrUrl: new Web3WsProvider(config.getStorageWeb3ProviderUrl(), {
clientConfig: {
keepalive: true,
keepaliveInterval: 10000, // ms
},
// Enable auto reconnection
reconnect: {
auto: true,
delay: 3000, // ms
maxAttempts: 5,
onTimeout: false,
},
}),
});
} else {
provider = new HDWalletProvider(mnemonic, config.getStorageWeb3ProviderUrl());
}

const web3Connection: StorageTypes.IWeb3Connection = {
networkId: config.getStorageNetworkId(),
Expand Down
5 changes: 5 additions & 0 deletions packages/smart-contracts/hardhat.config.ts
Expand Up @@ -53,6 +53,11 @@ export default {
chainId: 137,
accounts,
},
celo: {
url: process.env.WEB3_PROVIDER_URL || 'https://forno.celo.org',
chainId: 42220,
accounts,
},
bsctest: {
url: process.env.WEB3_PROVIDER_URL || 'https://data-seed-prebsc-1-s1.binance.org:8545',
chainId: 97,
Expand Down
2 changes: 2 additions & 0 deletions packages/smart-contracts/scripts/utils.ts
Expand Up @@ -14,4 +14,6 @@ export const uniswapV2RouterAddresses: Record<string, string> = {
fantom: '0x16327e3fbdaca3bcf7e38f5af2599d2ddc33ae52',
// https://github.com/QuickSwap/quickswap-core
matic: '0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff',
// https://app.ubeswap.org/#/swap
celo: '0x7D28570135A2B1930F331c507F65039D4937f66c',
};
Expand Up @@ -41,6 +41,10 @@ export const chainlinkConversionPath = new ContractArtifact<ChainlinkConversionP
address: '0xEEc4790306C43DC00cebbE4D0c36Fadf8634B533',
creationBlockNumber: 20061324,
},
celo: {
address: '0xEEc4790306C43DC00cebbE4D0c36Fadf8634B533',
creationBlockNumber: 10141032,
},
},
},
},
Expand Down
10 changes: 10 additions & 0 deletions packages/smart-contracts/src/lib/artifacts/ERC20FeeProxy/index.ts
Expand Up @@ -102,6 +102,16 @@ export const erc20FeeProxyArtifact = new ContractArtifact<ERC20FeeProxy>(
},
},
},
// Additional deployments of same versions, not worth upgrading the version number but worth using within next versions
// '0.2.0-next': {
// abi: ABI_0_1_0,
// deployment: {
// celo: {
// address: '0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9',
// creationBlockNumber: 10141030,
// },
// },
// },
},
'0.2.0',
);
Expand Up @@ -50,6 +50,10 @@ export const erc20SwapToPayArtifact = new ContractArtifact<ERC20SwapToPay>(
address: '0x75740D9b5cA3BCCb356CA7f0D0dB71aBE427a835',
creationBlockNumber: 20670324,
},
celo: {
address: '0x75740D9b5cA3BCCb356CA7f0D0dB71aBE427a835',
creationBlockNumber: 10141034,
},
},
},
},
Expand Down
Expand Up @@ -41,6 +41,10 @@ export const erc20ConversionProxy = new ContractArtifact<Erc20ConversionProxy>(
address: '0xf0f49873C50765239F6f9534Ba13c4fe16eD5f2E',
creationBlockNumber: 20061367,
},
celo: {
address: '0xf0f49873C50765239F6f9534Ba13c4fe16eD5f2E',
creationBlockNumber: 10141033,
},
},
},
},
Expand Down
Expand Up @@ -29,6 +29,10 @@ export const erc20SwapConversionArtifact = new ContractArtifact<ERC20SwapToConve
address: '0x1d6B06C6f7adFd9314BD4C58a6D306261113a1D4',
creationBlockNumber: 20670431,
},
celo: {
address: '0x1d6B06C6f7adFd9314BD4C58a6D306261113a1D4',
creationBlockNumber: 10141036,
},
},
},
},
Expand Down
Expand Up @@ -25,6 +25,10 @@ export const ethConversionArtifact = new ContractArtifact<EthConversionProxy>(
address: '0xCa3353a15fCb5C83a1Ff64BFf055781aC5c4d2F4',
creationBlockNumber: 20670503,
},
celo: {
address: '0xCa3353a15fCb5C83a1Ff64BFf055781aC5c4d2F4',
creationBlockNumber: 10141038,
},
},
},
},
Expand Down
Expand Up @@ -25,6 +25,10 @@ export const ethereumFeeProxyArtifact = new ContractArtifact<EthereumFeeProxy>(
address: '0xC6E23a20C0a1933ACC8E30247B5D1e2215796C1F',
creationBlockNumber: 20670475,
},
celo: {
address: '0xC6E23a20C0a1933ACC8E30247B5D1e2215796C1F',
creationBlockNumber: 10141037,
},
},
},
},
Expand Down
Expand Up @@ -37,13 +37,10 @@ export const ethereumProxyArtifact = new ContractArtifact<EthereumProxy>(
address: '0x27c60BE17e853c47A9F1d280B05365f483c2dFAF',
creationBlockNumber: 17427737,
},
// FIXME: Temporarily disable this artifact to fix ETH payment detection
// because Matic doesn't support eth_getLogs for many blocks.
// The fix will be to use TheGraph for Ethereum Proxy
// matic: {
// address: '0x27c60BE17e853c47A9F1d280B05365f483c2dFAF',
// creationBlockNumber: 17427737,
// },
celo: {
address: '0x27c60BE17e853c47A9F1d280B05365f483c2dFAF',
creationBlockNumber: 10141029,
},
},
},
},
Expand Down
38 changes: 38 additions & 0 deletions yarn.lock
Expand Up @@ -25456,6 +25456,14 @@ web3-core-helpers@1.3.6:
web3-eth-iban "1.3.6"
web3-utils "1.3.6"

web3-core-helpers@1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz#cb21047306871f4cf0fedfece7d47ea2aa96141b"
integrity sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==
dependencies:
web3-eth-iban "1.6.1"
web3-utils "1.6.1"

web3-core-method@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.2.1.tgz#9df1bafa2cd8be9d9937e01c6a47fc768d15d90a"
Expand Down Expand Up @@ -26033,6 +26041,14 @@ web3-eth-iban@1.3.6:
bn.js "^4.11.9"
web3-utils "1.3.6"

web3-eth-iban@1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz#20bbed75723e3e9ff98e624979629d26329462b6"
integrity sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==
dependencies:
bn.js "^4.11.9"
web3-utils "1.6.1"

web3-eth-personal@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.2.1.tgz#244e9911b7b482dc17c02f23a061a627c6e47faf"
Expand Down Expand Up @@ -26392,6 +26408,15 @@ web3-providers-ws@1.3.6:
web3-core-helpers "1.3.6"
websocket "^1.0.32"

web3-providers-ws@1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.6.1.tgz#f7ee71f158971102b865e99ea7911f483e0507e9"
integrity sha512-FWMEFYb4rYFYRgSFBf/O1Ex4p/YKSlN+JydCtdlJwRimd89qm95CTfs4xGjCskwvXMjV2sarH+f1NPwJXicYpg==
dependencies:
eventemitter3 "4.0.4"
web3-core-helpers "1.6.1"
websocket "^1.0.32"

web3-shh@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.2.1.tgz#4460e3c1e07faf73ddec24ccd00da46f89152b0c"
Expand Down Expand Up @@ -26501,6 +26526,19 @@ web3-utils@1.3.6:
underscore "1.12.1"
utf8 "3.0.0"

web3-utils@1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.6.1.tgz#befcb23922b00603ab56d8c5b4158468dc494aca"
integrity sha512-RidGKv5kOkcerI6jQqDFDoTllQQqV+rPhTzZHhmbqtFObbYpU93uc+yG1LHivRTQhA6llIx67iudc/vzisgO+w==
dependencies:
bn.js "^4.11.9"
ethereum-bloom-filters "^1.0.6"
ethereumjs-util "^7.1.0"
ethjs-unit "0.1.6"
number-to-bn "1.7.0"
randombytes "^2.1.0"
utf8 "3.0.0"

web3-utils@^1.0.0-beta.31:
version "1.4.0"
resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.4.0.tgz#e8cb381c81b242dc1d4ecb397200356d404410e6"
Expand Down

0 comments on commit 93f094f

Please sign in to comment.