-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3.4.8
- Loading branch information
Showing
13 changed files
with
98 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@xyo-network/sdk-xyo-typechain", | ||
"version": "3.4.7", | ||
"version": "3.4.8", | ||
"bugs": { | ||
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-typechain/issues", | ||
"email": "[email protected]" | ||
|
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,6 +1,6 @@ | ||
{ | ||
"name": "@xyo-network/open-zeppelin-typechain", | ||
"version": "3.4.7", | ||
"version": "3.4.8", | ||
"bugs": { | ||
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-typechain/issues", | ||
"email": "[email protected]" | ||
|
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,6 +1,6 @@ | ||
{ | ||
"name": "@xyo-network/solidity", | ||
"version": "3.4.7", | ||
"version": "3.4.8", | ||
"bugs": { | ||
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-typechain/issues", | ||
"email": "[email protected]" | ||
|
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
21 changes: 21 additions & 0 deletions
21
packages/solidity/src/xyo-chain/XyoChain/IXyoChainRewards.sol
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,21 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity ^0.8.20; | ||
|
||
struct BlockRewardConfig { | ||
uint256 initialReward; | ||
uint256 stepSize; | ||
uint256 stepFactorNumerator; | ||
uint256 stepFactorDenominator; | ||
uint256 minRewardPerBlock; | ||
} | ||
|
||
interface IXyoChainRewards { | ||
function calcBlockRewardPure( | ||
uint256 blockNumber, | ||
BlockRewardConfig calldata config | ||
) external pure returns (uint256); | ||
|
||
function calcBlockReward( | ||
uint256 blockNumber | ||
) external view returns (uint256); | ||
} |
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
52 changes: 52 additions & 0 deletions
52
packages/solidity/src/xyo-chain/XyoChain/XyoChainRewards.sol
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,52 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity ^0.8.20; | ||
|
||
import "./IXyoChainRewards.sol"; | ||
|
||
contract XyoChainRewards is IXyoChainRewards { | ||
BlockRewardConfig private __blockRewardConfig; | ||
|
||
constructor( | ||
uint256 _initialReward, | ||
uint256 _stepSize, | ||
uint256 _stepFactorNumerator, | ||
uint256 _stepFactorDenominator, | ||
uint256 _minRewardPerBlock | ||
) { | ||
__blockRewardConfig = BlockRewardConfig( | ||
_initialReward, | ||
_stepSize, | ||
_stepFactorNumerator, | ||
_stepFactorDenominator, | ||
_minRewardPerBlock | ||
); | ||
} | ||
|
||
function calcBlockReward( | ||
uint256 blockNumber | ||
) public view returns (uint256) { | ||
return internalBlockRewardCalc(blockNumber, __blockRewardConfig); | ||
} | ||
|
||
function calcBlockRewardPure( | ||
uint256 blockNumber, | ||
BlockRewardConfig memory config | ||
) public pure returns (uint256) { | ||
return internalBlockRewardCalc(blockNumber, config); | ||
} | ||
|
||
function internalBlockRewardCalc( | ||
uint256 blockNumber, | ||
BlockRewardConfig memory config | ||
) internal pure returns (uint256) { | ||
uint256 step = blockNumber / config.stepSize; | ||
uint256 poweredNumerator = config.stepFactorNumerator ** step; | ||
uint256 poweredDenominator = config.stepFactorDenominator ** step; | ||
uint256 calcReward = (config.initialReward * poweredNumerator) / | ||
poweredDenominator; | ||
if (calcReward < config.minRewardPerBlock) { | ||
return config.minRewardPerBlock; | ||
} | ||
return calcReward; | ||
} | ||
} |
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,6 +1,6 @@ | ||
{ | ||
"name": "@xyo-network/typechain", | ||
"version": "3.4.7", | ||
"version": "3.4.8", | ||
"bugs": { | ||
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-typechain/issues", | ||
"email": "[email protected]" | ||
|
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,6 +1,6 @@ | ||
{ | ||
"name": "@xyo-network/uniswap-solidity", | ||
"version": "3.4.7", | ||
"version": "3.4.8", | ||
"bugs": { | ||
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-typechain/issues", | ||
"email": "[email protected]" | ||
|
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,6 +1,6 @@ | ||
{ | ||
"name": "@xyo-network/uniswap-typechain", | ||
"version": "3.4.7", | ||
"version": "3.4.8", | ||
"bugs": { | ||
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-typechain/issues", | ||
"email": "[email protected]" | ||
|
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,6 +1,6 @@ | ||
{ | ||
"name": "@xyo-network/world-solidity", | ||
"version": "3.4.7", | ||
"version": "3.4.8", | ||
"bugs": { | ||
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-typechain/issues", | ||
"email": "[email protected]" | ||
|
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,6 +1,6 @@ | ||
{ | ||
"name": "@xyo-network/world-typechain", | ||
"version": "3.4.7", | ||
"version": "3.4.8", | ||
"bugs": { | ||
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-typechain/issues", | ||
"email": "[email protected]" | ||
|