This contract is the migrator. The logic is inspired by Aave's LendToAaveMigrator.
As for the SwissBorgToken, it is also implementing code from OpenZeppelin.
It is composed of one main function which is migrate(uint256 _amount). This method transfers from msg.sender an _amount of CHSB and transfers to the sender the equivalent amount of BORG.
The exchange rate is:
1 CHSB = 1 * (10 ** 10) BORG
This is because the CHSB has 8 decimals, while the BORG has 18 decimals.
A UUPSUpgradeable proxy is implemented in front of this contract.
The proxy upgradeability role as well as the manager role are defined in the Security page.
There is an unused variable in the code called totalChsbMigrated which will be used for the website.
The ChsbToBorgMigrator contract is released under the AGPL 3.0 license.

Functional Requirements

The migrator should be able to migrate any amount of CHSB owned by a user into the equivalent amount of BORG according to the exchange rate (in wei) defined above.
If the contract is paused, no migration should be possible.
If the contract is unpaused, migrations should be possible.
As the CHSB is an old contract, we added one mitigation. In case an attacker is able to exploit the CHSB and mint some tokens, any migration process should be reverted to protect the BORG.