Skip to content

Commit f4b0b84

Browse files
authored
Merge pull request #1207 from dev-protocol/lint
Lint
2 parents 1d83843 + 6ce5c63 commit f4b0b84

File tree

232 files changed

+731
-668
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+731
-668
lines changed

examples/get-property-info.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { contractFactory, addresses } from '@devprotocol/dev-kit'
44
// use main net
55
const registryContractAddress = addresses.eth.main.registry
66
const provider = new ethers.providers.JsonRpcProvider(
7-
process.env.WEB3_PROVIDER_URL
7+
process.env.WEB3_PROVIDER_URL,
88
)
99
const contract = contractFactory(provider)
1010
const propertyAddress = '0xac1AC9d00314aE7B4a7d6DbEE4860bECedF92309'
@@ -16,16 +16,16 @@ const propertyStakingAmount = await contract
1616
.lockup(lockupContractAddress)
1717
.getPropertyValue(propertyAddress)
1818
const stakingAmount = ethers.BigNumber.from(propertyStakingAmount).div(
19-
new ethers.BigNumber.from(10).pow(18)
19+
new ethers.BigNumber.from(10).pow(18),
2020
)
2121
console.log(
22-
`${propertyAddress}'s staking amount is ${stakingAmount.toBigInt()} DEV`
22+
`${propertyAddress}'s staking amount is ${stakingAmount.toBigInt()} DEV`,
2323
)
2424

2525
const propertyRewards = await contract
2626
.lockup(lockupContractAddress)
2727
.calculateRewardAmount(propertyAddress)
2828
const reward = ethers.BigNumber.from(propertyRewards[0]).div(
29-
new ethers.BigNumber.from(10).pow(36)
29+
new ethers.BigNumber.from(10).pow(36),
3030
)
3131
console.log(`${propertyAddress}'s rewards is ${reward.toBigInt()} DEV`)

examples/get-stoken-info.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { contractFactory, addresses } from '@devprotocol/dev-kit'
44
// use main net
55
const contractAddress = addresses.eth.main.sTokens
66
const provider = new ethers.providers.JsonRpcProvider(
7-
process.env.WEB3_PROVIDER_URL
7+
process.env.WEB3_PROVIDER_URL,
88
)
99
const contract = contractFactory(provider)
1010
const propertyAddress = '0xac1AC9d00314aE7B4a7d6DbEE4860bECedF92309'
@@ -34,6 +34,6 @@ const res = await Promise.all(
3434
const positions = await getSTokenPositions(contract, sTokenId)
3535
const rewards = await getSTokenRewards(contract, sTokenId)
3636
return { sTokenId, positions, rewards }
37-
})
37+
}),
3838
)
3939
console.log(res)

lib/agent/common/approveIfNeeded.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export type ApproveIfNeeded = (factoryOptions: {
4848
readonly to?: string
4949
readonly token?: string
5050
readonly callback: (
51-
receipt?: TransactionReceipt
51+
receipt?: TransactionReceipt,
5252
) => Promise<TransactionResponse>
5353
}) => Promise<UndefinedOr<ApproveIfNeededResult>>
5454

