Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
New claim contract abi (#2194)
Browse files Browse the repository at this point in the history
* Revert "Revert "Renamed vCOW abi function wethPrice to nativeTokenPrice""

This reverts commit e7197dd.

* Updated contract address to latest

* Replaced wethPrice with nativeTokenPrice

Co-authored-by: Leandro <[email protected]>
  • Loading branch information
alfetopito and Leandro authored Jan 18, 2022
1 parent 842d37d commit a57a283
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
22 changes: 14 additions & 8 deletions src/custom/abis/types/VCow.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface VCowInterface extends ethers.utils.Interface {
"deploymentTimestamp()": FunctionFragment;
"gnoPrice()": FunctionFragment;
"usdcPrice()": FunctionFragment;
"wethPrice()": FunctionFragment;
"nativeTokenPrice()": FunctionFragment;
};

encodeFunctionData(
Expand Down Expand Up @@ -68,7 +68,10 @@ interface VCowInterface extends ethers.utils.Interface {
): string;
encodeFunctionData(functionFragment: "gnoPrice", values?: undefined): string;
encodeFunctionData(functionFragment: "usdcPrice", values?: undefined): string;
encodeFunctionData(functionFragment: "wethPrice", values?: undefined): string;
encodeFunctionData(
functionFragment: "nativeTokenPrice",
values?: undefined
): string;

decodeFunctionResult(functionFragment: "claim", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "claimMany", data: BytesLike): Result;
Expand All @@ -80,7 +83,10 @@ interface VCowInterface extends ethers.utils.Interface {
): Result;
decodeFunctionResult(functionFragment: "gnoPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "usdcPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "wethPrice", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "nativeTokenPrice",
data: BytesLike
): Result;

events: {
"Claimed(uint256,uint8,address,uint256,uint256)": EventFragment;
Expand Down Expand Up @@ -177,7 +183,7 @@ export class VCow extends BaseContract {

usdcPrice(overrides?: CallOverrides): Promise<[BigNumber]>;

wethPrice(overrides?: CallOverrides): Promise<[BigNumber]>;
nativeTokenPrice(overrides?: CallOverrides): Promise<[BigNumber]>;
};

claim(
Expand Down Expand Up @@ -211,7 +217,7 @@ export class VCow extends BaseContract {

usdcPrice(overrides?: CallOverrides): Promise<BigNumber>;

wethPrice(overrides?: CallOverrides): Promise<BigNumber>;
nativeTokenPrice(overrides?: CallOverrides): Promise<BigNumber>;

callStatic: {
claim(
Expand Down Expand Up @@ -245,7 +251,7 @@ export class VCow extends BaseContract {

usdcPrice(overrides?: CallOverrides): Promise<BigNumber>;

wethPrice(overrides?: CallOverrides): Promise<BigNumber>;
nativeTokenPrice(overrides?: CallOverrides): Promise<BigNumber>;
};

filters: {
Expand Down Expand Up @@ -319,7 +325,7 @@ export class VCow extends BaseContract {

usdcPrice(overrides?: CallOverrides): Promise<BigNumber>;

wethPrice(overrides?: CallOverrides): Promise<BigNumber>;
nativeTokenPrice(overrides?: CallOverrides): Promise<BigNumber>;
};

populateTransaction: {
Expand Down Expand Up @@ -359,6 +365,6 @@ export class VCow extends BaseContract {

usdcPrice(overrides?: CallOverrides): Promise<PopulatedTransaction>;

wethPrice(overrides?: CallOverrides): Promise<PopulatedTransaction>;
nativeTokenPrice(overrides?: CallOverrides): Promise<PopulatedTransaction>;
};
}
2 changes: 1 addition & 1 deletion src/custom/abis/types/factories/VCow__factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const _abi = [
},
{
inputs: [],
name: "wethPrice",
name: "nativeTokenPrice",
outputs: [
{
internalType: "uint256",
Expand Down
2 changes: 1 addition & 1 deletion src/custom/abis/vCow.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
},
{
"inputs": [],
"name": "wethPrice",
"name": "nativeTokenPrice",
"outputs": [
{
"internalType": "uint256",
Expand Down
2 changes: 1 addition & 1 deletion src/custom/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const V_COW_CONTRACT_ADDRESS: Partial<Record<number, string>> = {
// [ChainId.MAINNET]: GPv2Settlement[ChainId.MAINNET].address,
// [ChainId.RINKEBY]: GPv2Settlement[ChainId.RINKEBY].address,
// [ChainId.XDAI]: GPv2Settlement[ChainId.XDAI].address,
[ChainId.RINKEBY]: '0x71A377EC0026A8E35AfD082d54E2f62d39AF075c',
[ChainId.RINKEBY]: '0x64F3A9988Af37e8d832194e4A00E4Eb94a91b764',
}

// See https://github.com/gnosis/gp-v2-contracts/commit/821b5a8da213297b0f7f1d8b17c893c5627020af#diff-12bbbe13cd5cf42d639e34a39d8795021ba40d3ee1e1a8282df652eb161a11d6R13
Expand Down
6 changes: 2 additions & 4 deletions src/custom/state/claim/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,7 @@ export function useClaimTimeInfo(): ClaimTimeInfo {
}

export function useNativeTokenPrice(): string | null {
// TODO: rename fn to `nativeTokenPrice` and revert e7197dd27287ff1460a7d7af22734cae938b8c83
// when there's a new deployment
return _useVCowPriceForToken('wethPrice')
return _useVCowPriceForToken('nativeTokenPrice')
}

export function useGnoPrice(): string | null {
Expand All @@ -346,7 +344,7 @@ export function useUsdcPrice(): string | null {
/**
* Generic hook for fetching contract value for the many prices
*/
function _useVCowPriceForToken(priceFnName: 'wethPrice' | 'gnoPrice' | 'usdcPrice'): string | null {
function _useVCowPriceForToken(priceFnName: 'nativeTokenPrice' | 'gnoPrice' | 'usdcPrice'): string | null {
const { chainId } = useActiveWeb3React()
const vCowContract = useVCowContract()

Expand Down

0 comments on commit a57a283

Please sign in to comment.