-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from DMDcoin/dev
updated master branch with latest contracts form alpha2 network
- Loading branch information
Showing
62 changed files
with
7,883 additions
and
15,504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Slither Analysis | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
analyze: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
security-events: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run Slither | ||
uses: crytic/slither-action@v0.2.0 | ||
id: slither | ||
with: | ||
node-version: 16 | ||
sarif: results.sarif | ||
fail-on: none | ||
|
||
- name: Upload SARIF file | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: ${{ steps.slither.outputs.sarif }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,5 @@ src | |
.pk | ||
.mnemonic* | ||
.env* | ||
|
||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
norpc: true, | ||
skipFiles: ['interfaces', 'libs'], | ||
skipFiles: ['interfaces', 'libs', 'upgradeability', 'mockContracts'], | ||
configureYulOptimizer: true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,74 @@ | ||
pragma solidity =0.8.17; | ||
|
||
import "./base/BlockRewardHbbftCoins.sol"; | ||
import "./base/BlockRewardHbbftBase.sol"; | ||
import "./interfaces/IBlockRewardHbbftCoins.sol"; | ||
|
||
contract BlockRewardHbbft is BlockRewardHbbftCoins {} | ||
contract BlockRewardHbbft is BlockRewardHbbftBase, IBlockRewardHbbftCoins { | ||
// =============================================== Setters ======================================================== | ||
|
||
/// @dev Called by the `StakingHbbft.claimReward` function to transfer native coins | ||
/// from the balance of the `BlockRewardHbbft` contract to the specified address as a reward. | ||
/// @param _nativeCoins The amount of native coins to transfer as a reward. | ||
/// @param _to The target address to transfer the amounts to. | ||
function transferReward(uint256 _nativeCoins, address payable _to) | ||
external | ||
onlyStakingContract | ||
{ | ||
_transferNativeReward(_nativeCoins, _to); | ||
} | ||
|
||
// =============================================== Getters ======================================================== | ||
|
||
/// @dev Returns the reward amount in native coins for | ||
/// some delegator with the specified stake amount placed into the specified | ||
/// pool before the specified staking epoch. Used by the `StakingHbbft.claimReward` function. | ||
/// @param _delegatorStake The stake amount placed by some delegator into the `_poolMiningAddress` pool. | ||
/// @param _stakingEpoch The serial number of staking epoch. | ||
/// @param _poolMiningAddress The pool mining address. | ||
/// @return nativeReward `uint256 nativeReward` - the reward amount in native coins. | ||
function getDelegatorReward( | ||
uint256 _delegatorStake, | ||
uint256 _stakingEpoch, | ||
address _poolMiningAddress | ||
) external view returns (uint256 nativeReward) { | ||
uint256 validatorStake = snapshotPoolValidatorStakeAmount[ | ||
_stakingEpoch | ||
][_poolMiningAddress]; | ||
uint256 totalStake = snapshotPoolTotalStakeAmount[_stakingEpoch][ | ||
_poolMiningAddress | ||
]; | ||
|
||
nativeReward = delegatorShare( | ||
_stakingEpoch, | ||
_delegatorStake, | ||
validatorStake, | ||
totalStake, | ||
epochPoolNativeReward[_stakingEpoch][_poolMiningAddress] | ||
); | ||
} | ||
|
||
/// @dev Returns the reward amount in native coins for | ||
/// the specified validator and for the specified staking epoch. | ||
/// Used by the `StakingHbbft.claimReward` function. | ||
/// @param _stakingEpoch The serial number of staking epoch. | ||
/// @param _poolMiningAddress The pool mining address. | ||
/// @return nativeReward `uint256 nativeReward` - the reward amount in native coins. | ||
function getValidatorReward( | ||
uint256 _stakingEpoch, | ||
address _poolMiningAddress | ||
) external view returns (uint256 nativeReward) { | ||
uint256 validatorStake = snapshotPoolValidatorStakeAmount[ | ||
_stakingEpoch | ||
][_poolMiningAddress]; | ||
uint256 totalStake = snapshotPoolTotalStakeAmount[_stakingEpoch][ | ||
_poolMiningAddress | ||
]; | ||
|
||
nativeReward = validatorShare( | ||
_stakingEpoch, | ||
validatorStake, | ||
totalStake, | ||
epochPoolNativeReward[_stakingEpoch][_poolMiningAddress] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.