Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bsc payments except swap #619

Merged
merged 3 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default class Erc20FeeProxyPaymentNetwork<
'alfajores',
'fuse',
'bsctest',
'bsc',
],
public supportedCurrencyType: string = RequestLogicTypes.CURRENCY.ERC20,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,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
3 changes: 2 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8488,7 +8488,7 @@ chai-bn@^0.2.1:
resolved "https://registry.yarnpkg.com/chai-bn/-/chai-bn-0.2.1.tgz#1dad95e24c3afcd8139ab0262e9bbefff8a30ab7"
integrity sha512-01jt2gSXAw7UYFPT5K8d7HYjdXj2vyeIuE+0T/34FWzlNcVbs1JkPxRu7rYMfQnJhrHT8Nr6qjSf5ZwwLU2EYg==

chai@^4.2.0, chai@^4.3.4:
chai@4.3.4, chai@^4.2.0:
version "4.3.4"
resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.4.tgz#b55e655b31e1eac7099be4c08c21964fce2e6c49"
integrity sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==
Expand Down Expand Up @@ -26797,6 +26797,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