Transfer Manager module for core transfer validation functionality (GeneralTransferManager.sol)

View Source: contracts/modules/TransferManager/GTM/GeneralTransferManager.solโ€‹

โ†— Extends: GeneralTransferManagerStorage, TransferManagerโ€‹

GeneralTransferManager

Events

event ChangeIssuanceAddress(address _issuanceAddress);
event ChangeDefaults(uint64 _defaultCanSendAfter, uint64 _defaultCanReceiveAfter);
event ModifyKYCData(address indexed _investor, address indexed _addedBy, uint64 _canSendAfter, uint64 _canReceiveAfter, uint64 _expiryTime);
event ModifyInvestorFlag(address indexed _investor, uint8 indexed _flag, bool _value);
event ModifyTransferRequirements(enum GeneralTransferManagerStorage.TransferType indexed _transferType, bool _fromValidKYC, bool _toValidKYC, bool _fromRestricted, bool _toRestricted);

Functions

Constructor

function (address _securityToken, address _polyToken) public nonpayable Module

Arguments

Name

Type

Description

_securityToken

address

Address of the security token

_polyToken

address

โ€‹

getInitFunction

โคพ overrides IModule.getInitFunctionโ€‹

This function returns the signature of configure function

function getInitFunction() public pure
returns(bytes4)

Arguments

Name

Type

Description

changeDefaults

Used to change the default times used when canSendAfter / canReceiveAfter are zero

function changeDefaults(uint64 _defaultCanSendAfter, uint64 _defaultCanReceiveAfter) public nonpayable withPerm

Arguments

Name

Type

Description

_defaultCanSendAfter

uint64

default for zero canSendAfter

_defaultCanReceiveAfter

uint64

default for zero canReceiveAfter

changeIssuanceAddress

Used to change the Issuance Address

function changeIssuanceAddress(address _issuanceAddress) public nonpayable withPerm

Arguments

Name

Type

Description

_issuanceAddress

address

new address for the issuance

executeTransfer

โคพ overrides ITransferManager.executeTransferโ€‹

Default implementation of verifyTransfer used by SecurityToken If the transfer request comes from the STO, it only checks that the investor is in the whitelist If the transfer request comes from a token holder, it checks that: a) Both are on the whitelist b) Seller's sale lockup period is over c) Buyer's purchase lockup is over

function executeTransfer(address _from, address _to, uint256 , bytes _data) external nonpayable
returns(enum ITransferManager.Result)

Arguments

Name

Type

Description

_from

address

Address of the sender

_to

address

Address of the receiver

โ€‹

uint256

_from Address of the sender

_data

bytes

โ€‹

_processTransferSignature

function _processTransferSignature(uint256 _nonce, uint256 _validFrom, uint256 _validTo, bytes _data) internal nonpayable

Arguments

Name

Type

Description

_nonce

uint256

โ€‹

_validFrom

uint256

โ€‹

_validTo

uint256

โ€‹

_data

bytes

โ€‹

verifyTransfer

โคพ overrides ITransferManager.verifyTransferโ€‹

Default implementation of verifyTransfer used by SecurityToken

function verifyTransfer(address _from, address _to, uint256 , bytes ) public view
returns(enum ITransferManager.Result, bytes32)

Arguments

Name

Type

Description

_from

address

Address of the sender

_to

address

Address of the receiver

โ€‹

uint256

_from Address of the sender

โ€‹

bytes

_from Address of the sender

_verifyTransfer

function _verifyTransfer(address _from, address _to) internal view
returns(enum ITransferManager.Result, bytes32)

Arguments

Name

Type

Description

_from

address

โ€‹

_to

address

โ€‹

modifyTransferRequirements

Modifies the successful checks required for a transfer to be deemed valid.

function modifyTransferRequirements(enum GeneralTransferManagerStorage.TransferType _transferType, bool _fromValidKYC, bool _toValidKYC, bool _fromRestricted, bool _toRestricted) public nonpayable withPerm

Arguments

Name

Type

Description

_transferType

enum GeneralTransferManagerStorage.TransferType

