addError(Errors.FAILED_CHECK, "Environment should be not null"); return checkResult; addError(Errors.FAILED_CHECK, "definition.extended_type", "illegal value, should be " + SmartContractType.FOLLOWER1.name() + " instead " + getExtendedType()); return checkResult; addError(Errors.FAILED_CHECK, "Tracking origin is missed"); return checkResult; checkResult = false; if(!checkResult) { addError(Errors.FAILED_CHECK, "Callback key for tracking origin is missed"); return checkResult;
@Override public boolean beforeCreate(ImmutableEnvironment c) { boolean checkResult = true; // recalculate prepaid origins*days without saving to state calculatePrepaidOriginDays(false); int paidU = getPaidU(); if(paidU == 0) { if(getPaidU(true) > 0) { addError(Errors.FAILED_CHECK, "Test payment is not allowed for follower contracts"); } checkResult = false; } else if(paidU < getMinPayment()) { addError(Errors.FAILED_CHECK, "Payment for follower contract is below minimum level of " + getMinPayment() + "U"); checkResult = false; } if(!checkResult) { addError(Errors.FAILED_CHECK, "Follower contract hasn't valid payment"); return checkResult; } // check that payment was not hacked checkResult = prepaidOriginDays == getStateData().getInt(PREPAID_OD_FIELD_NAME, 0); if(!checkResult) { addError(Errors.FAILED_CHECK, "Wrong [state.data." + PREPAID_OD_FIELD_NAME + "] value. " + "Should be sum of early paid U and paid U by current revision."); return checkResult; } // and call common follower check checkResult = additionallyFollowerCheck(c); return checkResult; }
@Override public boolean beforeUpdate(ImmutableEnvironment c) { boolean checkResult = false; // recalculate prepaid origins*days without saving to state calculatePrepaidOriginDays(false); // check that payment was not hacked checkResult = prepaidOriginDays == getStateData().getInt(PREPAID_OD_FIELD_NAME, 0); if(!checkResult) { addError(Errors.FAILED_CHECK, "Wrong [state.data." + PREPAID_OD_FIELD_NAME + "] value. " + "Should be sum of early paid U and paid U by current revision."); return checkResult; } // and call common follower check checkResult = additionallyFollowerCheck(c); return checkResult; }