It's actually already written and being used on 2 sites- It's a Site Referral extension which can be either used to award points or give a percentage or amount discount.
Unfortunately it's a bit raw and not easily installed, hence the 2 sites it is on paid me to directly install it.
Bookmarks