Bug contract workflow

Fixes the bug that prevented to reach terminated state of a compassion contract. Some hooks added for adding code on contract activation.
Move 1 line higher, to keep open.tools import grouped.