sc/deposit.js
function getDepositAddressBySafeAddress(conn, safeAddress, cb){
    var conn = conn || db;
    if(!validationUtils.isNonemptyString(safeAddress))
        return cb("param safeAddress is null or empty string");
    if(!validationUtils.isValidAddress(safeAddress))
        return cb("param safeAddress is not a valid address");
    const arrDefinition = [
        'or', 
        [
            ['address', constants.FOUNDATION_SAFE_ADDRESS],
            ['address', safeAddress],
        ]
    ];
    const depositAddress = objectHash.getChash160(arrDefinition);
    conn.query("SELECT definition FROM shared_addresses WHERE shared_address = ?", [depositAddress], 
        function(rows) {
            if (rows.length !== 1 )
                return cb("deposit Address is not found when getDepositAddressBySafeAddress " + safeAddress);
            cb(null, depositAddress);
    });
}
function getDepositAddressBySafeAddress(conn, safeAddress, cb){
    var conn = conn || db;
    if(!validationUtils.isNonemptyString(safeAddress))
        return cb("param safeAddress is null or empty string");
    if(!validationUtils.isValidAddress(safeAddress))
        return cb("param safeAddress is not a valid address");
    const arrDefinition = [
        'or', 
        [
            ['address', constants.FOUNDATION_SAFE_ADDRESS],
            ['address', safeAddress],
        ]
    ];
    const depositAddress = objectHash.getChash160(arrDefinition);
    conn.query("SELECT definition FROM shared_addresses WHERE shared_address = ?", [depositAddress], 
        function(rows) {
            if (rows.length !== 1 )
                return cb("deposit Address is not found when getDepositAddressBySafeAddress " + safeAddress);
            cb(null, depositAddress);
    });
}
function getDepositAddressBySafeAddress ( conn , safeAddress , cb ) { var conn = conn || db ; if ( ! validationUtils . isNonemptyString ( safeAddress ) ) return cb ( "param safeAddress is null or empty string" ) ; if ( ! validationUtils . isValidAddress ( safeAddress ) ) return cb ( "param safeAddress is not a valid address" ) ; const arrDefinition = [ 'or' , [ [ 'address' , constants . FOUNDATION_SAFE_ADDRESS ] , [ 'address' , safeAddress ] , ] ] ; const depositAddress = objectHash . getChash160 ( arrDefinition ) ; conn . query ( "SELECT definition FROM shared_addresses WHERE shared_address = ?" , [ depositAddress ] , function ( rows ) { if ( rows . length !== 1 ) return cb ( "deposit Address is not found when getDepositAddressBySafeAddress " + safeAddress ) ; cb ( null , depositAddress ) ; } ) ; }
Returns deposit address by supernode safe address.

@param	{obj}	    conn      if conn is null, use db query, otherwise use conn.
@param   {String}    safeAddress
@param   {function}	cb( err, depositAddress ) callback function
If address is invalid, then returns err "invalid address".
If can not find the address, then returns err "depositAddress not found".
Returns deposit address by supernode safe address .