Skip to content

Commit 0d85088

Browse files
authored
Merge pull request #1197 from dev-protocol/feat-add-simple-collections
Feat add simple collections
2 parents fe080dc + eb4c195 commit 0d85088

File tree

16 files changed

+1084
-8
lines changed

16 files changed

+1084
-8
lines changed

lib/agent/fixtures/swap/index.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ describe('swap/index.ts', () => {
3030
const expected: (address: string) => SwapContract = (address: string) => {
3131
const contract = new ethers.Contract(address, [...swapAbiV3], provider)
3232
return {
33-
getEstimatedDevForEth: createGetEstimatedDevForEthCaller(
34-
contract,
35-
),
33+
getEstimatedDevForEth: createGetEstimatedDevForEthCaller(contract),
3634
getEstimatedEthForDev: createGetEstimatedEthForDevCaller(contract),
3735
swapEthAndStakeDevCaller: createSwapEthAndStakeDevCaller(contract),
3836
swapEthAndStakeDevPolygonCaller:

lib/common/utils/execute.ts

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,22 @@ import { ethers, BigNumber, providers, utils } from 'ethers'
22
import { TransactionResponse } from '@ethersproject/abstract-provider'
33
import { keys, mergeAll } from 'ramda'
44

5-
type Args = ReadonlyArray<string | boolean | readonly string[] | Uint8Array>
6-
type ArgsWithoutUint8Array = ReadonlyArray<string | boolean | readonly string[]>
5+
import { Positions } from '../../ethereum/s-tokens'
6+
import { Rewards } from '../../ethereum/s-tokens/rewards'
7+
import { Image } from '../../ethereum/simpleCollection/types'
8+
9+
type Args = ReadonlyArray<
10+
| string
11+
| boolean
12+
| readonly string[]
13+
| Uint8Array
14+
| readonly Image[]
15+
| Positions
16+
| Rewards
17+
>
18+
type ArgsWithoutUint8Array = ReadonlyArray<
19+
string | boolean | readonly string[] | readonly Image[] | Positions | Rewards
20+
>
721
type Overrides = {
822
readonly gasLimit?: number
923
readonly from?: string
@@ -48,7 +62,14 @@ export type ExecuteFunction = <
4862
>
4963
type PadCaller = (
5064
arr: ArgsWithoutUint8Array,
51-
v: string | boolean | undefined | readonly string[],
65+
v:
66+
| string
67+
| boolean
68+
| undefined
69+
| readonly string[]
70+
| readonly Image[]
71+
| Positions
72+
| Rewards,
5273
i: number,
5374
fn: PadCaller
5475
) => ArgsWithoutUint8Array
@@ -59,7 +80,14 @@ const pad = (
5980
((fn: PadCaller): ArgsWithoutUint8Array => fn([], args[0], 0, fn))(
6081
(
6182
arr: ArgsWithoutUint8Array,
62-
v: string | boolean | undefined | readonly string[],
83+
v:
84+
| string
85+
| boolean
86+
| undefined
87+
| readonly string[]
88+
| readonly Image[]
89+
| Positions
90+
| Rewards,
6391
i: number,
6492
fn: PadCaller
6593
): ArgsWithoutUint8Array =>

lib/ethereum/contract.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { createMetricsContract } from './metrics'
1919
import { createPolicyFactoryContract } from './policy-factory'
2020
import { createSTokensContract } from './s-tokens'
2121
import { createMetricsGroupContract } from './metrics-group'
22+
import { createSimpleCollectionsContract } from './simpleCollection'
2223

2324
describe('contract.ts', () => {
2425
describe('createDevkitContract', () => {
@@ -42,6 +43,7 @@ describe('contract.ts', () => {
4243
metricsGroup: createMetricsGroupContract(provider),
4344
policyFactory: createPolicyFactoryContract(provider),
4445
sTokens: createSTokensContract(provider),
46+
simpleCollections: createSimpleCollectionsContract(provider)
4547
}
4648

4749
const result = createDevkitContract(provider)

lib/ethereum/contract.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { createMetricsContract } from './metrics'
1616
import { createPolicyFactoryContract } from './policy-factory'
1717
import { createSTokensContract } from './s-tokens'
1818
import { createMetricsGroupContract } from './metrics-group'
19+
import { createSimpleCollectionsContract } from './simpleCollection'
1920

2021
export type DevkitContract = {
2122
readonly allocator: ReturnType<typeof createAllocatorContract>
@@ -33,6 +34,7 @@ export type DevkitContract = {
3334
readonly metricsGroup: ReturnType<typeof createMetricsGroupContract>
3435
readonly policyFactory: ReturnType<typeof createPolicyFactoryContract>
3536
readonly sTokens: ReturnType<typeof createSTokensContract>
37+
readonly simpleCollections: ReturnType<typeof createSimpleCollectionsContract>
3638
}
3739
export type ContractFactory = (ethersProvider: BaseProvider) => DevkitContract
3840
export type CreateDevkitContract = (provider: BaseProvider) => DevkitContract
@@ -55,6 +57,7 @@ export const createDevkitContract: CreateDevkitContract = (
5557
metricsGroup: createMetricsGroupContract(provider),
5658
policyFactory: createPolicyFactoryContract(provider),
5759
sTokens: createSTokensContract(provider),
60+
simpleCollections: createSimpleCollectionsContract(provider),
5861
})
5962

6063
export const contractFactory: ContractFactory = createDevkitContract

0 commit comments

Comments
 (0)