Two-terminal four-terminal perovskite battery