/// @notice donate to surplus buffer of a given term
function donateToTermSurplusBuffer(address term, uint256 amount) external {
    CreditToken(credit).transferFrom(msg.sender, address(this), amount);
    uint256 newSurplusBuffer = termSurplusBuffer[term] + amount;
    termSurplusBuffer[term] = newSurplusBuffer;
    emit TermSurplusBufferUpdate(block.timestamp, term, newSurplusBuffer);
}
/// @notice withdraw from surplus buffer
function withdrawFromSurplusBuffer(address to, uint256 amount)
    external
    onlyCoreRole(CoreRoles.GUILD_SURPLUS_BUFFER_WITHDRAW)
{
    uint256 newSurplusBuffer = surplusBuffer - amount; // this would revert due to underflow if withdrawing > surplusBuffer
    surplusBuffer = newSurplusBuffer;
    CreditToken(credit).transfer(to, amount);
    emit SurplusBufferUpdate(block.timestamp, newSurplusBuffer);
}
/// @notice donate to surplus buffer of a given term
function donateToTermSurplusBuffer(address term, uint256 amount) external {
+   require(LendingTerm(term).getReferences().creditToken == credit, "ProfitManager: term from wrong market!");     
    CreditToken(credit).transferFrom(msg.sender, address(this), amount);
    uint256 newSurplusBuffer = termSurplusBuffer[term] + amount;
    termSurplusBuffer[term] = newSurplusBuffer;
    emit TermSurplusBufferUpdate(block.timestamp, term, newSurplusBuffer);
}
