# Contracts and API Changes

The recent updates deprecate the `StargateDelegation.sol` and `NodeManagement.sol` contracts, consolidating functionalities within the `Stargate.sol` and `StargateNFT.sol` contracts. Key changes include the removal and replacement of functions to improve delegation handling and NFT transferability, as well as the migration of node management functionalities. Functions like `stakeAndDelegate()`, `migrateAndDelegate()`, and methods to manage node and reward processes have either been relocated or modified.

### Contracts

1. `StargateDelegation.sol` contract is deprecated: all delegations and rewards are now handled by the `Stargate.sol` contract.
2. Removed, in `StargateNFT.sol`, everything related to vet generated vtho (setters, getters, library), since the protocol is not generating VTHO just for owning VET, but only when delegating;
3. Claimable delegation rewards are not automatically claimed any more upon a token transfer, only during unstake or new delegation, and such actions are handled by the `Stargate.sol` contract.
4. NFT is now always transferable, even when it is delegated to a validator.

### API

1. `stakeAndDelegate()` now requires a fee paid in VTHO to allow skipping the maturity period, and the user needs to select a validator.
2. <mark style="color:$danger;">`migrate()`</mark> function was removed, now it is only possible to `migrateAndDelegate()` and a validator must be selected when performing such action.
3. `delegate()` must receive a validator as a parameter and delegation does not start immediately but at the start of the next period of the validator; delegation now has 4 states: uknown, pending, active, exited.
4. <mark style="color:$danger;">`isDelegationActive()`</mark> was removed in favour of <mark style="color:$success;">`getDelegationStatus()`</mark>.
5. <mark style="color:$danger;">`accumulatedRewards()`</mark> was removed in favour of <mark style="color:$success;">`lockedRewards()`</mark>.
6. Removed getters in `StargateNFT.sol` to optimize contract size: <mark style="color:$danger;">`normalTokensCount()`</mark>,  <mark style="color:$danger;">`getCap()`</mark>, <mark style="color:$danger;">`canTransfer()`</mark>, <mark style="color:$danger;">`ownsNormalToken()`</mark>, <mark style="color:$danger;">`isNormalToken()`</mark>, <mark style="color:$danger;">`levelsOwnedBy()`</mark>
7. The following functions are moved from `StargateNFT.sol` to the `Stargate.sol` : \
   \- `stake()`\
   \- `unstake()`\
   \- `stakeAndDelegate()`\
   \- `migrateAndDelegate()`&#x20;
8. `NodeManagement.sol` contract is deprecated. Managers are now handled by the `StargateNFT.sol` contract. All previous managers from `NodeManagement` were migrated. The following functions have been deprecated:\ <mark style="color:$danger;">`NodeManagement.getNodeManager()`</mark> -> <mark style="color:$success;">`StargateNFT.getTokenManager()`</mark>\ <mark style="color:$danger;">`NodeManagement.getNodeOwner()`</mark> -> <mark style="color:$success;">`StargateNFT.ownerOf()`</mark>\ <mark style="color:$danger;">`NodeManagement.getNodeLevel()`</mark> -> <mark style="color:$success;">`StargateNFT.getTokenLevel()`</mark>\ <mark style="color:$danger;">`NodeManagement.isNodeManager()`</mark> -> <mark style="color:$success;">`StargateNFT.isTokenManager()`</mark>\ <mark style="color:$danger;">`NodeManagement.delegateNode()`</mark> -> <mark style="color:$success;">`StargateNFT.addTokenManager()`</mark>\ <mark style="color:$danger;">`NodeManagement.removeNodeDelegation()`</mark> -> <mark style="color:$success;">`StargateNFT.removeTokenManager()`</mark>\ <mark style="color:$danger;">`NodeManagement.getNodeIds()`</mark> -> <mark style="color:$success;">`StargateNFT.idsManagedBy()`</mark>\
   \
   \
   \
   \
   &#x20;\
   New functions were added to expand the functionality\ <mark style="color:$success;">`StargateNFT.tokensManagedBy`</mark> -> Returns a list of the tokens managed by an address.\ <mark style="color:$success;">`StargateNFT.isManagedByOwner`</mark> -> Since by default the owner is the manager of a token and that is reflected in functions like `idsManagedBy` or `tokensManagedBy` this function returns `false` if the token is managed by an address that is not the owner.\ <mark style="color:$success;">`StargateNFT.tokensOverview`</mark> -> Given an address returns an overview of all the tokens related with the given address. This overview includes `owner`, `manager`, `id` and `level`.<br>
9. Legacy nodes are not being considered any more.
