types APIs
- SimpleOptions
- RootState
- User
- ChainType
- FeedbackCategoryAPI
- FeedbackStatusAPI
- FeedbackUserProfileAPI
- NavItems
- SingleNavItem
- NonNullableChildrenDeep
- SingleArticle
- ColumnType
- DataType
- Hub
- PluginConfig
- RawEventMessage
- DualStakingInfo
- StakingInfo
- SyrupInfo
- CommonStakingInfo
- LairInfo
- StakingBasic
- DualStakingBasic
- SyrupBasic
- Questionnaire
- TaskStatuses
- LoginPayload
- SignupPayload
- MutationType
- ProteinSize
- Config
- Themes
- defaults
- CoordinateSpaceInitial
- Background
- Metric
- Metadata
- TManageValue
- Domain
- Organization
- OrganizationTag
- Scan
- ScanSchema
- Query
- SavedSearch
- Role
- ScanTask
- Vulnerability
- GenericObject
- Annotation
- AnnotationList
- VideoAnnotation
- IconName
- IllustrationName
- INotification
- BottomTabScreens
- KYCScreens
- CCVPScreens
- LoginScreens
- PreAuthScreens
- SignUpScreens
- TFAScreens
- PNVScreens
- ProfileScreens
- SecurityScreens
- SMTYFScreens
- WalletScreens
- WithdrawalScreens
- StackNavigationProps
- Coin
- Country
- TransactionStatus
- SetApiActionPayloadInterface
- LoadingStateInterface
- MessageStateInterface
- UiOptionType
- ApiDiffInterface
- ApiStateInterface
- Account
- NFT
- NFTDetails
- AlertType
- DefaultTemplateOptions
- ProviderProps
- AlertTimer
- AlertInstance
- AlertOptions
- TemplateAlertOptions
- AlertContainerFactory
- ChainBase
- ChainNetwork
- WalletId
- ProposalType
- ChainEventNotification
- WebsocketMessageNames
- WebsocketNamespaces
- NotificationCategories
- InviteCodeAttributes
- IPostNotificationData
- ChainCategoryType
- Screens
- NavigationProperty
- IP
- Maybe
- Tuple
- ChainProperties
- ApiPromise
- ApiAction
- BlueprintOptions
- ContractQuery
- ContractOptions
- ContractTx
- KeyringPair
- ContractDryRunParams
- InstantiateData
- SubmittableExtrinsic
- DbState
- OnInstantiateSuccess$Code
- OnInstantiateSuccess$Hash
- InstantiateState
- ApiState
- OrFalsy
- Bytes
- AbiParam
- Registry
- Weight
- SubmittableResult
- Hash
- CodeBundleDocument
- MyCodeBundles
- ContractDocument
- MyContracts
- Database
- DbStatistics
- UserDocument
- QueuedTxOptions
- TransactionsState
- DropdownOption
- DropdownProps
- ValidFormField
- SetState
- BN
- CallResult
- ContractPromise
- RegistryError
- Abi
- TypeDef
- Validation
- FileState
- UseWeight
- ArgComponentProps
- TypeDefInfo
- UseMetadata
- AbiMessage
- AbiConstructor
- InstantiateProps
- CodeSubmittableResult
- BlueprintSubmittableResult
- BlueprintPromise
- Step2FormData
- TxOptions
- TransactionsQueue
- Keyring
- DbQuery
- UseBalance
- CodeBundle
- ValidateFn
- MetadataState
- UseStepper
- UseToggle
- Party
- Restaurant
- BoardMember
- Id
- Label
- Priority
- Avatar
- PriorityValue
- AuthSetup
- IColumn
- Board
- ITask
- TaskComment
- NewTaskComment
- WithTheme
- UserDetail
- TasksByColumn
- NewTask
- ValueOf
- APIResponse
- Nullable
- Currency
- Route
- Author
- Post
- Category
- Watch
- ComputeCallback
Other Related APIs
- react#useEffect
- react#useMemo
- @ethersproject/address#getAddress
- types#DualStakingInfo
- types#StakingInfo
- types#SyrupInfo
- types#LairInfo
- types#DualStakingBasic
- utils#returnTokenFromKey
- utils#getOneYearFee
- utils#returnStakingInfo
- utils#returnDualStakingInfo
- utils#getDaysCurrentYear
- utils#getBlockFromTimestamp
- utils#getFarmLPToken
- utils#getSyrupLPToken
- utils#initTokenAmountFromCallResult
- utils#returnSyrupInfo
- utils#getCallStateResult
- hooks#useActiveWeb3React
- utils/wrappedCurrency#unwrappedToken
types#StakingBasic TypeScript Examples
The following examples show how to use
types#StakingBasic.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: hooks.ts From interface-v2 with GNU General Public License v3.0 | 6 votes |
export function getStakingFees(
stakingInfo: StakingBasic | DualStakingBasic,
balanceState?: CallState,
totalSupplyState?: CallState,
) {
let oneYearFeeAPY = 0;
let oneDayFee = 0;
let accountFee = 0;
if (pairs !== undefined) {
oneYearFeeAPY = pairs[stakingInfo.pair]?.oneDayVolumeUSD;
const balanceResult = getCallStateResult(balanceState);
const totalSupplyResult = getCallStateResult(totalSupplyState);
if (oneYearFeeAPY && balanceResult && totalSupplyResult) {
const totalSupply = web3.utils.toWei(
pairs[stakingInfo.pair]?.totalSupply,
'ether',
);
const ratio = Number(totalSupplyResult) / Number(totalSupply);
const myRatio = Number(balanceResult) / Number(totalSupplyResult);
oneDayFee = oneYearFeeAPY * GlobalConst.utils.FEEPERCENT * ratio;
accountFee = oneDayFee * myRatio;
oneYearFeeAPY = getOneYearFee(
oneYearFeeAPY,
pairs[stakingInfo.pair]?.reserveUSD,
);
}
}
return { oneYearFeeAPY, oneDayFee, accountFee };
}
Example #2
Source File: index.ts From interface-v2 with GNU General Public License v3.0 | 6 votes |
export function returnStakingInfo(
type?: string,
): {
[chainId in ChainId]?: StakingBasic[];
} {
const stakingInfo =
type === 'old'
? stakeData.oldstakingrewards
: type === 'veryold'
? stakeData.veryoldstakingrewards
: stakeData.stakingrewards;
return {
[ChainId.MATIC]: stakingInfo.map((info: any) => {
return {
...info,
tokens: [
returnTokenFromKey(info.tokens[0]),
returnTokenFromKey(info.tokens[1]),
],
baseToken: returnTokenFromKey(info.baseToken),
rewardToken: returnTokenFromKey(info.rewardToken ?? 'DQUICK'),
};
}),
};
}
Example #3
Source File: index.ts From interface-v2 with GNU General Public License v3.0 | 6 votes |
export function getFarmLPToken(
info: StakingInfo | DualStakingInfo | StakingBasic | DualStakingBasic,
) {
const lp = info.lp;
const dummyPair = new Pair(
new TokenAmount(info.tokens[0], '0'),
new TokenAmount(info.tokens[1], '0'),
);
if (lp && lp !== '') return new Token(137, lp, 18, 'SLP', 'Staked LP');
return dummyPair.liquidityToken;
}