-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from securesecrets/develop
batch query splitting, derivatives queries
- Loading branch information
Showing
36 changed files
with
2,529 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@shadeprotocol/shadejs": patch | ||
--- | ||
|
||
Batch query can split queries to avoid hitting query gas limits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@shadeprotocol/shadejs": minor | ||
--- | ||
|
||
added apy calculations for derivatives and shade staking query interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# APY Calculations | ||
|
||
This page demonstrates how to calculate outputs the shade derivative contracts | ||
|
||
### stkd-SCRT APY | ||
Calculates the apy expected for the stkd-SCRT token | ||
```ts | ||
/** | ||
* Will calculate APY for the stkd secret derivative contract | ||
* | ||
* returns a number that is the decimal form of the percent APY | ||
* @param lcdEndpoint is not optional due to the requirement of the secretChainQueries() function | ||
*/ | ||
function calculateDerivativeScrtApy({ | ||
queryRouterContractAddress, | ||
queryRouterCodeHash, | ||
contractAddress, | ||
codeHash, | ||
lcdEndpoint, | ||
chainId, | ||
}: { | ||
queryRouterContractAddress: string, | ||
queryRouterCodeHash?: string, | ||
contractAddress: string, | ||
codeHash: string, | ||
lcdEndpoint: string, | ||
chainId?: string, | ||
}): Promise<number> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Shade Staking Examples | ||
|
||
This page demonstrates how to query the shade staking contracts | ||
|
||
## Staking Info | ||
|
||
**input** | ||
|
||
```ts | ||
/** | ||
* query the staking info from the shade staking contract | ||
*/ | ||
async function queryShadeStakingOpportunity({ | ||
shadeStakingContractAddress, | ||
shadeStakingCodeHash, | ||
lcdEndpoint, | ||
chainId, | ||
}: { | ||
shadeStakingContractAddress: string, | ||
shadeStakingCodeHash?: string, | ||
lcdEndpoint?: string, | ||
chainId?: string, | ||
}): Promise<StakingInfoServiceModel> | ||
``` | ||
|
||
**output** | ||
|
||
```ts | ||
type StakingInfoServiceModel = { | ||
stakeTokenAddress: string, | ||
totalStakedRaw: string, | ||
unbondingPeriod: number, | ||
rewardPools: StakingRewardPoolServiceModel[], | ||
} | ||
// type references below | ||
type StakingRewardPoolServiceModel = { | ||
id: string, | ||
amountRaw: string, | ||
startDate: Date, | ||
endDate: Date, | ||
tokenAddress: string, | ||
rateRaw: string, | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { | ||
test, | ||
expect, | ||
} from 'vitest'; | ||
import { msgQueryShadeStakingOpportunity } from './shadeStaking'; | ||
|
||
test('it tests the form of the query staking info msg', () => { | ||
const output = { staking_info: {} }; | ||
expect(msgQueryShadeStakingOpportunity()).toStrictEqual(output); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* message for the getting staking opportunity info from the shade staking contract | ||
*/ | ||
const msgQueryShadeStakingOpportunity = () => ({ staking_info: {} }); | ||
|
||
export { | ||
msgQueryShadeStakingOpportunity, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.