Type of transfer (0 = General, 1 = Issuance, 2 = Redemption)

_fromValidKYC

bool

Defines if KYC is required for the sender

_toValidKYC

bool

Defines if KYC is required for the receiver

_fromRestricted

bool

Defines if transfer time restriction is checked for the sender

_toRestricted

bool

Defines if transfer time restriction is checked for the receiver

modifyTransferRequirementsMulti

Modifies the successful checks required for transfers.

function modifyTransferRequirementsMulti(enum GeneralTransferManagerStorage.TransferType[] _transferTypes, bool[] _fromValidKYC, bool[] _toValidKYC, bool[] _fromRestricted, bool[] _toRestricted) public nonpayable withPerm

Arguments

Name

Type

Description

_transferTypes

enum GeneralTransferManagerStorage.TransferType[]

Types of transfer (0 = General, 1 = Issuance, 2 = Redemption)

_fromValidKYC

bool[]

Defines if KYC is required for the sender

_toValidKYC

bool[]

Defines if KYC is required for the receiver

_fromRestricted

bool[]

Defines if transfer time restriction is checked for the sender

_toRestricted

bool[]

Defines if transfer time restriction is checked for the receiver

_modifyTransferRequirements

function _modifyTransferRequirements(enum GeneralTransferManagerStorage.TransferType _transferType, bool _fromValidKYC, bool _toValidKYC, bool _fromRestricted, bool _toRestricted) internal nonpayable

Arguments

Name

Type

Description

_transferType

enum GeneralTransferManagerStorage.TransferType

โ€‹

_fromValidKYC

bool

โ€‹

_toValidKYC

bool

โ€‹

_fromRestricted

bool

โ€‹

_toRestricted

bool

โ€‹

modifyKYCData

Add or remove KYC info of an investor.

function modifyKYCData(address _investor, uint64 _canSendAfter, uint64 _canReceiveAfter, uint64 _expiryTime) public nonpayable withPerm

Arguments

Name

Type

Description

_investor

address

is the address to whitelist

_canSendAfter

uint64

is the moment when the sale lockup period ends and the investor can freely sell or transfer their tokens

_canReceiveAfter

uint64

is the moment when the purchase lockup period ends and the investor can freely purchase or receive tokens from others

_expiryTime

uint64

is the moment till investors KYC will be validated. After that investor need to do re-KYC

_modifyKYCData

function _modifyKYCData(address _investor, uint64 _canSendAfter, uint64 _canReceiveAfter, uint64 _expiryTime) internal nonpayable

Arguments

Name

Type

Description

_investor

address

โ€‹

_canSendAfter

uint64

โ€‹

_canReceiveAfter

uint64

โ€‹

_expiryTime

uint64

โ€‹

modifyKYCDataMulti

Add or remove KYC info of an investor.

function modifyKYCDataMulti(address[] _investors, uint64[] _canSendAfter, uint64[] _canReceiveAfter, uint64[] _expiryTime) public nonpayable withPerm

Arguments

Name

Type

Description

_investors

address[]

is the address to whitelist

_canSendAfter

uint64[]

is the moment when the sale lockup period ends and the investor can freely sell his tokens

_canReceiveAfter

uint64[]

is the moment when the purchase lockup period ends and the investor can freely purchase tokens from others

_expiryTime

uint64[]

is the moment till investors KYC will be validated. After that investor need to do re-KYC

modifyInvestorFlag

Used to modify investor Flag.

function modifyInvestorFlag(address _investor, uint8 _flag, bool _value) public nonpayable withPerm

Arguments

Name

Type

Description

_investor

address

is the address of the investor.

_flag

uint8

index of flag to change. flag is used to know specifics about investor like isAccredited.

_value

bool

value of the flag. a flag can be true or false.

_modifyInvestorFlag

function _modifyInvestorFlag(address _investor, uint8 _flag, bool _value) internal nonpayable

Arguments

Name

Type

Description

_investor

address

โ€‹

_flag

uint8

โ€‹

_value

bool

โ€‹

modifyInvestorFlagMulti

Used to modify investor data.

