Skip to content

Commit

Permalink
Merge branch 'canary' of https://github.com/sushiswap/sushiswap-sdk i…
Browse files Browse the repository at this point in the history
…nto multirouting
  • Loading branch information
Okavango committed Aug 24, 2021
2 parents 559c557 + 1c01f88 commit c442196
Show file tree
Hide file tree
Showing 84 changed files with 4,244 additions and 5,278 deletions.
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
...require("@sushiswap/prettier-config")
...require("@sushiswap/prettier-config").default
};
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sushiswap/sdk",
"license": "MIT",
"version": "5.0.0-canary.45",
"version": "5.0.0-canary.51",
"description": "🛠 An SDK for building applications on top of SushiSwap.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -53,7 +53,8 @@
"@ethersproject/providers": "^5.4.0",
"@ethersproject/signing-key": "^5.4.0",
"@ethersproject/solidity": "^5.4.0",
"@ethersproject/transactions": "^5.4.0"
"@ethersproject/transactions": "^5.4.0",
"eip-712": "^0.4.3"
},
"devDependencies": {
"@ethersproject/abi": "^5.4.0",
Expand All @@ -68,7 +69,7 @@
"@ethersproject/signing-key": "^5.4.0",
"@ethersproject/solidity": "^5.4.0",
"@ethersproject/transactions": "^5.4.0",
"@sushiswap/core": "2.0.0-canary.1",
"@sushiswap/core": "^2.0.0-canary.1",
"@sushiswap/prettier-config": "^0.1.0",
"@types/big.js": "^6.1.0",
"babel-plugin-transform-jsbi-to-bigint": "^1.4.0",
Expand Down
945 changes: 477 additions & 468 deletions src/constants/addresses.ts

Large diffs are not rendered by default.

34 changes: 15 additions & 19 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
import JSBI from "jsbi";
import JSBI from 'jsbi'

export * from "./addresses";
export * from "./natives";
export * from "./tokens";
export * from "./numbers";
export * from './addresses'
export * from './kashi'
export * from './natives'
export * from './numbers'
export * from './tokens'

export const INIT_CODE_HASH: string =
"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303";
export const INIT_CODE_HASH: string = '0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303'

export const MINIMUM_LIQUIDITY = JSBI.BigInt(1000);
export const MINIMUM_LIQUIDITY = JSBI.BigInt(1000)

export enum SolidityType {
uint8 = "uint8",
uint256 = "uint256"
uint8 = 'uint8',
uint256 = 'uint256'
}

export const SOLIDITY_TYPE_MAXIMA = {
[SolidityType.uint8]: JSBI.BigInt("0xff"),
[SolidityType.uint256]: JSBI.BigInt(
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
)
};
[SolidityType.uint8]: JSBI.BigInt('0xff'),
[SolidityType.uint256]: JSBI.BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff')
}

export const LAMBDA_URL =
"https://9epjsvomc4.execute-api.us-east-1.amazonaws.com/dev";
export const LAMBDA_URL = 'https://9epjsvomc4.execute-api.us-east-1.amazonaws.com/dev'

export const SOCKET_URL =
"wss://hfimt374ge.execute-api.us-east-1.amazonaws.com/dev";
export const SOCKET_URL = 'wss://hfimt374ge.execute-api.us-east-1.amazonaws.com/dev'
61 changes: 61 additions & 0 deletions src/constants/kashi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { BigNumber } from '@ethersproject/bignumber'

// Functions that need accrue to be called
export const ACTION_ADD_ASSET = 1
export const ACTION_REPAY = 2
export const ACTION_REMOVE_ASSET = 3
export const ACTION_REMOVE_COLLATERAL = 4
export const ACTION_BORROW = 5
export const ACTION_GET_REPAY_SHARE = 6
export const ACTION_GET_REPAY_PART = 7
export const ACTION_ACCRUE = 8

// Functions that don't need accrue to be called
export const ACTION_ADD_COLLATERAL = 10
export const ACTION_UPDATE_EXCHANGE_RATE = 11