@@ -58,7 +58,7 @@ export const approveIfNeeded: ApproveIfNeeded = async (factoryOptions) => {
5858
: await clientsDev(factoryOptions.provider).then(([l1, l2]) => l1 ?? l2)
5959
const allowance = await whenDefinedAll(
6060
[client, factoryOptions.to],
61-
([x, to]) => x.allowance(factoryOptions.from, to)
61+
([x, to]) => x.allowance(factoryOptions.from, to),
6262
)
6363

6464
return whenDefinedAll([client, factoryOptions.to], ([dev, to]) => {
@@ -69,7 +69,7 @@ export const approveIfNeeded: ApproveIfNeeded = async (factoryOptions) => {
6969
const res = await dev.approve(
7070
to,
7171
options?.amount ?? factoryOptions.requiredAmount,
72-
options?.overrides
72+
options?.overrides,
7373
)
7474
return {
7575
...res,

lib/agent/common/clients/clientsDev.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Results = readonly [UndefinedOr<DevContract>, UndefinedOr<DevContractL2>]
1313
const cache: WeakMap<ContractRunner, Results> = new WeakMap()
1414

1515
export const clientsDev = async (
16-
provider: ContractRunner
16+
provider: ContractRunner,
1717
): Promise<Results> => {
1818
const res =
1919
cache.get(provider) ??
@@ -26,8 +26,8 @@ export const clientsDev = async (
2626
const l2 = ((data) =>
2727
data ? createDevContractL2(provider)(data.map.token) : undefined)(
2828
l2AvailableNetworks.find(
29-
({ chainId }) => chainId === Number(net?.chainId)
30-
)
29+
({ chainId }) => chainId === Number(net?.chainId),
30+
),
3131
)
3232
const results: Results = [l1, l2]
3333
// eslint-disable-next-line functional/no-expression-statement

lib/agent/common/clients/clientsLockup.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import { ContractRunner } from 'ethers'
1010

1111
type Results = readonly [
1212
UndefinedOr<LockupContract>,
13-
UndefinedOr<LockupContractL2>
13+
UndefinedOr<LockupContractL2>,
1414
]
1515

1616
const cache: WeakMap<ContractRunner, Results> = new WeakMap()
1717

1818
export const clientsLockup = async (
19-
provider: ContractRunner
19+
provider: ContractRunner,
2020
): Promise<Results> => {
2121
const res =
2222
cache.get(provider) ??
@@ -29,8 +29,8 @@ export const clientsLockup = async (
2929
const l2 = ((data) =>
3030
data ? createLockupContractL2(provider)(data.map.lockup) : undefined)(
3131
l2AvailableNetworks.find(
32-
({ chainId }) => chainId === Number(net?.chainId)
33-
)
32+
({ chainId }) => chainId === Number(net?.chainId),
33+
),
3434
)
3535
const results: Results = [l1, l2]
3636
// eslint-disable-next-line functional/no-expression-statement

lib/agent/common/clients/clientsMarketFactory.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import { ContractRunner } from 'ethers'
1313

1414
type Results = readonly [
1515
UndefinedOr<MarketFactoryContract>,
16-
UndefinedOr<MarketFactoryContractL2>
16+
UndefinedOr<MarketFactoryContractL2>,
1717
]
1818

1919
const cache: WeakMap<ContractRunner, Results> = new WeakMap()
2020

2121
export const clientsMarketFactory = async (
22-
provider: ContractRunner
22+
provider: ContractRunner,
2323
): Promise<Results> => {
2424
const res =
2525
cache.get(provider) ??
@@ -34,8 +34,8 @@ export const clientsMarketFactory = async (
3434
? createMarketFactoryContractL2(provider)(data.map.marketFactory)
3535
: undefined)(
3636
l2AvailableNetworks.find(
37-
({ chainId }) => chainId === Number(net?.chainId)
38-
)
37+
({ chainId }) => chainId === Number(net?.chainId),
38+
),
3939
)
4040
const results: Results = [l1, l2]
4141
// eslint-disable-next-line functional/no-expression-statement

lib/agent/common/clients/clientsMetricsFactory.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type Results = readonly [undefined, UndefinedOr<MetricsFactoryContractL2>]
1111
const cache: WeakMap<ContractRunner, Results> = new WeakMap()
1212

1313
export const clientsMetricsFactory = async (
14-
provider: ContractRunner
14+
provider: ContractRunner,
1515
): Promise<Results> => {
1616
const res =
1717
cache.get(provider) ??
@@ -23,8 +23,8 @@ export const clientsMetricsFactory = async (
2323
? createMetricsFactoryContractL2(provider)(data.map.metricsFactory)
2424
: undefined)(
2525
l2AvailableNetworks.find(
26-
({ chainId }) => chainId === Number(net?.chainId)
27-
)
26+
({ chainId }) => chainId === Number(net?.chainId),
27+
),
2828
)
2929
const results: Results = [l1, l2]
3030
// eslint-disable-next-line functional/no-expression-statement

lib/agent/common/clients/clientsMetricsGroup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type Results = readonly [UndefinedOr<CreateMetricsGroupContract>, undefined]
1111
const cache: WeakMap<ContractRunner, Results> = new WeakMap()
1212

1313
export const clientsMetricsGroup = async (
14-
provider: ContractRunner
14+
provider: ContractRunner,
1515
): Promise<Results> => {
1616
const res =
1717
cache.get(provider) ??

lib/agent/common/clients/clientsPolicy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import { ContractRunner } from 'ethers'
99

1010
type Results = readonly [
1111
UndefinedOr<PolicyContract>,
12-
UndefinedOr<PolicyContractL2>
12+
UndefinedOr<PolicyContractL2>,
1313
]
1414

1515
// eslint-disable-next-line functional/prefer-readonly-type
1616
const cache: WeakMap<ContractRunner, Results> = new WeakMap()
1717

1818
export const clientsPolicy = async (
19-
provider: ContractRunner
19+
provider: ContractRunner,
2020
): Promise<Results> => {
2121
const res =
2222
cache.get(provider) ??
@@ -27,7 +27,7 @@ export const clientsPolicy = async (
2727
: undefined
2828
const l2 = registryl2
2929
? createPolicyContractL2(provider)(
30-
await registryl2.registries('Policy')
30+
await registryl2.registries('Policy'),
3131
)
3232
: undefined
3333

lib/agent/common/clients/clientsProperty.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import { ContractRunner } from 'ethers'
1313

1414
type Results = readonly [
1515
UndefinedOr<PropertyContract>,
16-
UndefinedOr<PropertyContractL2>
16+
UndefinedOr<PropertyContractL2>,
1717
]
1818

1919
// eslint-disable-next-line functional/prefer-readonly-type
2020
const cache: WeakMap<ContractRunner, Map<string, Results>> = new WeakMap()
2121

2222
export const clientsProperty = async (
2323
provider: ContractRunner,
24-
tokenAddress: string
24+
tokenAddress: string,
2525
): Promise<Results> => {
2626
const res =
2727
cache.get(provider)?.get(tokenAddress) ??
@@ -34,8 +34,8 @@ export const clientsProperty = async (
3434
const l2 = ((data) =>
3535
data ? createPropertyContractL2(provider)(tokenAddress) : undefined)(
3636
l2AvailableNetworks.find(
37-
({ chainId }) => chainId === Number(net?.chainId)
38-
)
37+
({ chainId }) => chainId === Number(net?.chainId),
38+
),
3939
)
4040
const results: Results = [l1, l2]
4141
const map = cache.get(provider)
@@ -44,7 +44,7 @@ export const clientsProperty = async (
4444
provider,
4545
map
4646
? map.set(tokenAddress, results)
47-
: new Map([[tokenAddress, results]])
47+
: new Map([[tokenAddress, results]]),
4848
)
4949
return results
5050
})())

0 commit comments

Comments
 (0)