Skip to content

Latest commit

 

History

History
206 lines (192 loc) · 7.07 KB

cxTokenFactoryLibV1.md

File metadata and controls

206 lines (192 loc) · 7.07 KB

cxTokenFactoryLibV1.sol

View Source: contracts/libraries/cxTokenFactoryLibV1.sol

cxTokenFactoryLibV1

Functions

getByteCodeInternal

Gets the bytecode of the cxToken contract Warning: this function does not validate the input arguments.

function getByteCodeInternal(IStore s, bytes32 coverKey, bytes32 productKey, string tokenName, uint256 expiryDate) external pure
returns(bytecode bytes, salt bytes32)

Arguments

Name Type Description
s IStore Provide the store instance
coverKey bytes32 Provide the cover key
productKey bytes32
tokenName string
expiryDate uint256 Specify the expiry date of this cxToken instance
Source Code
function getByteCodeInternal(
    IStore s,
    bytes32 coverKey,
    bytes32 productKey,
    string memory tokenName,
    uint256 expiryDate
  ) external pure returns (bytes memory bytecode, bytes32 salt) {
    salt = keccak256(abi.encodePacked(ProtoUtilV1.NS_COVER_CXTOKEN, coverKey, productKey, expiryDate));

    //slither-disable-next-line too-many-digits
    bytecode = abi.encodePacked(type(cxToken).creationCode, abi.encode(s, coverKey, productKey, tokenName, expiryDate));
    require(bytecode.length > 0, "Invalid bytecode");
  }

Contracts