Skip to content

Commit

Permalink
chore: export kashi constants
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlilley committed Aug 21, 2021
1 parent 7741ee0 commit ebc49f4
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import JSBI from "jsbi";

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

export const INIT_CODE_HASH: string =
"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303";
Expand Down
65 changes: 65 additions & 0 deletions src/constants/kashi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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");

0 comments on commit ebc49f4

Please sign in to comment.