src/blockchain/pledges.js
/**
   * Determine if this transfer was a return of excess funds of an over-funded milestone
   * @param {object} transferInfo
   */
Determine if this transfer was a return of excess funds of an over-funded milestone
@param {object} transferInfo
Determine if this transfer was a return of excess funds of an over - funded milestone @param { object } transferInfo
async function isReturnTransfer(transferInfo) {
    const { fromPledge, fromPledgeAdmin, toPledgeId, txHash, donations } = transferInfo;
    if (fromPledgeAdmin.type !== AdminTypes.TRACE) return false;
    const from = donations[0].pledgeId; 
    const transferEventsInTx = await app
      .service('events')
      .find({ paginate: false, query: { transactionHash: txHash, event: 'Transfer' } });
    return transferEventsInTx.some(
      e =>
        [e.returnValues.from, fromPledge.oldPledge].includes(toPledgeId) &&
        e.returnValues.to === from,
    );
  }
async function isReturnTransfer ( transferInfo ) { const { fromPledge , fromPledgeAdmin , toPledgeId , txHash , donations } = transferInfo ; if ( fromPledgeAdmin . type !== AdminTypes . TRACE ) return false ; const from = donations [ 0 ] . pledgeId ; const transferEventsInTx = await app . service ( 'events' ) . find ( { paginate : false , query : { transactionHash : txHash , event : 'Transfer' } } ) ; return transferEventsInTx . some ( e => [ e . returnValues . from , fromPledge . oldPledge ] . includes ( toPledgeId ) && e . returnValues . to === from , ) ; }
Determine if this transfer was a return of excess funds of an over-funded milestone
 @param {object} transferInfo
Determine if this transfer was a return of excess funds of an over - funded milestone @param { object } transferInfo
// currently only traces will can be over-funded // all donations will have same pledgeId // ex events in return case: // Transfer(from: 1, to: 2, amount: 1000) // Transfer(from: 2, to: 1, amount: < 1000) // it may go directly to fromPledge.oldPledge if this was delegated funds // being returned b/c the intermediary pledge is the pledge w/ the intendedProject