Skip to content

Commit

Permalink
feat: bsc payments except swap (#619)
Browse files Browse the repository at this point in the history
* feat: bsc artifacts
  • Loading branch information
bertux committed Oct 6, 2021
1 parent 45f4ffb commit cd8493e
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class Erc20FeeProxyPaymentNetwork<
'alfajores',
'fuse',
'bsctest',
'bsc',
],
public supportedCurrencyType: RequestLogicTypes.CURRENCY = RequestLogicTypes.CURRENCY.ERC20,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const supportedNetworks = [
'celo',
'fantom',
'bsctest',
'bsc',
];

/**
Expand Down
10 changes: 10 additions & 0 deletions packages/currency/src/erc20/networks/bsc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { TokenMap } from './types';

// List of the supported bsc network tokens
export const supportedBSCERC20: TokenMap = {
'0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3': {
name: 'Binance-Peg Dai Token',
symbol: 'DAI',
decimals: 18,
},
};
2 changes: 2 additions & 0 deletions packages/currency/src/erc20/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { supportedMaticERC20 } from './matic';
import type { TokenMap } from './types';
import { supportedFantomTokens } from './fantom';
import { supportedBSCTestERC20 } from './bsctest';
import { supportedBSCERC20 } from './bsc';

export const supportedNetworks: Record<string, TokenMap> = {
celo: supportedCeloERC20,
Expand All @@ -13,6 +14,7 @@ export const supportedNetworks: Record<string, TokenMap> = {
matic: supportedMaticERC20,
fantom: supportedFantomTokens,
bsctest: supportedBSCTestERC20,
bsc: supportedBSCERC20,
};

export type { TokenMap };
6 changes: 6 additions & 0 deletions packages/currency/src/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ export const nativeCurrencies = {
name: 'BNB',
network: 'bsctest',
},
{
symbol: 'BNB',
decimals: 18,
name: 'BNB',
network: 'bsc',
},
{
symbol: 'NEAR',
decimals: 24,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export class MultichainExplorerApiProvider extends ethers.providers.EtherscanPro
return 'https://api.ftmscan.com';
case 'bsctest':
return 'https://api-testnet.bscscan.com/';
case 'bsc':
return 'https://api.bscscan.com/';
// Near
case 'aurora':
return 'https://explorer.mainnet.near.org';
Expand Down
1 change: 1 addition & 0 deletions packages/payment-detection/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const networkRpcs: Record<string, string> = {
fantom: 'https://rpcapi.fantom.network',
fuse: 'https://rpc.fuse.io',
bsctest: 'https://data-seed-prebsc-1-s1.binance.org:8545',
bsc: 'https://bsc-dataseed1.binance.org/',
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export const chainlinkConversionPath = new ContractArtifact<ChainlinkConversionP
address: '0xEEc4790306C43DC00cebbE4D0c36Fadf8634B533',
creationBlockNumber: 12759694,
},
bsc: {
address: '0xEEc4790306C43DC00cebbE4D0c36Fadf8634B533',
creationBlockNumber: 11540176,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const erc20FeeProxyArtifact = new ContractArtifact<ERC20FeeProxy>(
},
xdai: {
address: '0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9',
creationBlockNumber: 18326896
creationBlockNumber: 18326896,
},
},
},
Expand Down Expand Up @@ -85,11 +85,15 @@ export const erc20FeeProxyArtifact = new ContractArtifact<ERC20FeeProxy>(
},
xdai: {
address: '0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9',
creationBlockNumber: 18326896
creationBlockNumber: 18326896,
},
bsctest: {
address: '0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9',
creationBlockNumber: 12759691
creationBlockNumber: 12759691,
},
bsc: {
address: '0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9',
creationBlockNumber: 11540173,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export const erc20ConversionProxy = new ContractArtifact<Erc20ConversionProxy>(
address: '0xf0f49873C50765239F6f9534Ba13c4fe16eD5f2E',
creationBlockNumber: 12759699,
},
bsc: {
address: '0xf0f49873C50765239F6f9534Ba13c4fe16eD5f2E',
creationBlockNumber: 11540180,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export const ethereumProxyArtifact = new ContractArtifact<EthereumProxy>(
},
xdai: {
address: '0x27c60BE17e853c47A9F1d280B05365f483c2dFAF',
creationBlockNumber: 18326895
creationBlockNumber: 18326895,
},
bsctest: {
address: '0x27c60BE17e853c47A9F1d280B05365f483c2dFAF',
creationBlockNumber: 12759688
creationBlockNumber: 11540170,
},
// FIXME: Temporarily disable this artifact to fix ETH payment detection
// because Matic doesn't support eth_getLogs for many blocks.
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26875,6 +26875,7 @@ websocket@^1.0.31, websocket@^1.0.32:
dependencies:
debug "^2.2.0"
es5-ext "^0.10.50"
gulp "^4.0.2"
nan "^2.14.0"
typedarray-to-buffer "^3.1.5"
yaeti "^0.0.6"
Expand Down

0 comments on commit cd8493e

Please sign in to comment.