Skip to content

Latest commit

 

History

History
290 lines (261 loc) · 10 KB

OrigingVestingCreator.md

File metadata and controls

290 lines (261 loc) · 10 KB

Temp contract for checking address, creating and staking tokens. (OrigingVestingCreator.sol)

View Source: contracts/governance/Vesting/OrigingVestingCreator.sol

↗ Extends: Ownable

OrigingVestingCreator contract

It casts an instance of vestingRegistry and by using createVesting function it creates a vesting, gets it and stakes some tokens w/ this vesting.

Contract Members

Constants & Variables

//public members
contract VestingRegistry public vestingRegistry;

//internal members
mapping(address => bool) internal processedList;

Functions


constructor

function (address _vestingRegistry) public nonpayable

Arguments

Name Type Description
_vestingRegistry address
Source Code
constructor(address _vestingRegistry) public {
        vestingRegistry = VestingRegistry(_vestingRegistry);
    }

createVesting

Create a vesting, get it and stake some tokens w/ this vesting.

function createVesting(address _tokenOwner, uint256 _amount, uint256 _cliff, uint256 _duration) public nonpayable onlyOwner 

Arguments

Name Type Description
_tokenOwner address The owner of the tokens.
_amount uint256 The amount of tokens to be vested.
_cliff uint256 The time interval to the first withdraw in seconds.
_duration uint256 The total duration in seconds.
Source Code
function createVesting(
        address _tokenOwner,
        uint256 _amount,
        uint256 _cliff,
        uint256 _duration
    ) public onlyOwner {
        require(_tokenOwner != address(0), "Invalid address");
        require(!processedList[_tokenOwner], "Already processed");

        processedList[_tokenOwner] = true;

        vestingRegistry.createVesting(_tokenOwner, _amount, _cliff, _duration);
        address vesting = vestingRegistry.getVesting(_tokenOwner);
        vestingRegistry.stakeTokens(vesting, _amount);
    }

Contracts