migrate funds job

migrated the old funds job from th ancient version of metridoc.  I blindly
copied the business logic from the old job and made sure it works.  Still need
to create some tests and make sure everthing works properly.