본문으로 건너뛰기

스테이킹 및 거버넌스 SDK

다음은 staking 및 governance와 상호작용하는 예시이다. 이러한 함수는 일반적으로 balanceManagerKey, poolKey, 또는 둘 다를 요구한다. 이러한 key에 대한 자세한 내용은 DeepBookV3 SDK를 참조하라. SDK에는 constants.ts 파일에서 볼 수 있는 몇 가지 기본 key가 포함되어 있다.

staking 및 governance API에 대한 자세한 내용은 스테이킹 및 거버넌스를 참조하라.

Staking and governance functions

stake

stake를 사용하여 사용자가 지정한 amount를 특정 pool에 stake한다. 이 호출은 Transaction object를 반환한다.

Parameters

  • poolKey: pool을 식별하는 String이다.
  • balanceManagerKey: balance manager를 식별하는 String이다.
  • stakeAmount: stake할 amount를 나타내는 Number이다.
stake(poolKey: string, balanceManagerKey: string, stakeAmount: number);

unstake

unstake를 사용하여 특정 pool에서 unstake한다. 이 호출은 Transaction object를 반환한다.

Parameters

  • poolKey: pool을 식별하는 String이다.
  • balanceManagerKey: balance manager를 식별하는 String이다.
unstake(poolKey: string, balanceManagerKey: string);

submitProposal

submitProposal를 사용하여 governance proposal을 제출한다. 이 호출은 Transaction object를 반환한다.

Parameters

  • params: proposal을 정의하는 ProposalParams object이다.
submitProposal({ params: ProposalParams });

vote

vote를 사용하여 proposal에 투표한다. 이 호출은 Transaction object를 반환한다.

Parameters

  • poolKey: pool을 식별하는 String이다.
  • balanceManagerKey: balance manager를 식별하는 String이다.
  • proposal_id: 투표할 proposal을 식별하는 String이다.
vote(poolKey: string, balanceManagerKey: string, proposal_id: string)

claimRebates

claimRebates를 사용하여 특정 pool의 balance manager에 대한 maker/taker rebate를 클레임한다. 이 호출은 Transaction object를 받는 함수를 반환한다.

Parameters

  • poolKey: pool을 식별하는 String이다.
  • balanceManagerKey: balance manager를 식별하는 String이다.

Examples

다음 예시는 DeepBookMarketMaker class에 넣을 수 있는 custom staking 및 governance 함수를 보여준다.

stake custom function

stake = (
poolKey: string,
balanceManagerKey: string,
stakeAmount: number
) => (tx: Transaction) => {}

// DeepBookMarketMaker class에서 DEEP 100을 stake하는 custom function
stake = (tx: Transaction) => {
const poolKey = 'DBUSDT_DBUSDC';
const balanceManagerKey = 'MANAGER_1';
tx.add(this.governance.stake(poolKey, balanceManagerKey, 100));
};

unstake custom function

unstake = (
poolKey: string,
balanceManagerKey: string
) => (tx: Transaction) => {}

// DeepBookMarketMaker class에서 unstake하는 custom function
unstake = (tx: Transaction) => {
const poolKey = 'DBUSDT_DBUSDC';
const balanceManagerKey = 'MANAGER_1';
tx.add(this.governance.unstake(poolKey, balanceManagerKey));
};

submitProposal custom function

// proposal용 params
export interface ProposalParams {
poolKey: string;
balanceManagerKey: string;
takerFee: number;
makerFee: number;
stakeRequired: number;
}

submitProposal = (params: ProposalParams) => (tx: Transaction) => {}

// DeepBookMarketMaker class에서 proposal을 제출하는 custom function
submitProposal = (tx: Transaction) => {
const poolKey = 'DBUSDT_DBUSDC';
const balanceManagerKey = 'MANAGER_1';
tx.add(
this.governance.submitProposal({
poolKey,
balanceManagerKey,
takerFee: 0.002,
makerFee: 0.001,
stakeRequired: 100,
}),
);
};

vote custom function

vote = (
poolKey: string,
balanceManagerKey: string,
proposal_id: string
) => (tx: Transaction) => {}

// DeepBookMarketMaker class에서 투표하는 custom function
vote = (tx: Transaction) => {
const poolKey = 'DBUSDT_DBUSDC';
const balanceManagerKey = 'MANAGER_1';
const proposalID = '0x123456789';
tx.add(this.governance.vote(poolKey, balanceManagerKey, proposalID));
};