# User Energy Pay Ratio

It is highly recommended to set an appropriate user energy pay ratio before deploying a contract to the Mainnet. The user energy pay ratio is defined as the energy cost ratio of smart contract execution the user pays vs. what the developer pays. For example, if the user energy pay ratio is set at 60, then the user pays 60% of the execution energy, and the developer (contract owner) pays the remaining 40%. This parameter accepts an integer between 0 and 100, inclusively. A high user energy pay ratio is recommended in case users attack the contract and drain the owner's account.

This value can be set in both Tron-Box and Tron-Web:

### Tron-Box

For Tron-Box smart contract deployment, all global settings are in the **tronbox.js** file. Within this file, there is a parameter called _consume_user_resource_percent_, which refers to the user energy pay ratio.



### Tron-Web

The _tronweb.contract.new_ API call takes in a parameter called _userFeePercentage_. This parameter refers to the user energy pay ratio.



# Updating User Energy Pay Ratio

After a contract deploys, it's user energy pay ratio can be adjusted through the [updateSetting](🔗) endpoint. Make sure to sign & broadcast this call to take effect.