def _on_grant(self, grant):
        '''
        Called upon receiving the grant. Than calls granted and sets
        up reporter if necessary.
        '''
        self.set_timeout(grant.expiration_time, ContractState.expired,
                         self._run_and_terminate, self.contractor.cancelled,
                         grant)

        self.grant = grant
        # this is necessary for nested contracts to work with handing
        # the messages over
        self.set_remote_id(grant.sender_id)
        self.update_manager_address(grant.reply_to)

        self.call_agent_side(self.contractor.granted, grant,
                             ensure_state=ContractState.granted)
Called upon receiving the grant. Than calls granted and sets
        up reporter if necessary.