# Application Binary Interface

{% file src="<https://3627254584-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaxcQeErhSMXyyLFdF0D5%2Fuploads%2FSOEGkv5uDyLQMaOFpOU1%2FidrxStaking.json?alt=media&token=81d1f881-f311-402c-8cf1-d35072e34022>" %}
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.
