Verified contractExactUNLICENSED
DistributionWrapper
Address0x2cc861aa34c7311cd18fcd145f7f7e04df76f4a3
- Balance
0 ETH
- Transactions
999
- Compiler
solc 0.8.24
- Same code
1 more contract
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- paris
- License
- UNLICENSED
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 20,175,038
- Creation transaction
- 0x88a9a74eb3…701a27b268
contracts/DistributionWrapper.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./interfaces/IBlazeAuction.sol";
import "./interfaces/IBlazeStaking.sol";
contract DistributionWrapper is ReentrancyGuard {
IBlazeAuction public blazeAuction;
IBlazeStaking public blazeStaking;
uint32 public stakingStartTimestamp;
constructor(address _auction, address _staking) {
require(_auction != address(0), "Invalid auction Addresses");
require(_staking!= address(0), "Invalid stakingAddresses");
blazeAuction = IBlazeAuction(_auction);
blazeStaking = IBlazeStaking(_staking);
stakingStartTimestamp = blazeStaking._deploymentTimeStamp();
}
receive() external payable {}
function distributeFunds() external nonReentrant {
uint32 currentDay = uint32(((block.timestamp - stakingStartTimestamp) / 1 days) + 1);
uint256 beforeEthBalance = address(this).balance;
blazeAuction.claimFees();
blazeStaking.setFeeRewardsForAllCycle();
uint256 next8Day = blazeStaking.getNextCycleDistributionDay(8);
if(currentDay >= next8Day) {
blazeStaking.distributeFeeRewardsForAll();
}
uint256 incentive = address(this).balance - beforeEthBalance;
(bool sent, ) = payable(msg.sender).call{value: incentive}("");
require(sent, "Failed to send Ether");
}
function claimFees() external nonReentrant {
blazeAuction.claimFees();
}
function setFeeRewardsForAllCycle() external nonReentrant {
blazeStaking.setFeeRewardsForAllCycle();
}
function distributeFeeRewardsForAll() external nonReentrant {
blazeStaking.distributeFeeRewardsForAll();
}
}@openzeppelin/contracts/utils/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}
contracts/interfaces/IBlazeAuction.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;
interface IBlazeAuction {
function mintBlazeTokensForLP() external;
function claimFees() external;
}
contracts/interfaces/IBlazeStaking.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;
interface IBlazeStaking {
function setFeeRewardsForAllCycle() external;
function distributeFeeRewardsForAll() external;
function _deploymentTimeStamp() external view returns (uint32);
function getNextCycleDistributionDay(uint16) external view returns (uint256);
function getUser2888BlazeToken(address user, uint256 cycle) external view returns (uint256 blazeTokenStaked);
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "paris",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.