Calculate a TRON contract deployer’s actual Energy contribution
A contract can advertise a caller share of 30 percent while charging that caller more. The deployer’s contribution is limited by its available Energy and the contract’s configured cap.
Apply all three limits to the origin contribution
For a call requiring 100,000 Energy with consume_user_resource_percent equal to 30, the intended deployer share is 70,000. Suppose origin_energy_limit is 45,000 and the deployer has 60,000 available. Use the smallest of the three figures.
required = 100_000
deployer_target = required * 70 // 100
deployer_used = min(deployer_target, 45_000, 60_000)
caller_used = required - deployer_used
assert (deployer_used, caller_used) == (45_000, 55_000)
Split caller Energy from burned TRX
The caller must fund the remaining 55,000 Energy. Its own available Energy can cover some or all of that amount, with applicable TRX burn for the uncovered portion. Inspect the execution receipt and the caller’s fee_limit before attributing a shortfall. Bandwidth is accounted for alongside the call and is outside this sharing calculation.