use ace editor for contracts && fix endowment calculation