@@ -828,4 +828,51 @@ describe("Token", function () {
828828 await ousd . totalSupply ( )
829829 ) ;
830830 } ) ;
831+
832+ it ( "Should exact transfer to new contract accounts" , async ( ) => {
833+ let { ousd, vault, matt, usdc, mockNonRebasing } = await loadFixture (
834+ defaultFixture
835+ ) ;
836+
837+ // Add yield to so we need higher resolution
838+ await usdc . connect ( matt ) . mint ( usdcUnits ( "9671.2345" ) ) ;
839+ await usdc . connect ( matt ) . transfer ( vault . address , usdcUnits ( "9671.2345" ) ) ;
840+ await vault . rebase ( ) ;
841+
842+ // Helper to verify balance-exact transfers in
843+ const checkTransferIn = async ( amount ) => {
844+ const beforeReceiver = await ousd . balanceOf ( mockNonRebasing . address ) ;
845+ await ousd . connect ( matt ) . transfer ( mockNonRebasing . address , amount ) ;
846+ const afterReceiver = await ousd . balanceOf ( mockNonRebasing . address ) ;
847+ expect ( beforeReceiver . add ( amount ) ) . to . equal ( afterReceiver ) ;
848+ } ;
849+
850+ // Helper to verify balance-exact transfers out
851+ const checkTransferOut = async ( amount ) => {
852+ const beforeReceiver = await ousd . balanceOf ( mockNonRebasing . address ) ;
853+ await mockNonRebasing . transfer ( matt . address , amount ) ;
854+ const afterReceiver = await ousd . balanceOf ( mockNonRebasing . address ) ;
855+ expect ( beforeReceiver . sub ( amount ) ) . to . equal ( afterReceiver ) ;
856+ } ;
857+
858+ // In
859+ await checkTransferIn ( 1 ) ;
860+ await checkTransferIn ( 2 ) ;
861+ await checkTransferIn ( 5 ) ;
862+ await checkTransferIn ( 9 ) ;
863+ await checkTransferIn ( 100 ) ;
864+ await checkTransferIn ( 2 ) ;
865+ await checkTransferIn ( 5 ) ;
866+ await checkTransferIn ( 9 ) ;
867+
868+ // Out
869+ await checkTransferOut ( 1 ) ;
870+ await checkTransferOut ( 2 ) ;
871+ await checkTransferOut ( 5 ) ;
872+ await checkTransferOut ( 9 ) ;
873+ await checkTransferOut ( 100 ) ;
874+ await checkTransferOut ( 2 ) ;
875+ await checkTransferOut ( 5 ) ;
876+ await checkTransferOut ( 9 ) ;
877+ } ) ;
831878} ) ;
0 commit comments