public override Empty AdjustIndexingFeePrice(AdjustIndexingFeeInput input) { var info = State.SideChainInfo[input.SideChainId]; Assert(info != null && info.SideChainStatus != SideChainStatus.Terminated, "Side chain not found or incorrect side chain status."); Assert(input.IndexingFee >= 0, "Invalid side chain fee price."); var expectedOrganizationAddress = info.IndexingFeeController.OwnerAddress; Assert(expectedOrganizationAddress == Context.Sender, "No permission."); info.IndexingPrice = input.IndexingFee; State.SideChainInfo[input.SideChainId] = info; return(new Empty()); }
public override Empty AdjustIndexingFeePrice(AdjustIndexingFeeInput input) { var info = State.SideChainInfo[input.SideChainId]; Assert(info != null && info.SideChainStatus != SideChainStatus.Terminated, "Side chain not found or incorrect side chain status."); Assert(input.IndexingFee >= 0, "Invalid side chain fee price."); var sideChainCreator = info.Proposer; var expectedOrganizationAddress = CalculateSideChainIndexingFeeControllerOrganizationAddress(sideChainCreator); Assert(expectedOrganizationAddress == Context.Sender, "No permission."); info.IndexingPrice = input.IndexingFee; var balance = State.IndexingBalance[input.SideChainId]; if (balance < info.IndexingPrice) { info.SideChainStatus = SideChainStatus.InsufficientBalance; } State.SideChainInfo[input.SideChainId] = info; return(new Empty()); }