diff --git a/docs/configuration.rst b/docs/configuration.rst index 8903454b..33660857 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -81,24 +81,6 @@ Available configuration parameters are: Alice and Bob are both founders of Acme Bakery. Their bakery fee is 10%. Alice has a 60% (0.6) interest in the bakery, and Bob has a 40% (0.4) interest. When rewards are delivered at the end of each cycle, 10% is taken as the bakery fee (ie: *service_fee*). That 10% is then divided between Alice and Bob according to their ratios. -**owners_map** - A dictionary of PKH and ratio ( decimal in the range [0-1]) pairs. Each item in this dictionary represents PKH of each balance owner and his ratio of the amount he owns in the total baking balance. Implicit or originated addresses are accepted. It is important that the sum of all ratios equals to 1. This map is optional if owners do not want to be paid for baking rewards, in this case, baking rewards remain in baking balance. - - Example:: - - Current Baker Balance: 17,400 tez - Total Delegations: 69,520 tez - Total Staked: 86,920 tez - - service_fee: 9 - owners_map: - {'tz1PV5g16m9hHMAVJ4Hx6NzzUHgksDnTLFcK' : 0.4, - 'tz1PirboZKFVqkfE45hVLpkpXaZtLk3mqC17' : 0.4, - 'tz1VxS7ff4YnZRs8b4mMP4WaMVpoQjuo1rjf' : 0.2} - - Charlie, and Dave, have each transfered 6,960 tez to the baker address. Edwin has transfered 3,480 tez. They are each partial owners of the baking balance. When rewards are delivered at the end of each cycle, 9% is taken as the bakery fee (ie: *service_fee*). That 9% is dispersed to any *founders*. If there are no founders, that 9% remains in the baker's balance. - The baker address is technically a delegator to itself. Its share of rewards are part of the overall cycle rewards. Charlie, Dave, and Edwin divide the "baker address rewards" as per the ratios in *owners_map*. Additionally, owners are *not* subject to the *service_fee*. - **specials_map** A dictionary of PKH and fee (decimal in the range [0-100] ) pairs. This dictionary can be used to set special service fee values for desired delegators. @@ -108,7 +90,7 @@ Available configuration parameters are: 'tz1PirboZKFVqkfE45hVLpkpXaZtLk3mqC17' : 5} **supporters_set** - A set of PKH values. Each PKH represents a supporter of the baker. Supporters are not charged with a service fee. Founders and balance owners are natural supporters, they are not needed to be added. + A set of PKH values. Each PKH represents a supporter of the baker. Supporters are not charged with a service fee. Founders are natural supporters, they are not needed to be added. Example:: diff --git a/src/calc/calculate_phase4.py b/src/calc/calculate_phase4.py index 3470dc73..8ecaac12 100644 --- a/src/calc/calculate_phase4.py +++ b/src/calc/calculate_phase4.py @@ -18,7 +18,7 @@ class CalculatePhase4(CalculatePhaseBase): Sum of owner ratios equals to ratio of owners_parent record. """ - def __init__(self, founders_map, owners_map, reward_api=None) -> None: + def __init__(self, founders_map, reward_api=None) -> None: super().__init__() self.founders_map = founders_map @@ -51,21 +51,7 @@ def calculate(self, reward_data3, total_amount): new_rewards.append(rl3) elif rl3.type == TYPE_OWNERS_PARENT: - for addr, ratio in self.owners_map.items(): - rl4 = RewardLog(addr, TYPE_OWNER, ratio * rl3.delegating_balance, 0) - # new ratio is parent ratio * ratio of the owner - rl4.ratio = ratio * rl3.ratio - rl4.ratio4 = rl4.ratio - rl4.service_fee_ratio = 0 - rl4.service_fee_rate = 0 - rl4.parent = rl3 - if self.reward_api is not None: - self.reward_api.update_current_balances([rl4]) - new_rewards.append(rl4) - - # if no owners, add parent object to rewards list - if not self.owners_map.items(): - new_rewards.append(rl3) + new_rewards.append(rl3) else: rl3.ratio4 = rl3.ratio new_rewards.append(rl3) diff --git a/src/calc/phased_payment_calculator.py b/src/calc/phased_payment_calculator.py index a1d830de..2f6bd58d 100644 --- a/src/calc/phased_payment_calculator.py +++ b/src/calc/phased_payment_calculator.py @@ -32,7 +32,6 @@ class PhasedPaymentCalculator: def __init__( self, founders_map, - owners_map, service_fee_calculator, min_delegation_amount, min_payment_amount, @@ -40,7 +39,6 @@ def __init__( reward_api, ): self.rules_model = rules_model - self.owners_map = owners_map self.founders_map = founders_map self.fee_calc = service_fee_calculator self.min_delegation_amnt = min_delegation_amount @@ -50,9 +48,9 @@ def __init__( # # calculation details # - # total reward = delegators reward + owners reward = delegators payment + delegators fee + owners payment + # total reward = delegators reward + owner reward = delegators payment + delegators fee + owner payment # delegators reward = delegators payment + delegators fee - # owners reward = owners payment = total reward - delegators reward + # owner reward = owner payment = total reward - delegators reward # founders reward = delegators fee = total reward - delegators reward #### def calculate(self, reward_provider_model, adjustments=None, rerun=False): @@ -138,7 +136,7 @@ def calculate(self, reward_provider_model, adjustments=None, rerun=False): # ************* # ** phase 4 ** # ************* - phase4 = CalculatePhase4(self.founders_map, self.owners_map, self.reward_api) + phase4 = CalculatePhase4(self.founders_map, self.reward_api) rwrd_logs, total_rwrd_amnt = phase4.calculate(rwrd_logs, total_rwrd_amnt) # ***************** diff --git a/src/config/yaml_baking_conf_parser.py b/src/config/yaml_baking_conf_parser.py index 1c4387b0..7f16d32a 100644 --- a/src/config/yaml_baking_conf_parser.py +++ b/src/config/yaml_baking_conf_parser.py @@ -7,7 +7,6 @@ from log_config import main_logger from model.baking_conf import ( FOUNDERS_MAP, - OWNERS_MAP, BAKING_ADDRESS, SUPPORTERS_SET, SERVICE_FEE, @@ -75,7 +74,6 @@ def validate(self): self.validate_baking_address(conf_obj) self.validate_payment_address(conf_obj) self.validate_share_map(conf_obj, FOUNDERS_MAP) - self.validate_share_map(conf_obj, OWNERS_MAP) self.validate_service_fee(conf_obj) self.validate_min_delegation_amt(conf_obj) self.validate_min_payment_amt(conf_obj) @@ -97,7 +95,6 @@ def process(self): conf_obj[FULL_SUPPORTERS_SET] = set( conf_obj[SUPPORTERS_SET] | set(conf_obj[FOUNDERS_MAP].keys()) - | set(conf_obj[OWNERS_MAP].keys()) ) conf_obj[EXCLUDED_DELEGATORS_SET_TOE] = set( diff --git a/src/configure.py b/src/configure.py index 59cbab45..d27ced47 100644 --- a/src/configure.py +++ b/src/configure.py @@ -33,7 +33,6 @@ PAYMENT_ADDRESS, SERVICE_FEE, FOUNDERS_MAP, - OWNERS_MAP, MIN_DELEGATION_AMT, MIN_PAYMENT_AMT, RULES_MAP, @@ -63,7 +62,6 @@ "servicefee": "Specify bakery fee, valid range is between 0 and 100", "rewardstype": "Specify if baker pays 'ideal' or 'actual' rewards (Be sure to read the documentation to understand the difference). Press enter for 'actual'", "foundersmap": "Specify FOUNDERS in form 'tz-address':share1,'tz-address':share2,... (Mind quotes, sum must equal 1, e.g: 'tz1a...':0.3, 'tz1b..':0.7) Press enter to leave empty", - "ownersmap": "Specify OWNERS in form 'tz-address':share1,'tz-address':share2,... (Mind quotes, sum must equal 1, e.g: 'tz1a...':0.3, 'tz1b..':0.7) Press enter to leave empty", "mindelegation": "Specify minimum delegation amount in tez. Press enter for 0", "mindelegationtarget": "Specify where the reward for delegators failing to satisfy minimum delegation amount go. {}: leave at balance, {}: to founders, {}: to everybody, press enter for {}".format( TOB, TOF, TOE, TOB @@ -172,19 +170,6 @@ def onfoundersmap(input): fsm.go() -def onownersmap(input): - try: - global parser - dict = ast.literal_eval("{" + input + "}") - parser.set(OWNERS_MAP, dict) - parser.validate_share_map(parser.get_conf_obj(), OWNERS_MAP) - except Exception: - printe("Invalid owners input: " + traceback.format_exc()) - return - - fsm.go() - - def onmindelegation(input): try: if not input: @@ -371,7 +356,6 @@ def onprefinal(input): "servicefee": onservicefee, "rewardstype": onrewardstype, "foundersmap": onfoundersmap, - "ownersmap": onownersmap, "mindelegation": onmindelegation, "mindelegationtarget": onmindelegationtarget, "minpayment": onminpayment, @@ -396,8 +380,7 @@ def onprefinal(input): {"name": "go", "src": "paymentaddress", "dst": "servicefee"}, {"name": "go", "src": "servicefee", "dst": "rewardstype"}, {"name": "go", "src": "rewardstype", "dst": "foundersmap"}, - {"name": "go", "src": "foundersmap", "dst": "ownersmap"}, - {"name": "go", "src": "ownersmap", "dst": "mindelegation"}, + {"name": "go", "src": "foundersmap", "dst": "mindelegation"}, {"name": "go", "src": "mindelegation", "dst": "mindelegationtarget"}, {"name": "go", "src": "mindelegationtarget", "dst": "minpayment"}, {"name": "go", "src": "minpayment", "dst": "exclude"}, diff --git a/src/pay/payment_producer.py b/src/pay/payment_producer.py index 0e4f3ec8..18e7db2f 100644 --- a/src/pay/payment_producer.py +++ b/src/pay/payment_producer.py @@ -76,7 +76,6 @@ def __init__( baking_cfg.get_dest_map(), ) self.baking_address = baking_cfg.get_baking_address() - self.owners_map = baking_cfg.get_owners_map() self.founders_map = baking_cfg.get_founders_map() self.min_delegation_amt_in_mutez = int( baking_cfg.get_min_delegation_amount() * MUTEZ_PER_TEZ @@ -126,7 +125,6 @@ def __init__( self.payment_calc = PhasedPaymentCalculator( self.founders_map, - self.owners_map, self.fee_calc, self.min_delegation_amt_in_mutez, self.min_payment_amt_in_mutez, diff --git a/tests/integration/test_phase.py b/tests/integration/test_phase.py index 0b957619..a6e190c0 100644 --- a/tests/integration/test_phase.py +++ b/tests/integration/test_phase.py @@ -87,7 +87,6 @@ def test_process_payouts(self): ) payment_calc = PhasedPaymentCalculator( founders_map=baking_cfg.get_founders_map(), - owners_map=baking_cfg.get_owners_map(), service_fee_calculator=srvc_fee_calc, min_delegation_amount=int( baking_cfg.get_min_delegation_amount() * MUTEZ_PER_TEZ