// Function on BentoBox
export const ACTION_BENTO_DEPOSIT = 20
export const ACTION_BENTO_WITHDRAW = 21
export const ACTION_BENTO_TRANSFER = 22
export const ACTION_BENTO_TRANSFER_MULTIPLE = 23
export const ACTION_BENTO_SETAPPROVAL = 24

// Any external call (except to BentoBox)
export const ACTION_CALL = 30

export const MINIMUM_TARGET_UTILIZATION = BigNumber.from('700000000000000000') // 70%

export const MAXIMUM_TARGET_UTILIZATION = BigNumber.from('800000000000000000') // 80%

export const UTILIZATION_PRECISION = BigNumber.from('1000000000000000000')

export const FULL_UTILIZATION = BigNumber.from('1000000000000000000')

export const FULL_UTILIZATION_MINUS_MAX = FULL_UTILIZATION.sub(MAXIMUM_TARGET_UTILIZATION)

export const STARTING_INTEREST_PER_YEAR = BigNumber.from(317097920)
.mul(BigNumber.from(60))
.mul(BigNumber.from(60))
.mul(BigNumber.from(24))
.mul(BigNumber.from(365)) // approx 1% APR

export const MINIMUM_INTEREST_PER_YEAR = BigNumber.from(79274480)
.mul(BigNumber.from(60))
.mul(BigNumber.from(60))
.mul(BigNumber.from(24))
.mul(BigNumber.from(365)) // approx 0.25% APR

export const MAXIMUM_INTEREST_PER_YEAR = BigNumber.from(317097920000)
.mul(BigNumber.from(60))
.mul(BigNumber.from(60))
.mul(BigNumber.from(24))
.mul(BigNumber.from(365)) // approx 1000% APR

export const INTEREST_ELASTICITY = BigNumber.from('28800000000000000000000000000000000000000') // Half or double in 28800 seconds (8 hours) if linear

export const FACTOR_PRECISION = BigNumber.from('1000000000000000000')

export const PROTOCOL_FEE = BigNumber.from('10000') // 10%

export const PROTOCOL_FEE_DIVISOR = BigNumber.from('100000')
18 changes: 3 additions & 15 deletions src/constants/natives.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
import {
Avalanche,
Binance,
Celo,
Ether,
Fantom,
Harmony,
Heco,
Matic,
Okex,
Palm,
xDai
} from "../entities/Native";
import { Avalanche, Binance, Celo, Ether, Fantom, Harmony, Heco, Matic, Okex, Palm, xDai } from '../entities/Native'

import { ChainId } from "../enums";
import { ChainId } from '../enums'

export const NATIVE = {
[ChainId.MAINNET]: Ether.onChain(ChainId.MAINNET),
Expand All @@ -38,4 +26,4 @@ export const NATIVE = {
[ChainId.OKEX_TESTNET]: Okex.onChain(ChainId.OKEX_TESTNET),
[ChainId.CELO]: Celo.onChain(ChainId.CELO),
[ChainId.PALM]: Palm.onChain(ChainId.PALM)
};
}
24 changes: 11 additions & 13 deletions src/constants/numbers.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import JSBI from "jsbi";
import JSBI from 'jsbi'

export const MaxUint256 = JSBI.BigInt(
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
);
export const MaxUint256 = JSBI.BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff')

// exports for internal consumption
export const ZERO = JSBI.BigInt(0);
export const ONE = JSBI.BigInt(1);
export const TWO = JSBI.BigInt(2);
export const THREE = JSBI.BigInt(3);
export const FIVE = JSBI.BigInt(5);
export const TEN = JSBI.BigInt(10);
export const _100 = JSBI.BigInt(100);
export const _997 = JSBI.BigInt(997);
export const _1000 = JSBI.BigInt(1000);
export const ZERO = JSBI.BigInt(0)
export const ONE = JSBI.BigInt(1)
export const TWO = JSBI.BigInt(2)
export const THREE = JSBI.BigInt(3)
export const FIVE = JSBI.BigInt(5)
export const TEN = JSBI.BigInt(10)
export const _100 = JSBI.BigInt(100)
export const _997 = JSBI.BigInt(997)
export const _1000 = JSBI.BigInt(1000)
Loading

0 comments on commit c442196

Please sign in to comment.