function modifyInvestorFlagMulti(address[] _investors, uint8[] _flag, bool[] _value) public nonpayable withPerm

Arguments

Name

Type

Description

_investors

address[]

List of the addresses to modify data about.

_flag

uint8[]

index of flag to change. flag is used to know specifics about investor like isAccredited.

_value

bool[]

value of the flag. a flag can be true or false.

modifyKYCDataSigned

Adds or removes addresses from the whitelist - can be called by anyone with a valid signature

function modifyKYCDataSigned(address _investor, uint256 _canSendAfter, uint256 _canReceiveAfter, uint256 _expiryTime, uint256 _validFrom, uint256 _validTo, uint256 _nonce, bytes _signature) public nonpayable

Arguments

Name

Type

Description

_investor

address

is the address to whitelist

_canSendAfter

uint256

is the moment when the sale lockup period ends and the investor can freely sell his tokens

_canReceiveAfter

uint256

is the moment when the purchase lockup period ends and the investor can freely purchase tokens from others

_expiryTime

uint256

is the moment till investors KYC will be validated. After that investor need to do re-KYC

_validFrom

uint256

is the time that this signature is valid from

_validTo

uint256

is the time that this signature is valid until

_nonce

uint256

nonce of signature (avoid replay attack)

_signature

bytes

issuer signature

_modifyKYCDataSigned

function _modifyKYCDataSigned(address _investor, uint256 _canSendAfter, uint256 _canReceiveAfter, uint256 _expiryTime, uint256 _validFrom, uint256 _validTo, uint256 _nonce, bytes _signature) internal nonpayable
returns(bool)

Arguments

Name

Type

Description

_investor

address

โ€‹

_canSendAfter

uint256

โ€‹

_canReceiveAfter

uint256

โ€‹

_expiryTime

uint256

โ€‹

_validFrom

uint256

โ€‹

_validTo

uint256

โ€‹

_nonce

uint256

โ€‹

_signature

bytes

โ€‹

modifyKYCDataSignedMulti

Adds or removes addresses from the whitelist - can be called by anyone with a valid signature

function modifyKYCDataSignedMulti(address[] _investor, uint256[] _canSendAfter, uint256[] _canReceiveAfter, uint256[] _expiryTime, uint256 _validFrom, uint256 _validTo, uint256 _nonce, bytes _signature) public nonpayable

Arguments

Name

Type

Description

_investor

address[]

is the address to whitelist

_canSendAfter

uint256[]

is the moment when the sale lockup period ends and the investor can freely sell his tokens

_canReceiveAfter

uint256[]

is the moment when the purchase lockup period ends and the investor can freely purchase tokens from others

_expiryTime

uint256[]

is the moment till investors KYC will be validated. After that investor need to do re-KYC

_validFrom

uint256

is the time that this signature is valid from

_validTo

uint256

is the time that this signature is valid until

_nonce

uint256

nonce of signature (avoid replay attack)

_signature

bytes

issuer signature

_modifyKYCDataSignedMulti

function _modifyKYCDataSignedMulti(address[] _investor, uint256[] _canSendAfter, uint256[] _canReceiveAfter, uint256[] _expiryTime, uint256 _validFrom, uint256 _validTo, uint256 _nonce, bytes _signature) internal nonpayable
returns(bool)

Arguments

Name

Type

Description

_investor

address[]

โ€‹

_canSendAfter

uint256[]

โ€‹

_canReceiveAfter

uint256[]

โ€‹

_expiryTime

uint256[]

โ€‹

_validFrom

uint256

โ€‹

_validTo

uint256

โ€‹

_nonce

uint256

โ€‹

_signature

bytes

โ€‹

_checkSig

Used to verify the signature

function _checkSig(bytes32 _hash, bytes _signature, uint256 _nonce) internal nonpayable
returns(bool)

Arguments

Name

Type

Description

_hash

bytes32

โ€‹

_signature

bytes

โ€‹

_nonce

uint256

โ€‹

_validExpiry

Internal function used to check whether the KYC of investor is valid

function _validExpiry(uint64 _expiryTime) internal view
returns(valid bool)

Arguments

Name

Type

