From 14cee01f5018ee7f0dfd2ed47173651ffe5a23fa Mon Sep 17 00:00:00 2001 From: Leandro Boscariol Date: Tue, 18 Jan 2022 10:50:49 -0800 Subject: [PATCH 1/3] New claim contract abi (#2194) * Revert "Revert "Renamed vCOW abi function wethPrice to nativeTokenPrice"" This reverts commit e7197dd27287ff1460a7d7af22734cae938b8c83. * Updated contract address to latest * Replaced wethPrice with nativeTokenPrice Co-authored-by: Leandro --- src/custom/abis/types/VCow.d.ts | 22 ++++++++++++------- .../abis/types/factories/VCow__factory.ts | 2 +- src/custom/abis/vCow.json | 2 +- src/custom/constants/index.ts | 2 +- src/custom/state/claim/hooks/index.ts | 4 +--- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/custom/abis/types/VCow.d.ts b/src/custom/abis/types/VCow.d.ts index 6ca0f4891..b3497a335 100644 --- a/src/custom/abis/types/VCow.d.ts +++ b/src/custom/abis/types/VCow.d.ts @@ -28,7 +28,7 @@ interface VCowInterface extends ethers.utils.Interface { "deploymentTimestamp()": FunctionFragment; "gnoPrice()": FunctionFragment; "usdcPrice()": FunctionFragment; - "wethPrice()": FunctionFragment; + "nativeTokenPrice()": FunctionFragment; }; encodeFunctionData( @@ -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; @@ -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; @@ -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( @@ -211,7 +217,7 @@ export class VCow extends BaseContract { usdcPrice(overrides?: CallOverrides): Promise; - wethPrice(overrides?: CallOverrides): Promise; + nativeTokenPrice(overrides?: CallOverrides): Promise; callStatic: { claim( @@ -245,7 +251,7 @@ export class VCow extends BaseContract { usdcPrice(overrides?: CallOverrides): Promise; - wethPrice(overrides?: CallOverrides): Promise; + nativeTokenPrice(overrides?: CallOverrides): Promise; }; filters: { @@ -319,7 +325,7 @@ export class VCow extends BaseContract { usdcPrice(overrides?: CallOverrides): Promise; - wethPrice(overrides?: CallOverrides): Promise; + nativeTokenPrice(overrides?: CallOverrides): Promise; }; populateTransaction: { @@ -359,6 +365,6 @@ export class VCow extends BaseContract { usdcPrice(overrides?: CallOverrides): Promise; - wethPrice(overrides?: CallOverrides): Promise; + nativeTokenPrice(overrides?: CallOverrides): Promise; }; } diff --git a/src/custom/abis/types/factories/VCow__factory.ts b/src/custom/abis/types/factories/VCow__factory.ts index 4638f69e7..4d036d367 100644 --- a/src/custom/abis/types/factories/VCow__factory.ts +++ b/src/custom/abis/types/factories/VCow__factory.ts @@ -198,7 +198,7 @@ const _abi = [ }, { inputs: [], - name: "wethPrice", + name: "nativeTokenPrice", outputs: [ { internalType: "uint256", diff --git a/src/custom/abis/vCow.json b/src/custom/abis/vCow.json index 246660a65..4bb303d04 100644 --- a/src/custom/abis/vCow.json +++ b/src/custom/abis/vCow.json @@ -190,7 +190,7 @@ }, { "inputs": [], - "name": "wethPrice", + "name": "nativeTokenPrice", "outputs": [ { "internalType": "uint256", diff --git a/src/custom/constants/index.ts b/src/custom/constants/index.ts index 0e72727db..f8d175e02 100644 --- a/src/custom/constants/index.ts +++ b/src/custom/constants/index.ts @@ -58,7 +58,7 @@ export const V_COW_CONTRACT_ADDRESS: Partial> = { // [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 diff --git a/src/custom/state/claim/hooks/index.ts b/src/custom/state/claim/hooks/index.ts index 45729cb60..946d1a165 100644 --- a/src/custom/state/claim/hooks/index.ts +++ b/src/custom/state/claim/hooks/index.ts @@ -331,9 +331,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 { From f3e0f5870a59ecafd001e74227f1ea6f64557d30 Mon Sep 17 00:00:00 2001 From: Leandro Date: Wed, 19 Jan 2022 09:19:31 -0800 Subject: [PATCH 2/3] Updating the fn names type --- src/custom/state/claim/hooks/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/custom/state/claim/hooks/index.ts b/src/custom/state/claim/hooks/index.ts index 946d1a165..84eadca61 100644 --- a/src/custom/state/claim/hooks/index.ts +++ b/src/custom/state/claim/hooks/index.ts @@ -342,7 +342,7 @@ export function useUsdcPrice(): string | null { return _useVCowPriceForToken('usdcPrice') } -type VCowPriceFnNames = 'wethPrice' | 'gnoPrice' | 'usdcPrice' +type VCowPriceFnNames = 'nativeTokenPrice' | 'gnoPrice' | 'usdcPrice' /** * Generic hook for fetching contract value for the many prices From 38fb0a7328c424a032474c19c468a2f5164395cd Mon Sep 17 00:00:00 2001 From: Leandro Date: Wed, 19 Jan 2022 09:42:51 -0800 Subject: [PATCH 3/3] Update vCOW contract address to latest --- src/custom/constants/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/custom/constants/index.ts b/src/custom/constants/index.ts index f8d175e02..841024986 100644 --- a/src/custom/constants/index.ts +++ b/src/custom/constants/index.ts @@ -58,7 +58,7 @@ export const V_COW_CONTRACT_ADDRESS: Partial> = { // [ChainId.MAINNET]: GPv2Settlement[ChainId.MAINNET].address, // [ChainId.RINKEBY]: GPv2Settlement[ChainId.RINKEBY].address, // [ChainId.XDAI]: GPv2Settlement[ChainId.XDAI].address, - [ChainId.RINKEBY]: '0x64F3A9988Af37e8d832194e4A00E4Eb94a91b764', + [ChainId.RINKEBY]: '0xB26D8c5D3d0A67F419F7b314D462C8357Cd4b122', } // See https://github.com/gnosis/gp-v2-contracts/commit/821b5a8da213297b0f7f1d8b17c893c5627020af#diff-12bbbe13cd5cf42d639e34a39d8795021ba40d3ee1e1a8282df652eb161a11d6R13