Submitted by djxploit, also found by brgltd
In getloan() and replayloan(), the safetransfer and safetransferfrom doesnt check the existence of code at the token address. This is a known issue while using solmates libraries.
Hence this may lead to miscalculation of funds and may lead to loss of funds , because if safetransfer() and safetransferfrom() are called on a token address that doesnt have contract in it, it will always return success, bypassing the return value check. Due to this protocol will think that funds has been transferred and successful , and records will be accordingly calculated, but in reality funds were never transferred.
So this will lead to miscalculation and possibly loss of funds
https://github.com/code-423n4/2022-08-olympus/blob/main/src/modules/TRSRY.sol#L110
https://github.com/code-423n4/2022-08-olympus/blob/main/src/modules/TRSRY.sol#L99
Use openzeppelins safeERC20 or implement a code existence check.
ind-igo (Olympus) confirmed and commented:
