-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
3,788 additions
and
101 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 @@ | ||
|
||
|
||
## Files | ||
|
||
Why so many? | ||
|
||
Actually only 3 are base contracts | ||
|
||
### RewardsDistributor | ||
|
||
Allows reward allocators ("FundManagers") to distribute rewards. | ||
|
||
### StakingRewards | ||
|
||
`StakingRewards` is `InitializableRewardsDistributionRecipient` | ||
--------------> is `StakingTokenWrapper` | ||
|
||
This preserves the code written, tested, audited and deployed by `Synthetix` (StakingRewards & StakingTokenWrapper). | ||
|
||
Originally: Synthetix (forked from /Synthetixio/synthetix/contracts/StakingRewards.sol) | ||
Audit: https://github.com/sigp/public-audits/blob/master/synthetix/unipool/review.pdf` | ||
|
||
### StakingRewardsWithPlatformToken | ||
|
||
`StakingRewardsWithPlatformToken` is `InitializableRewardsDistributionRecipient` | ||
-------------------------------> is `StakingTokenWrapper` | ||
|
||
`StakingRewardsWithPlatformToken` deploys `PlatformTokenVendor` during its constructor |
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,32 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
pragma solidity 0.8.2; | ||
|
||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
import { MassetHelpers } from "../../shared/MassetHelpers.sol"; | ||
|
||
/** | ||
* @title PlatformTokenVendor | ||
* @author Stability Labs Pty. Ltd. | ||
* @notice Stores platform tokens for distributing to StakingReward participants | ||
* @dev Only deploy this during the constructor of a given StakingReward contract | ||
*/ | ||
contract PlatformTokenVendor { | ||
|
||
IERC20 public immutable platformToken; | ||
address public immutable parentStakingContract; | ||
|
||
/** @dev Simple constructor that stores the parent address */ | ||
constructor(IERC20 _platformToken) public { | ||
parentStakingContract = msg.sender; | ||
platformToken = _platformToken; | ||
MassetHelpers.safeInfiniteApprove(address(_platformToken), msg.sender); | ||
} | ||
|
||
/** | ||
* @dev Re-approves the StakingReward contract to spend the platform token. | ||
* Just incase for some reason approval has been reset. | ||
*/ | ||
function reApproveOwner() external { | ||
MassetHelpers.safeInfiniteApprove(address(platformToken), parentStakingContract); | ||
} | ||
} |
Oops, something went wrong.