# GIP-0010: Update rewards snapshot when close allocation with empty POI

**URL:** https://forum.thegraph.com/t/gip-0010-update-rewards-snapshot-when-close-allocation-with-empty-poi/2093
**Category:** Graph Improvement Proposals (GIP)
**Tags:** protocol-gov
**Created:** [June 16, 2021, 10:41pm UTC](https://forum.thegraph.com/t/gip-0010-update-rewards-snapshot-when-close-allocation-with-empty-poi/2093 "2021-06-16T22:41:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.thegraph.com/ari/32/2747_2.png) [@ari](https://forum.thegraph.com/u/ari)
#### Post date: [June 16, 2021, 10:41pm UTC](https://forum.thegraph.com/t/gip-0010-update-rewards-snapshot-when-close-allocation-with-empty-poi/2093/1 "2021-06-16T22:41:01Z")

</div>

I’m submitting this new proposal to fix an issue with the rewards calculation whenever an allocation is closed with 0x0 POI.

# Abstract

Indexers get rewards for indexing subgraphs. These rewards are minted whenever an indexer close an allocation with a non-zero POI. A function called `distributeRewards()` within the Staking contract is used for that purpose. This function calls `RewardsManager.takeRewards()` that updates the snapshots used for rewards calculations and then mint the tokens. In some cases the snapshot calculation is not called.

# Motivation

When an indexer calls `closeAllocation()` with a POI=0x0 the function `distributeRewards()` is not called, as a consequence, `takeRewards()` is not called and in turn the snapshots are not updated before unallocating tokens. This creates a situation where the rewards manager considers there are a different amount of allocated tokens and distort calculations until it is called next time. Hopefully the distortion self corrects when another action is performed that updates the snapshot.

**Full version of the GIP is published on this link and will be available on Radicle:**

> **[\[GIP-X\] Update rewards snapshot when close allocation with empty POI - HackMD](https://hackmd.io/IOLbNyu_SxCtSUCZ6UEXsg)**
