add apigen and test contract