{
    "Function": "initialize",
    "File": "contracts/MerkleVesting.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "MerkleLib"
    ],
    "Internal Calls": [
        "require(bool,string)",
        "require(bool,string)",
        "keccak256(bytes)",
        "withdraw",
        "abi.encode()"
    ],
    "Library Calls": [
        "verifyProof"
    ],
    "Low-Level Calls": [],
    "Code": "function initialize(uint treeIndex, address destination, uint totalCoins, uint startTime, uint endTime, uint lockPeriodEndTime, bytes32[] memory proof) external {\n        // must not initialize multiple times\n        require(!initialized[destination][treeIndex], \"Already initialized\");\n        // leaf hash is digest of vesting schedule parameters and destination\n        // NOTE: use abi.encode, not abi.encodePacked to avoid possible (but unlikely) collision\n        bytes32 leaf = keccak256(abi.encode(destination, totalCoins, startTime, endTime, lockPeriodEndTime));\n        // memory because we read only\n        MerkleTree memory tree = merkleTrees[treeIndex];\n        // call to MerkleLib to check if the submitted data is correct\n        require(tree.rootHash.verifyProof(leaf, proof), \"The proof could not be verified.\");\n        // set initialized, preventing double initialization\n        initialized[destination][treeIndex] = true;\n        // precompute how many coins are released per second\n        uint coinsPerSecond = totalCoins / (endTime - startTime);\n        // create the tranche struct and assign it\n        tranches[destination][treeIndex] = Tranche(\n            totalCoins,  // total coins to be released\n            totalCoins,  // currentCoins starts as totalCoins\n            startTime,\n            endTime,\n            coinsPerSecond,\n            startTime,    // lastWithdrawal starts as startTime\n            lockPeriodEndTime\n        );\n        // if we've passed the lock time go ahead and perform a withdrawal now\n        if (lockPeriodEndTime < block.timestamp) {\n            withdraw(treeIndex, destination);\n        }\n    }"
}