Skip to content

Commit

Permalink
Merge branch 'master' into erc20SwapToPay_with_fees
Browse files Browse the repository at this point in the history
  • Loading branch information
Dadogg80 committed Feb 2, 2022
2 parents c642479 + ecc147a commit ada1b36
Show file tree
Hide file tree
Showing 23 changed files with 574 additions and 172 deletions.
Expand Up @@ -26,6 +26,7 @@ export default class Erc20FeeProxyPaymentNetwork<
'xdai',
'fantom',
'arbitrum-rinkeby',
'arbitrum-one',
],
public supportedCurrencyType: RequestLogicTypes.CURRENCY = RequestLogicTypes.CURRENCY.ERC20,
) {
Expand Down
Expand Up @@ -14,6 +14,7 @@ const supportedNetworks = [
'bsctest',
'bsc',
'arbitrum-rinkeby',
'arbitrum-one',
];

/**
Expand Down
6 changes: 6 additions & 0 deletions packages/currency/src/native.ts
Expand Up @@ -81,6 +81,12 @@ export const nativeCurrencies: Record<NativeCurrencyType, (NativeCurrency & { na
name: 'Arbitrum Testnet',
network: 'arbitrum-rinkeby',
},
{
symbol: 'AETH',
decimals: 18,
name: 'Arbitrum Ether',
network: 'arbitrum-one',
},
],
[RequestLogicTypes.CURRENCY.BTC]: [
{
Expand Down
1 change: 1 addition & 0 deletions packages/payment-detection/src/provider.ts
Expand Up @@ -40,6 +40,7 @@ const networkRpcs: Record<string, string> = {
bsc: 'https://bsc-dataseed1.binance.org/',
xdai: 'https://rpc.xdaichain.com/',
'arbitrum-rinkeby': 'https://rinkeby.arbitrum.io/rpc',
'arbitrum-one': 'https://arb1.arbitrum.io/rpc',
};

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/smart-contracts/hardhat.config.ts
Expand Up @@ -117,6 +117,10 @@ const setExplorerApiKey = (hre: HardhatRuntimeEnvironment) => {
hre.config.etherscan.apiKey = process.env.FTMSCAN_API_KEY;
return;
}
case 'arbitrum-one': {
hre.config.etherscan.apiKey = process.env.ARBISCAN_API_KEY;
return;
}
}
};

Expand Down
Expand Up @@ -70,6 +70,7 @@ export default async function deploy(
...args,
conversionProxyAddress: erc20ConversionAddress,
swapProxyAddress: localSwapRouterAddress,
chainlinkConversionPathAddress: conversionPathInstance.address,
},
hre,
);
Expand Down
19 changes: 15 additions & 4 deletions packages/smart-contracts/scripts/conversion-proxy.ts
@@ -1,16 +1,23 @@
import { HardhatRuntimeEnvironment } from 'hardhat/types';
// eslint-disable-next-line
// @ts-ignore Cannot find module
import { Erc20ConversionProxy } from '../src/types/Erc20ConversionProxy';
import {
erc20ConversionProxy as erc20ConversionProxyArtifact,
ethConversionArtifact,
} from '../src/lib';
import { DeploymentResult, deployOne } from './deploy-one';
import { deployOne } from './deploy-one';
import { CurrencyManager } from '@requestnetwork/currency';
import { RequestLogicTypes } from '@requestnetwork/types';

export async function deployERC20ConversionProxy(
args: { chainlinkConversionPathAddress?: string; erc20FeeProxyAddress?: string },
args: {
chainlinkConversionPathAddress?: string;
erc20FeeProxyAddress?: string;
nonceCondition?: number;
},
hre: HardhatRuntimeEnvironment,
): Promise<DeploymentResult | undefined> {
) {
const contractName = 'Erc20ConversionProxy';

if (!args.chainlinkConversionPathAddress) {
Expand All @@ -26,16 +33,19 @@ export async function deployERC20ConversionProxy(
return undefined;
}

return deployOne(args, hre, contractName, {
return deployOne<Erc20ConversionProxy>(args, hre, contractName, {
constructorArguments: [args.erc20FeeProxyAddress, args.chainlinkConversionPathAddress],
artifact: erc20ConversionProxyArtifact,
nonceCondition: args.nonceCondition,
version: '0.1.1',
});
}

export async function deployETHConversionProxy(
args: {
chainlinkConversionPathAddress?: string;
ethFeeProxyAddress?: string;
nonceCondition?: number;
},
hre: HardhatRuntimeEnvironment,
) {
Expand Down Expand Up @@ -74,5 +84,6 @@ export async function deployETHConversionProxy(
nativeTokenHash,
],
artifact: ethConversionArtifact,
nonceCondition: args.nonceCondition,
});
}
10 changes: 8 additions & 2 deletions packages/smart-contracts/scripts/deploy-one.ts
Expand Up @@ -34,6 +34,7 @@ const SKIPPED_DEPLOYMENT: DeploymentResult<unknown> = {
* @options
* - options.verify: set false to prevent verification on live networks
* - options.nonceCondition: only proceeds with the deployment if the nonce matches
* - options.version: to deploy or map a version different from the last version
* @returns a deployment result with address =
* - The address if the contract is deployed or attached
* - 'simulated' if args.simulate === true (no deployment/)
Expand All @@ -48,6 +49,7 @@ export async function deployOne<TContract extends Contract>(
artifact?: ContractArtifact<Contract>;
verify?: boolean;
nonceCondition?: number;
version?: string;
},
): Promise<DeploymentResult<TContract>> {
const [deployer] = await hre.ethers.getSigners();
Expand All @@ -56,9 +58,13 @@ export async function deployOne<TContract extends Contract>(
const constructorArguments = options?.constructorArguments ?? [];
if (options?.artifact) {
try {
address = options.artifact.getAddress(hre.network.name);
address = options.artifact.getAddress(hre.network.name, options.version);
const action = args.force ? '(forcing deployment)' : '(skipping)';
console.log(`Found ${contractName} on ${hre.network.name} at address: ${address} ${action}`);
console.log(
`Found ${contractName}${options.version ? ` v${options.version}` : ''} on ${
hre.network.name
} at address: ${address} ${action}`,
);
if (!args.force) {
return {
address,
Expand Down

0 comments on commit ada1b36

Please sign in to comment.