An open economy model with currency substitution and real dollarization