no,it's based on AAV, not yearly pay.
I'm not sure of the exact formula to max out spending with minimal penalty but the concept is:
2019 stay just under the cap
2020 sign 2 & 5 year contracts, go $20 over & pay 20%
2021 go $20 over & pay 30%
2022 2 year contracts expire, stay under the cap
2023 sign 2 & 5 year contracts
The big flaw is that the next CBA could change the rules. The other flaw is that this is a lot of work just to save a million per year in penalties.