Skip to content

Implement L2 APIs #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 24 additions & 0 deletions lib/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,28 @@ export const addresses = {
sTokens: '0x0000000000000000000000000000000000000000',
},
},
arbitrumOne: {
main: {
token: '0x0000000000000000000000000000000000000000',
lockup: '0x0000000000000000000000000000000000000000',
marketFactory: '0x0000000000000000000000000000000000000000',
metricsFactory: '0x0000000000000000000000000000000000000000',
policyFactory: '0x0000000000000000000000000000000000000000',
propertyFactory: '0x0000000000000000000000000000000000000000',
registry: '0x0000000000000000000000000000000000000000',
sTokens: '0x0000000000000000000000000000000000000000',
withdraw: '0x0000000000000000000000000000000000000000',
},
rinkeby: {
token: '0x0000000000000000000000000000000000000000',
lockup: '0x0000000000000000000000000000000000000000',
marketFactory: '0x0000000000000000000000000000000000000000',
metricsFactory: '0x0000000000000000000000000000000000000000',
policyFactory: '0x0000000000000000000000000000000000000000',
propertyFactory: '0x0000000000000000000000000000000000000000',
registry: '0x0000000000000000000000000000000000000000',
sTokens: '0x0000000000000000000000000000000000000000',
withdraw: '0x0000000000000000000000000000000000000000',
},
},
} as const
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import Web3 from 'web3'
import { metricsFactoryAbi } from '../metrics-factory/abi'
import { metricsAbi } from '../metrics/abi'
import { watchEvent } from '../utils/watchEvent'
import { AbiItem } from 'web3-utils'
import { watchEvent } from '../../common/utils/watchEvent'
import { execute } from './execute'

