# Application Binary Interface

{% file src="/files/0qTncThwJDSZGu8RgFzE" %}
Staking IDRX ABI
{% endfile %}

This ABI for the IDRX staking contract provides a detailed overview of the contract's functionality. Here's a breakdown of what the key components do:

#### Events

1. `addNewStake` : Triggered when a new stake is added, providing details like stake ID, type, staker address, amount, rewards, and timestamps.
2. `claimReward` : Emitted when a reward is claimed, showing the stake ID, staker, claimed amount, and timestamp.
3. `newUnbondingPeriod` : Indicates a change in the unbonding period.
4. `stakeTypeModified` : Occurs when a stake type is modified, providing details about the reward and duration modifiers.
5. `stakeUnbonded` : Emitted when a stake enters the unbonding phase.
6. `withdrawPrincipal` : Triggered when the principal amount of a stake is withdrawn.
7. `withdrawPrincipalUnbonded` : Triggered when the unbounded principal amount of stake is withdrawn.

#### Functions

1. `claimStakePrincipal` : Allows users to claim the principal of a specific stake.
2. `claimStakePrincipalUnbonded` : For claiming the principal of an unbonded stake.
3. `claimStakeReward` : Enables users to claim their staking rewards.
4. `getStake` : Retrieves details of specified stakes.
5. `implementation` : Returns the address of the current implementation
6. `isStakingContract` : Confirms if the contract is a staking contract.
7. `newStake` : Used to create a new stake with a specified amount and type.
8. `owner` : Returns the address of the contract owner.
9. `setStakeType` : Allows setting or modifying a stake type with parameters for reward and duration.
10. `setUnbondingPeriod` : Adjusts the unbonding period for stakes.
11. `stakeCount` : Provides the total number of stakes.
12. `stakeToken` : Returns the address of the token used for staking.
13. `stakeTypes` : Retrieves details of a particular stake type.
14. `stakes` : Returns details of a specific stake.
15. `unbondStake` : Initiates the unbonding process for a stake.
16. `unbondingPeriod` : Returns the current unbonding period.
17. `withdraw` : Withdraws funds to a specified address.
18. `withdrawToken` : Withdraws a specified amount of a token to an address.
19. `receive` : Allows the contract to receive Ether.

#### Usage

* Staking and Unstaking: `newStake`, `unbondStake`, `claimStakePrincipal`, and `claimStakeReward` manage staking, unbonding, and claiming rewards or principal.
* Stake Management: `getStake`, `stakeCount`, and `stakeTypes` help users and contract owner query stake details.
* Admin Functions: `setStakeType`, `setUnbondingPeriod`, and `withdrawToken` are used by the contract owner to manage stake types, unbonding periods, and fund withdrawals.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.idrx.co/smart-contract/staking/application-binary-interface.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