Description

_expiryTime

uint64

Expiry time of the investor

_validLockTime

Internal function used to check whether the lock time of investor is valid

function _validLockTime(uint64 _lockTime) internal view
returns(valid bool)

Arguments

Name

Type

Description

_lockTime

uint64

Lock time of the investor

_adjustTimes

Internal function to adjust times using default values

function _adjustTimes(uint64 _canSendAfter, uint64 _canReceiveAfter) internal view
returns(uint64, uint64)

Arguments

Name

Type

Description

_canSendAfter

uint64

โ€‹

_canReceiveAfter

uint64

โ€‹

_getKey

function _getKey(bytes32 _key1, address _key2) internal pure
returns(bytes32)

Arguments

Name

Type

Description

_key1

bytes32

โ€‹

_key2

address

โ€‹

_getKYCValues

function _getKYCValues(address _investor, IDataStore dataStore) internal view
returns(canSendAfter uint64, canReceiveAfter uint64, expiryTime uint64, added uint8)

Arguments

Name

Type

Description

_investor

address

โ€‹

dataStore

IDataStore

โ€‹

_isExistingInvestor

function _isExistingInvestor(address _investor, IDataStore dataStore) internal view
returns(bool)

Arguments

Name

Type

Description

_investor

address

โ€‹

dataStore

IDataStore

โ€‹

_getValuesForTransfer

function _getValuesForTransfer(address _from, address _to) internal view
returns(canSendAfter uint64, fromExpiry uint64, canReceiveAfter uint64, toExpiry uint64)

Arguments

Name

Type

Description

_from

address

โ€‹

_to

address

โ€‹

getAllInvestors

Returns list of all investors

function getAllInvestors() public view
returns(investors address[])

Arguments

Name

Type

Description

getInvestors

Returns list of investors in a range

function getInvestors(uint256 _fromIndex, uint256 _toIndex) public view
returns(investors address[])

Arguments

Name

Type

Description

_fromIndex

uint256

โ€‹

_toIndex

uint256

โ€‹

getAllInvestorFlags

function getAllInvestorFlags() public view
returns(investors address[], flags uint256[])

Arguments

Name

Type

Description

getInvestorFlag

function getInvestorFlag(address _investor, uint8 _flag) public view
returns(value bool)

Arguments

Name

Type

Description

_investor

address

โ€‹

_flag

uint8

โ€‹

getInvestorFlags

function getInvestorFlags(address _investor) public view
returns(flags uint256)

Arguments

Name

Type

Description

_investor

address

โ€‹

_getInvestorFlags

function _getInvestorFlags(address _investor) internal view
returns(flags uint256)

Arguments

Name

Type

Description

_investor

address

โ€‹

getAllKYCData

Returns list of all investors data

function getAllKYCData() external view
returns(investors address[], canSendAfters uint256[], canReceiveAfters uint256[], expiryTimes uint256[])

Arguments

Name

Type

Description

getKYCData

Returns list of specified investors data

function getKYCData(address[] _investors) external view
returns(uint256[], uint256[], uint256[])

Arguments

Name

Type

Description

_investors

address[]

โ€‹

_kycData

function _kycData(address[] _investors) internal view
returns(uint256[], uint256[], uint256[])

Arguments

Name

Type

Description

_investors

address[]

โ€‹

getPermissions

โคพ overrides IModule.getPermissionsโ€‹

Return the permissions flag that are associated with general trnasfer manager

function getPermissions() public view
returns(bytes32[])

Arguments

Name

Type

Description

getTokensByPartition

โคพ overrides TransferManager.getTokensByPartitionโ€‹

return the amount of tokens for a given user as per the partition

function getTokensByPartition(bytes32 _partition, address _tokenHolder, uint256 _additionalBalance) external view
returns(uint256)

Arguments

Name

Type

Description

_partition

bytes32

Identifier

_tokenHolder

address

Whom token amount need to query

_additionalBalance

uint256

It is the _value that transfer during transfer/transferFrom function call

getAddressBytes32

function getAddressBytes32() public view
returns(bytes32)

Arguments

Name

Type

Description