Skip to content

Commit

Permalink
Incorporated Certik Audit Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
smbsp committed Sep 14, 2021
1 parent 6c29dbe commit 50546a3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions contracts/governance/Vesting/VestingCreator.sol
Expand Up @@ -23,11 +23,11 @@ contract VestingCreator is AdminRole {

///@notice Holds Vesting Data
struct VestingData {
address tokenOwner;
uint256 amount;
uint256 cliff;
uint256 duration;
bool governanceControl; ///@dev true - tokens can be withdrawn by governance
address tokenOwner;
uint256 vestingCreationType;
}

Expand Down Expand Up @@ -85,11 +85,11 @@ contract VestingCreator is AdminRole {
require(_durations[i].mod(TWO_WEEKS) == 0, "durations should have intervals of two weeks");
VestingData memory vestingData =
VestingData({
tokenOwner: _tokenOwners[i],
amount: _amounts[i],
cliff: _cliffs[i],
duration: _durations[i],
governanceControl: _governanceControls[i],
tokenOwner: _tokenOwners[i],
vestingCreationType: _vestingCreationTypes[i]
});
vestingDataList.push(vestingData);
Expand All @@ -110,7 +110,7 @@ contract VestingCreator is AdminRole {
* @dev Separating the Vesting and Staking to tackle Block Gas Limit
*/
function processVestingCreation() public {
require(vestingCreated == false, "staking not done for the previous vesting");
require(!vestingCreated, "staking not done for the previous vesting");
if (vestingDataList.length > 0) {
VestingData storage vestingData = vestingDataList[vestingDataList.length - 1];
_createAndGetVesting(vestingData);
Expand All @@ -123,7 +123,7 @@ contract VestingCreator is AdminRole {
* @dev it can be the case when vesting creation and tokens staking can't be done in one transaction because of block gas limit
*/
function processStaking() public {
require(vestingCreated == true, "cannot stake without vesting creation");
require(vestingCreated, "cannot stake without vesting creation");
if (vestingDataList.length > 0) {
VestingData storage vestingData = vestingDataList[vestingDataList.length - 1];
address vestingAddress =
Expand All @@ -136,16 +136,16 @@ contract VestingCreator is AdminRole {
);
if (vestingAddress != address(0)) {
VestingLogic vesting = VestingLogic(vestingAddress);
SOV.approve(address(vesting), vestingData.amount);
require(SOV.approve(address(vesting), vestingData.amount), "Approve failed");
vesting.stakeTokens(vestingData.amount);
emit TokensStaked(vestingAddress, vestingData.tokenOwner, vestingData.amount);
vestingCreated = false;
address tokenOwnerDetails = vestingData.tokenOwner;
delete vestingDataList[vestingDataList.length - 1];
vestingDataList.length--;
emit VestingDataRemoved(msg.sender, tokenOwnerDetails);
}
}
vestingCreated = false;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions contracts/governance/Vesting/VestingRegistryLogic.sol
Expand Up @@ -6,9 +6,8 @@ import "../IFeeSharingProxy.sol";
import "./IVesting.sol";
import "./ITeamVesting.sol";
import "./VestingRegistryStorage.sol";
import "../../openzeppelin/Initializable.sol";

contract VestingRegistryLogic is VestingRegistryStorage, Initializable {
contract VestingRegistryLogic is VestingRegistryStorage {
event SOVTransferred(address indexed receiver, uint256 amount);
event VestingCreated(
address indexed tokenOwner,
Expand Down
3 changes: 2 additions & 1 deletion contracts/governance/Vesting/VestingRegistryStorage.sol
@@ -1,5 +1,6 @@
pragma solidity ^0.5.17;

import "../../openzeppelin/Initializable.sol";
import "../../utils/AdminRole.sol";
import "../../interfaces/IERC20.sol";
import "./IVestingFactory.sol";
Expand All @@ -15,7 +16,7 @@ import "./IVestingRegistry.sol";
* @dev Use Ownable as a parent to align storage structure for Logic and Proxy contracts.
* */

contract VestingRegistryStorage is AdminRole {
contract VestingRegistryStorage is Initializable, AdminRole {
///@notice the vesting factory contract
IVestingFactory public vestingFactory;

Expand Down

0 comments on commit 50546a3

Please sign in to comment.