BlockRewardAuRaTokens
contract BlockRewardAuRaTokens
Index
Reference
Events
BridgeTokenRewardAdded
event BridgeTokenRewardAdded(uint256 amount, uint256 cumulativeAmount, address bridge)
Emitted by the `addBridgeTokenRewardReceivers` function.
- Parameters:
amount
- The fee/reward amount in tokens passed to the `addBridgeTokenRewardReceivers` function as a parameter.cumulativeAmount
- The value of `bridgeTokenReward` state variable after adding the `amount` to it.bridge
- The bridge address which called the `addBridgeTokenRewardReceivers` function.
Modifiers
onlyXToErcBridge
modifier onlyXToErcBridge()
Ensures the caller is the `erc-to-erc` or `native-to-erc` bridge contract address.
Functions
_coinInflationAmount
function _coinInflationAmount(uint256 , address[] ) internal view returns (uint256)
See the description of `BlockRewardAuRaCoins._coinInflationAmount` internal function. In this case (when ERC tokens are used for staking) the inflation for native coins is zero.
- Parameters:
- uint256
- address[]
- Returns:
- uint256
_distributeTokenRewards
function _distributeTokenRewards(address _stakingContract, uint256 _stakingEpoch, uint256 _totalRewardShareNum, uint256 _totalRewardShareDenom, address[] _validators, uint256[] _blocksCreatedShareNum, uint256 _blocksCreatedShareDenom) internal
Distributes rewards in tokens among pools at the latest block of a staking epoch. This function is called by the `_distributeRewards` function.
- Parameters:
_stakingContract
- The address of the StakingAuRa contract._stakingEpoch
- The number of the current staking epoch._totalRewardShareNum
- Numerator of the total reward share._totalRewardShareDenom
- Denominator of the total reward share._validators
- The array of the current validators (their mining addresses)._blocksCreatedShareNum
- Numerators of blockCreated share for each of the validators._blocksCreatedShareDenom
- Denominator of blockCreated share.
addBridgeTokenFeeReceivers
function addBridgeTokenFeeReceivers(uint256 _amount) external
An alias for `addBridgeTokenRewardReceivers` (for backward compatibility with the previous bridge contract).
- Parameters:
_amount
- uint256
addBridgeTokenRewardReceivers
function addBridgeTokenRewardReceivers(uint256 _amount) public
Called by the `erc-to-erc` or `native-to-erc` bridge contract when a portion of the bridge fee/reward should be minted and distributed to participants in staking tokens. The specified amount is used by the `_distributeRewards` function.
- Modifiers:
- onlyXToErcBridge
- Parameters:
_amount
- The fee/reward amount distributed to participants.
ercToErcBridgesAllowed
function ercToErcBridgesAllowed() public view returns (address[])
Returns the array of `erc-to-erc` bridge addresses set by the `setErcToErcBridgesAllowed` setter.
- Returns:
- address[]
getDelegatorReward
function getDelegatorReward(uint256 _delegatorStake, uint256 _stakingEpoch, address _poolMiningAddress) external view returns (uint256, uint256)
Returns the reward amounts in tokens and native coins for some delegator with the specified stake amount placed into the specified pool before the specified staking epoch. Used by the `StakingAuRa.claimReward` function.
- Parameters:
_delegatorStake
- The stake amount placed by some delegator into the `_poolMiningAddress` pool._stakingEpoch
- The serial number of staking epoch._poolMiningAddress
- The pool mining address.- Returns:
- `uint256 tokenReward` - the reward amount in tokens. `uint256 nativeReward` - the reward amount in native coins.
getValidatorReward
function getValidatorReward(uint256 _stakingEpoch, address _poolMiningAddress) external view returns (uint256, uint256)
Returns the reward amounts in tokens and native coins for the specified validator and for the specified staking epoch. Used by the `StakingAuRa.claimReward` function.
- Parameters:
_stakingEpoch
- The serial number of staking epoch._poolMiningAddress
- The pool mining address.- Returns:
- `uint256 tokenReward` - the reward amount in tokens. `uint256 nativeReward` - the reward amount in native coins.
nativeToErcBridgesAllowed
function nativeToErcBridgesAllowed() public view returns (address[])
Returns the array of `native-to-erc` bridge addresses which were set by the `setNativeToErcBridgesAllowed` setter.
- Returns:
- address[]
setErcToErcBridgesAllowed
function setErcToErcBridgesAllowed(address[] _bridgesAllowed) external
Sets the array of `erc-to-erc` bridge addresses which are allowed to call some of the functions with the `onlyXToErcBridge` modifier. This setter can only be called by the `owner`.
- Modifiers:
- onlyOwner onlyInitialized
- Parameters:
_bridgesAllowed
- The array of bridge addresses.
setNativeToErcBridgesAllowed
function setNativeToErcBridgesAllowed(address[] _bridgesAllowed) external
Sets the array of `native-to-erc` bridge addresses which are allowed to call some of the functions with the `onlyXToErcBridge` modifier. This setter can only be called by the `owner`.
- Modifiers:
- onlyOwner onlyInitialized
- Parameters:
_bridgesAllowed
- The array of bridge addresses.
transferReward
function transferReward(uint256 _tokens, uint256 _nativeCoins, address _to) external
Called by the `StakingAuRa.claimReward` function to transfer tokens and native coins from the balance of the `BlockRewardAuRa` contract to the specified address as a reward.
- Modifiers:
- onlyStakingContract
- Parameters:
_tokens
- The amount of tokens to transfer as a reward._nativeCoins
- The amount of native coins to transfer as a reward._to
- The target address to transfer the amounts to.