code: func (s *Swap) Add(amount int64, peer *protocols.Peer) (err error) {
  	s.lock.Lock()
  	defer s.lock.Unlock()
  
  	//load existing balances from the state store
  	err = s.loadState(peer)
  	if err != nil && err != state.ErrNotFound {
  		return
  	}
  	//adjust the balance
  	//if amount is negative, it will decrease, otherwise increase
  	s.balances[peer.ID()] += amount
  	//save the new balance to the state store
  	peerBalance := s.balances[peer.ID()]
  	err = s.stateStore.Put(peer.ID().String(), &peerBalance)
  
  	log.Debug(fmt.Sprintf("balance for peer %s: %s", peer.ID().String(), strconv.FormatInt(peerBalance, 10)))
  	return err
  }
docs: //Swap implements the protocols.Balance interface
  //Add is the (sole) accounting function