del p['value'] assert t == 'gov/TextProposal', 'invalid proposal type: {t}' assert p == {}, 'expected proposal to be empty after deleting contents' p['proposal_content'] = { 'type': t, 'value': { 'title': v['title'], 'description': v['description'] } } p['proposal_id'] = v['proposal_id'] p['proposal_status'] = v['proposal_status'] p['final_tally_result'] = v['final_tally_result'] p['submit_time'] = v['submit_time'] p['deposit_end_time'] = v['deposit_end_time'] p['total_deposit'] = v['total_deposit'] p['voting_start_time'] = v['voting_start_time'] p['voting_end_time'] = v['voting_end_time'] if __name__ == '__main__': parser = lib.init_default_argument_parser( prog_desc='Convert genesis.json from v0.33.x to v0.34.0', default_chain_id='cosmoshub-n', default_start_time='2019-02-11T12:00:00Z', ) lib.main(parser, process_raw_genesis)
#!/usr/bin/env python3 import lib def process_genesis(genesis, parsed_args): genesis['app_state']['bank']['send_enabled'] = False return genesis if __name__ == '__main__': parser = lib.init_default_argument_parser( prog_desc='Migrate genesis.json to disable send txs', default_chain_id='betanet-1', default_start_time='2019-02-11T12:00:00Z', ) lib.main(parser, process_genesis)
def correct_decimal(float_num): return int(float_num * (10**DECIMAL_UNIT)) / (10**DECIMAL_UNIT) def invariant_check(schedules): ratio_sum = 0 for schedule in schedules: ratio_sum += float(schedule['ratio']) if ratio_sum != 1: sys.exit('%f, invariant failed' % ratio_sum) def get_time_after_n_month(start_date, n): target_month = start_date.month + n year = target_month > 12 and start_date.year + int( target_month / 12) or start_date.year month = target_month - 12 * (year - start_date.year) return int(start_date.replace(year=year, month=month).timestamp()) if __name__ == '__main__': parser = lib.init_default_argument_parser( prog_desc='Convert genesis.json from columbus-1 to columbus-2', default_chain_id='columbus-2', default_start_time='2019-05-20T05:00:00Z', ) lib.main(parser, process_raw_genesis)