const metricsFactoryAbi = [
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: '_market',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: '_property',
type: 'address',
},
{
indexed: false,
internalType: 'address',
name: '_metrics',
type: 'address',
},
],
name: 'Create',
type: 'event',
},
] as readonly AbiItem[]
const metricsAbi = [
{
inputs: [],
name: 'property',
outputs: [
{
internalType: 'address',
name: '',
type: 'address',
},
],
stateMutability: 'view',
type: 'function',
},
] as readonly AbiItem[]
const getMetricsProperty = async (
address: string,
client: Web3
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { always } from 'ramda'

export type CreateCalculateMaxRewardsPerBlockCaller = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Web3 from 'web3'
import { CustomOptions } from '../option'
import { CustomOptions } from '../../common/option'
import { createAllocatorContract, CreateAllocatorContract } from '.'
import { createCalculateMaxRewardsPerBlockCaller } from './calculateMaxRewardsPerBlock'
import { allocatorAbi } from './abi'
Expand Down
2 changes: 1 addition & 1 deletion lib/allocator/index.ts → lib/ethereum/allocator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Web3 from 'web3'
import { Contract } from 'web3-eth-contract/types'
import { allocatorAbi } from './abi'
import { CustomOptions } from '../option'
import { CustomOptions } from '../../common/option'
import { createCalculateMaxRewardsPerBlockCaller } from './calculateMaxRewardsPerBlock'
import { always } from 'ramda'

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/client/getStats.ts → lib/ethereum/client/getStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import bent from 'bent'
import BigNumber from 'bignumber.js'
import Web3 from 'web3'
import { always } from 'ramda'
import { addresses } from '../addresses'
import { addresses } from '../../addresses'
import { createDevkitContract, DevkitContract } from '../contract'
import { DEV_GRAPHQL_ENDPOINT } from '../utils/const'
import { DEV_GRAPHQL_ENDPOINT } from '../../common/utils/const'

const THEGRAPH_UNISWAP_ENDPOINT =
'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import bent from 'bent'
import { always, not } from 'ramda'
import { aFindIndex } from 'async-ray'
import { PolicyGroupContract } from '../policy-group'
import { DEV_GRAPHQL_ENDPOINT } from '../utils/const'
import { DEV_GRAPHQL_ENDPOINT } from '../../common/utils/const'

export type CreateGetVotablePolicyCaller = (
policyGroup: PolicyGroupContract
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createDepositCaller } from './deposit'
import { stubbedWeb3, stubbedSendTx } from '../utils/for-test'
import { stubbedWeb3, stubbedSendTx } from '../../common/utils/for-test'

describe('deposit.spec.ts', () => {
describe('createDepositCaller', () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/dev/deposit.ts → lib/ethereum/dev/deposit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import Web3 from 'web3'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { T } from 'ramda'

export type CreateDepositCaller = (
Expand Down
2 changes: 1 addition & 1 deletion lib/dev/index.spec.ts → lib/ethereum/dev/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Web3 from 'web3'
import { createDevContract, DevContract } from '.'
import { createTransferCaller } from './../erc20/transfer'
import { devAbi } from './abi'
import { CustomOptions } from '../option'
import { CustomOptions } from '../../common/option'
import { createDepositCaller } from './deposit'
import { createBalanceOfCaller } from './../erc20/balanceOf'
import { createTotalSupplyCaller } from './../erc20/totalSupply'
Expand Down
2 changes: 1 addition & 1 deletion lib/dev/index.ts → lib/ethereum/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Web3 from 'web3'
import { always } from 'ramda'
import { Contract } from 'web3-eth-contract/types'
import { devAbi } from './abi'
import { CustomOptions } from '../option'
import { CustomOptions } from '../../common/option'
import { createTransferCaller } from './../erc20/transfer'
import { createBalanceOfCaller } from './../erc20/balanceOf'
import { createTotalSupplyCaller } from './../erc20/totalSupply'
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/erc20/allowance.ts → lib/ethereum/erc20/allowance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'

export type CreateAllowanceCaller = (
contract: Contract
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createApproveCaller } from './approve'
import { stubbedWeb3, stubbedSendTx } from '../utils/for-test'
import { stubbedWeb3, stubbedSendTx } from '../../common/utils/for-test'

describe('approve.spec.ts', () => {
describe('createApproveCaller', () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/erc20/approve.ts → lib/ethereum/erc20/approve.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import Web3 from 'web3'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { T } from 'ramda'

export type CreateApproveCaller = (
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/erc20/balanceOf.ts → lib/ethereum/erc20/balanceOf.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'

export type CreateBalanceOfCaller = (
contract: Contract
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/erc20/decimals.ts → lib/ethereum/erc20/decimals.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { always } from 'ramda'

export type CreateDecimalsCaller = (contract: Contract) => () => Promise<string>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/erc20/name.ts → lib/ethereum/erc20/name.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { always } from 'ramda'

export type CreateNameCaller = (contract: Contract) => () => Promise<string>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/erc20/symbol.ts → lib/ethereum/erc20/symbol.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { always } from 'ramda'

export type CreateSymbolCaller = (contract: Contract) => () => Promise<string>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { always } from 'ramda'

export type CreateTotalSupplyCaller = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createTransferCaller } from './transfer'
import { stubbedWeb3, stubbedSendTx } from '../utils/for-test'
import { stubbedWeb3, stubbedSendTx } from '../../common/utils/for-test'

describe('transfer.spec.ts', () => {
describe('createTransferCaller', () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/erc20/transfer.ts → lib/ethereum/erc20/transfer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import Web3 from 'web3'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { T } from 'ramda'

export type CreateTransferCaller = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createTransferFromCaller } from './transferFrom'
import { stubbedWeb3, stubbedSendTx } from '../utils/for-test'
import { stubbedWeb3, stubbedSendTx } from '../../common/utils/for-test'

describe('transferFrom.spec.ts', () => {
describe('createTransferFromCaller', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import Web3 from 'web3'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { T } from 'ramda'

export type CreateTransferFromCaller = (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'

export type CreateCalculateCumulativeHoldersRewardAmountCaller = (
contract: Contract
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { always } from 'ramda'
import { arrayify } from '../utils/arrayify'
import { arrayify } from '../../common/utils/arrayify'

export type CreateCalculateCumulativeRewardPricesCaller = (
contract: Contract
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { arrayify } from '../utils/arrayify'
import { execute } from '../utils/execute'
import { arrayify } from '../../common/utils/arrayify'
import { execute } from '../../common/utils/execute'

export type CreateCalculateRewardAmountCaller = (
contract: Contract
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'

export type CreateCalculateWithdrawableInterestAmountCaller = (
contract: Contract
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'

export type CreatecalculateWithdrawableInterestAmountByPositionCaller = (
contract: Contract
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/lockup/cap.ts → lib/ethereum/lockup/cap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { always } from 'ramda'

export type CreateCapCaller = (contract: Contract) => () => Promise<string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createDepositToPositionCaller } from './depositToPosition'
import { stubbedWeb3, stubbedSendTx } from '../utils/for-test'
import { stubbedWeb3, stubbedSendTx } from '../../common/utils/for-test'

describe('depositToPosition.spec.ts', () => {
describe('createDepositToPositionCaller', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import Web3 from 'web3'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { T } from 'ramda'

export type CreateDepositToPositionCaller = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createDepositToPropertyCaller } from './depositToProperty'
import { stubbedWeb3, stubbedSendTx } from '../utils/for-test'
import { stubbedWeb3, stubbedSendTx } from '../../common/utils/for-test'

describe('depositToProperty.spec.ts', () => {
describe('createDepositToPropertyCaller', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import Web3 from 'web3'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { T } from 'ramda'

export type CreateDepositToPropertyCaller = (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'
import { always } from 'ramda'

export type CreateGetAllValueCaller = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'

export type CreateGetPropertyValueCaller = (
contract: Contract
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'

export type CreateGetStorageWithdrawalStatusCaller = (
contract: Contract
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/lockup/getValue.ts → lib/ethereum/lockup/getValue.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { Contract } from 'web3-eth-contract/types'
import { execute } from '../utils/execute'
import { execute } from '../../common/utils/execute'

export type CreateGetValueCaller = (
contract: Contract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Web3 from 'web3'
import { createLockupContract, LockupContract } from '.'
import { createGetValueCaller } from './getValue'
import { lockupAbi } from './abi'
import { CustomOptions } from '../option'
import { CustomOptions } from '../../common/option'
import { createGetPropertyValueCaller } from './getPropertyValue'
import { createWithdrawCaller } from './withdraw'
import { createCalculateWithdrawableInterestAmountCaller } from './calculateWithdrawableInterestAmount'
Expand Down
2 changes: 1 addition & 1 deletion lib/lockup/index.ts → lib/ethereum/lockup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Web3 from 'web3'
import { Contract } from 'web3-eth-contract/types'
import { lockupAbi } from './abi'
import { CustomOptions } from '../option'
import { CustomOptions } from '../../common/option'
import { createGetValueCaller } from './getValue'
import { createGetPropertyValueCaller } from './getPropertyValue'
import { createWithdrawCaller } from './withdraw'
Expand Down
Loading