Skip to content

Commit

Permalink
feat: sdai token wrapper (#561)
Browse files Browse the repository at this point in the history
* feat: added tests

* feat: added test for stable debt

* fix: bad merge

* feat: added encoded tx data

* feat: added test for signed repay with l2 pool

* feat: -1 handle

* feat: added test for repay with max input (-1)

* feat: added encode functions for using optimized path

* fix: rate mode and max repay

* test: repay amount and interest rate mode

* feat: sdai token wrapper

* test: sdai wrapper

* fix: sdai token preview

* test: coverage

* feat: updated typings

* fix: compile errors

* feat: generic token wrapping service

* fix: export

* fix: explicit return types

* fix: cleanup

* fix: tests

* test: ci

* chore: cleanup

* fix: types

---------

Co-authored-by: Joaquin Battilana <[email protected]>
  • Loading branch information
grothem and JoaquinBattilana authored Feb 22, 2024
1 parent ce5290a commit c772112
Show file tree
Hide file tree
Showing 14 changed files with 2,353 additions and 1,221 deletions.
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ module.exports = {
'packages/contract-helpers/src/v3-migration-contract/typechain',
'packages/contract-helpers/src/index.ts',
'packages/math-utils/src/formatters/reserve/index.ts',
'packages/contract-helpers/src/V3-uiStakeDataProvider-contract/index.ts',
],
modulePathIgnorePatterns: ['node_modules'],
testEnvironment: 'node',
Expand Down
46 changes: 12 additions & 34 deletions packages/contract-helpers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,50 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
All notable changes to this project will be documented in this file. See
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# 1.24.0 (2024-02-05)


### Features

* abpt v2 migration ([#573](https://github.com/aave/aave-utilities/issues/573)) ([75bb4c0](https://github.com/aave/aave-utilities/commit/75bb4c038ea10b8faf42630a7fb580e7317623b8))




- abpt v2 migration ([#573](https://github.com/aave/aave-utilities/issues/573))
([75bb4c0](https://github.com/aave/aave-utilities/commit/75bb4c038ea10b8faf42630a7fb580e7317623b8))

## 1.23.1 (2024-01-24)

**Note:** Version bump only for package @aave/contract-helpers





# 1.23.0 (2024-01-19)


### Features

* add bnb ([#571](https://github.com/aave/aave-utilities/issues/571)) ([5b92d16](https://github.com/aave/aave-utilities/commit/5b92d16a39dfb47e0cae95fd3480863b8f9afc75))




- add bnb ([#571](https://github.com/aave/aave-utilities/issues/571))
([5b92d16](https://github.com/aave/aave-utilities/commit/5b92d16a39dfb47e0cae95fd3480863b8f9afc75))

# 1.22.0 (2024-01-18)


### Features

* gov v3 ([#564](https://github.com/aave/aave-utilities/issues/564)) ([335588e](https://github.com/aave/aave-utilities/commit/335588e2e04056b631a47b1ede50594baebd158e)), closes [#567](https://github.com/aave/aave-utilities/issues/567)




- gov v3 ([#564](https://github.com/aave/aave-utilities/issues/564))
([335588e](https://github.com/aave/aave-utilities/commit/335588e2e04056b631a47b1ede50594baebd158e)),
closes [#567](https://github.com/aave/aave-utilities/issues/567)

## 1.21.1 (2023-11-21)

**Note:** Version bump only for package @aave/contract-helpers





# Change Log

All notable changes to this project will be documented in this file. See
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# 1.21.0 (2023-10-04)


### Features

* updated debt switch interface ([#559](https://github.com/aave/aave-utilities/issues/559)) ([b108c62](https://github.com/aave/aave-utilities/commit/b108c620cf0e3e446840c166b660695ebd66563b))




- updated debt switch interface
([#559](https://github.com/aave/aave-utilities/issues/559))
([b108c62](https://github.com/aave/aave-utilities/commit/b108c620cf0e3e446840c166b660695ebd66563b))

# 1.20.0 (2023-08-22)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import type {
PopulatedTransaction,
Signer,
utils,
} from "ethers";
import type { FunctionFragment, Result } from "@ethersproject/abi";
import type { Listener, Provider } from "@ethersproject/providers";
} from 'ethers';
import type { FunctionFragment, Result } from '@ethersproject/abi';
import type { Listener, Provider } from '@ethersproject/providers';
import type {
TypedEventFilter,
TypedEvent,
TypedListener,
OnEvent,
} from "./common";
} from './common';

export declare namespace IGovernanceCore {
export type VotingConfigStruct = {
Expand All @@ -33,7 +33,7 @@ export declare namespace IGovernanceCore {
number,
BigNumber,
BigNumber,
BigNumber
BigNumber,
] & {
coolDownBeforeVotingStart: number;
votingDuration: number;
Expand Down Expand Up @@ -75,7 +75,7 @@ export declare namespace IGovernanceCore {
BigNumber,
BigNumber,
BigNumber,
PayloadsControllerUtils.PayloadStructOutput[]
PayloadsControllerUtils.PayloadStructOutput[],
] & {
state: number;
accessLevel: number;
Expand Down Expand Up @@ -103,7 +103,7 @@ export declare namespace IGovernanceDataHelper {

export type VotingConfigStructOutput = [
number,
IGovernanceCore.VotingConfigStructOutput
IGovernanceCore.VotingConfigStructOutput,
] & { accessLevel: number; config: IGovernanceCore.VotingConfigStructOutput };

export type ConstantsStruct = {
Expand All @@ -119,7 +119,7 @@ export declare namespace IGovernanceDataHelper {
BigNumber,
BigNumber,
BigNumber,
BigNumber
BigNumber,
] & {
votingConfigs: IGovernanceDataHelper.VotingConfigStructOutput[];
precisionDivider: BigNumber;
Expand All @@ -137,7 +137,7 @@ export declare namespace IGovernanceDataHelper {
export type ProposalStructOutput = [
BigNumber,
BigNumber,
IGovernanceCore.ProposalStructOutput
IGovernanceCore.ProposalStructOutput,
] & {
id: BigNumber;
votingChainId: BigNumber;
Expand Down Expand Up @@ -183,42 +183,42 @@ export declare namespace PayloadsControllerUtils {

export interface GovernanceDataHelperInterface extends utils.Interface {
functions: {
"getConstants(address,uint8[])": FunctionFragment;
"getProposalsData(address,uint256,uint256,uint256)": FunctionFragment;
"getRepresentationData(address,address,uint256[])": FunctionFragment;
'getConstants(address,uint8[])': FunctionFragment;
'getProposalsData(address,uint256,uint256,uint256)': FunctionFragment;
'getRepresentationData(address,address,uint256[])': FunctionFragment;
};

getFunction(
nameOrSignatureOrTopic:
| "getConstants"
| "getProposalsData"
| "getRepresentationData"
| 'getConstants'
| 'getProposalsData'
| 'getRepresentationData',
): FunctionFragment;

encodeFunctionData(
functionFragment: "getConstants",
values: [string, BigNumberish[]]
functionFragment: 'getConstants',
values: [string, BigNumberish[]],
): string;
encodeFunctionData(
functionFragment: "getProposalsData",
values: [string, BigNumberish, BigNumberish, BigNumberish]
functionFragment: 'getProposalsData',
values: [string, BigNumberish, BigNumberish, BigNumberish],
): string;
encodeFunctionData(
functionFragment: "getRepresentationData",
values: [string, string, BigNumberish[]]
functionFragment: 'getRepresentationData',
values: [string, string, BigNumberish[]],
): string;

decodeFunctionResult(
functionFragment: "getConstants",
data: BytesLike
functionFragment: 'getConstants',
data: BytesLike,
): Result;
decodeFunctionResult(
functionFragment: "getProposalsData",
data: BytesLike
functionFragment: 'getProposalsData',
data: BytesLike,
): Result;
decodeFunctionResult(
functionFragment: "getRepresentationData",
data: BytesLike
functionFragment: 'getRepresentationData',
data: BytesLike,
): Result;

events: {};
Expand All @@ -234,15 +234,15 @@ export interface GovernanceDataHelper extends BaseContract {
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
toBlock?: string | number | undefined,
): Promise<Array<TEvent>>;

listeners<TEvent extends TypedEvent>(
eventFilter?: TypedEventFilter<TEvent>
eventFilter?: TypedEventFilter<TEvent>,
): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(
eventFilter: TypedEventFilter<TEvent>
eventFilter: TypedEventFilter<TEvent>,
): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
Expand All @@ -254,80 +254,80 @@ export interface GovernanceDataHelper extends BaseContract {
getConstants(
govCore: string,
accessLevels: BigNumberish[],
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<[IGovernanceDataHelper.ConstantsStructOutput]>;

getProposalsData(
govCore: string,
from: BigNumberish,
to: BigNumberish,
pageSize: BigNumberish,
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<[IGovernanceDataHelper.ProposalStructOutput[]]>;

getRepresentationData(
govCore: string,
wallet: string,
chainIds: BigNumberish[],
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<
[
IGovernanceDataHelper.RepresentativesStructOutput[],
IGovernanceDataHelper.RepresentedStructOutput[]
IGovernanceDataHelper.RepresentedStructOutput[],
]
>;
};

getConstants(
govCore: string,
accessLevels: BigNumberish[],
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<IGovernanceDataHelper.ConstantsStructOutput>;

getProposalsData(
govCore: string,
from: BigNumberish,
to: BigNumberish,
pageSize: BigNumberish,
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<IGovernanceDataHelper.ProposalStructOutput[]>;

getRepresentationData(
govCore: string,
wallet: string,
chainIds: BigNumberish[],
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<
[
IGovernanceDataHelper.RepresentativesStructOutput[],
IGovernanceDataHelper.RepresentedStructOutput[]
IGovernanceDataHelper.RepresentedStructOutput[],
]
>;

callStatic: {
getConstants(
govCore: string,
accessLevels: BigNumberish[],
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<IGovernanceDataHelper.ConstantsStructOutput>;

getProposalsData(
govCore: string,
from: BigNumberish,
to: BigNumberish,
pageSize: BigNumberish,
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<IGovernanceDataHelper.ProposalStructOutput[]>;

getRepresentationData(
govCore: string,
wallet: string,
chainIds: BigNumberish[],
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<
[
IGovernanceDataHelper.RepresentativesStructOutput[],
IGovernanceDataHelper.RepresentedStructOutput[]
IGovernanceDataHelper.RepresentedStructOutput[],
]
>;
};
Expand All @@ -338,45 +338,45 @@ export interface GovernanceDataHelper extends BaseContract {
getConstants(
govCore: string,
accessLevels: BigNumberish[],
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<BigNumber>;

getProposalsData(
govCore: string,
from: BigNumberish,
to: BigNumberish,
pageSize: BigNumberish,
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<BigNumber>;

getRepresentationData(
govCore: string,
wallet: string,
chainIds: BigNumberish[],
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<BigNumber>;
};

populateTransaction: {
getConstants(
govCore: string,
accessLevels: BigNumberish[],
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<PopulatedTransaction>;

getProposalsData(
govCore: string,
from: BigNumberish,
to: BigNumberish,
pageSize: BigNumberish,
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<PopulatedTransaction>;

getRepresentationData(
govCore: string,
wallet: string,
chainIds: BigNumberish[],
overrides?: CallOverrides
overrides?: CallOverrides,
): Promise<PopulatedTransaction>;
};
}
Loading

0 comments on commit c772112

Please sign in to comment.