Skip to content

Commit

Permalink
feat: added mumbai faucet (#223)
Browse files Browse the repository at this point in the history
* feat: added mumbai faucet

* fix: updated faucet service to not have value

* fix: added weth to parsings
  • Loading branch information
sendra authored Aug 17, 2021
1 parent b090c30 commit 9296571
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/tx-builder/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const enabledNetworksByService: EnabledNetworksType = {
Network.polygon,
Network.mumbai,
],
faucet: [Network.kovan],
faucet: [Network.kovan, Network.mumbai],
liquiditySwapAdapter: [Network.mainnet, Network.polygon],
repayWithCollateralAdapter: [Network.kovan, Network.mainnet],
aaveGovernanceV2: [Network.kovan, Network.mainnet],
Expand Down
2 changes: 1 addition & 1 deletion src/tx-builder/config/v2/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const commonContractAddressBetweenMarketsV2: CommonConfigType = {
GOVERNANCE_PROTO_CONTRACT: '',
LEND_TO_AAVE_MIGRATOR: '',
WETH_GATEWAY: '0xee9eE614Ad26963bEc1Bec0D2c92879ae1F209fA',
FAUCET: '',
FAUCET: '0x0b3C23243106A69449e79C14c58BB49E358f9B10',
SWAP_COLLATERAL_ADAPTER: '',
REPAY_WITH_COLLATERAL_ADAPTER: '',
FLASHLIQUIDATION: '',
Expand Down
17 changes: 1 addition & 16 deletions src/tx-builder/services/Faucet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import {
Configuration,
eEthereumTxType,
EthereumTransactionTypeExtended,
tEthereumAddress,
transactionType,
tStringDecimalUnits,
} from '../types';
import { FaucetParamsType } from '../types/FaucetMethodTypes';
import { mintAmountsPerToken } from '../utils/parsings';
Expand Down Expand Up @@ -54,13 +52,12 @@ export default class FaucetService
{ userAddress, reserve, tokenSymbol }: FaucetParamsType
): Promise<EthereumTransactionTypeExtended[]> {
const amount: string = mintAmountsPerToken[tokenSymbol];
const txValue = await this.getTxValue(reserve, amount);

const txCallback: () => Promise<transactionType> = this.generateTxCallback({
rawTxMethod: () =>
this.faucetContract.populateTransaction.mint(reserve, amount),
from: userAddress,
value: txValue,
value: DEFAULT_NULL_VALUE_ON_TX,
});

return [
Expand All @@ -71,16 +68,4 @@ export default class FaucetService
},
];
}

private async getTxValue(
token: tEthereumAddress,
amount: tStringDecimalUnits
): Promise<tStringDecimalUnits> {
const minterAddress: string = await this.faucetContract.getMinter(token);
const minterContract: IMinter = this.getContractInstance(minterAddress);

const isEthRequired: boolean = await minterContract.isEthRequired();

return isEthRequired ? amount : DEFAULT_NULL_VALUE_ON_TX;
}
}
1 change: 1 addition & 0 deletions src/tx-builder/utils/parsings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const mintAmountsPerToken: { [token: string]: tStringDecimalUnits } = {
LINK: parseNumber('1000', 18),
MANA: parseNumber('100000', 18),
MKR: parseNumber('10', 18),
WETH: parseNumber('10', 18),
REN: parseNumber('10000', 18),
REP: parseNumber('1000', 18),
SNX: parseNumber('100', 18),
Expand Down

0 comments on commit 9296571

Please sign in to comment.