Skip to content

Commit

Permalink
refactor: latest nibijs
Browse files Browse the repository at this point in the history
  • Loading branch information
CalicoNino committed Sep 18, 2023
1 parent f8341c3 commit 7e958cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/nibijs/docs/classes/StableSwap.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ y()
Calculate x[j] if one makes x[i] = x

Done by solving quadratic equation iteratively.
x_1**2 + x1 * (sum' - (A*n**n - 1) _ D / (A _ n**n)) = D ** (n+1)/(n ** (2 _ n) _ prod' \* A)
x_1**2 + b\*x_1 = c
x*1**2 + x1 * (sum' - (A*n**n - 1) * D / (A _ n**n)) = D ** (n+1)/(n \*\* (2 _ n) \_ prod' \* A)
x_1\*\*2 + b\*x_1 = c

x_1 = (x_1\**2 + c) / (2*x_1 + b)

Expand Down
13 changes: 10 additions & 3 deletions packages/nibijs/src/msg/perp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ export const isMsgDonateToEcosystemFundEncodeObject = (
(encodeObject as MsgDonateToEcosystemFundEncodeObject).typeUrl ===
PERP_MSG_TYPE_URLS.MsgDonateToEcosystemFund

export interface MsgPartialClosEncodeObject extends EncodeObject {
export interface MsgPartialCloseEncodeObject extends EncodeObject {
readonly typeUrl: string
readonly value: Partial<MsgDonateToEcosystemFund>
}

export const isMsgPartialClosEncodeObject = (encodeObject: EncodeObject) =>
(encodeObject as MsgPartialClosEncodeObject).typeUrl ===
export const isMsgPartialCloseEncodeObject = (encodeObject: EncodeObject) =>
(encodeObject as MsgPartialCloseEncodeObject).typeUrl ===
PERP_MSG_TYPE_URLS.MsgPartialClose

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -159,6 +159,13 @@ export class PerpMsgFactory {
}
}

static partialClosePosition(msg: MsgPartialClose): TxMessage {
return {
typeUrl: PERP_MSG_TYPE_URLS.MsgPartialClose,
value: MsgPartialClose.fromPartial(msg),
}
}

static donateToPerpEF(msg: MsgDonateToEcosystemFund): TxMessage {
return {
typeUrl: PERP_MSG_TYPE_URLS.MsgDonateToEcosystemFund,
Expand Down

0 comments on commit 7e958cb

Please sign in to comment.