Closed filcap closed 6 years ago
Added a JavaScript Test Script that can be used to emulate a process that is monitoring ExportReceiptLog events from the MET token contract.
Sample Usage:
Fil-NA-MacBook:metronome fil$ geth attach --preload js/metronome.js,js/const.js,js/initMetronome.js Initializing with 1 and 10000000 Founder is 0x00a329c0648769a73afac7f9381e08fb43dbea72 Configuring MTNToken tx 0x2f62829f88046b9b7492949247fce83d1689bc9b8f710f422f6b00814a3ba587 MTNToken published at 0xee35211c4d9126d520bbfeaf3cfee5fe7b86f221 Configuring Smart Token tx 0x4a61bfd958b47d562a8be7a66e44786fa1e82fd3595a2f3874fcf1609e8fbeee Smart Token published at 0x7c276dcaab99bd16163c1bcce671cad6a1ec0945 gas for mint 1560371 tx 0x416404c9f6ed9b5a783a92ec86081f5107691011fef32c3a91b274d35c968039 Minted true Deployment Phase 1 Complete Changing Ownership tx 0xaff7106ef9a611131dba7fe3b5b9e2bf1f04eefbf333e3ca0d0bad84cbc0b3bf tx 0x94da06bc053384379a3d71fb6f13b272b3a14e8a8508a2d700c431a5de863a22 tx 0xff8109ed76e4c74e0b7fd0962f20c3986ab7a3d5c03ccb01c2a2a2f7eff34533 tx 0x9f14d402692259b4ee6b4baa7306022a0c2feb9ce69a2918a987f1aab5bfab94 tx 0xf5e9629b6c48d2346d0c2f341ed5cd1420c2fd6694a5518ac9e6eb4e45cf6c2e tx 0xa0f09c26a6fd7c680b18c93739a87c7360a3f580e26067ed945665f89f6cb6ff Ownership has been transfered to 0xcc9898748cef37d910397fa925e13482745d06e5 Configuring AutonomousConverter Contract gas for ac 87265 tx 0x0e1a81ab7bba2c5e462b307a9e480a8f826e42fc6fa4a7df88f0dadacde76703 Configuring Proceeds gas for proceeds 66118 tx 0x864c316603b89d222f56facb929a7adfc349f7c315db8f9774ed5743d3e8f33f gas for init 156711 tx 0xd052597626b33370bb58570d18e42b496b8c42b8088d91d55d80e3a27b101533 Initialized true Welcome to the Geth JavaScript console! instance: Parity//v1.8.6-beta-2d051e4-20180109/x86_64-macos/rustc1.22.1 coinbase: 0x00a329c0648769a73afac7f9381e08fb43dbea72 at block: 15 (Sat, 10 Mar 2018 13:36:59 PST) modules: eth:1.0 net:1.0 parity:1.0 parity_accounts:1.0 parity_pubsub:1.0 personal:1.0 pubsub:1.0 rpc:1.0 secretstore:1.0 shh:1.0 shh_pubsub:1.0 traces:1.0 web3:1.0 > loadScript('js/testExport.js') tx 0xc23a7038bf119ccfc73388a3683bf6c6581881277bc88145384cf3dc40eca713 fund buyer 0 tx 0x9cdfb1bdab8135c52de99c1b707a83eedd0d8d16f0dbbcff91d9b2d5808c6d76 fund buyer 1 tx 0x141baf827c6742d6d6c6b2593473cd0a715825277633ff4d91f152152dda7c56 fund buyer 2 tx 0x2aac2c1a89b888f11d4aa5f701662c3aae82ead5359dd8dc1cdd595fa35db61e buyer 0 purchases MTN buyer 0 has 500000000000000000 tx 0x35b026f3b0b7bc5abc8def1de68b5f14d469abb1c51775cd383bcccc9568f643 buyer 1 purchases MTN buyer 1 has 500000000000000000 tx 0x3de4013d341ca49fb81c7bf2d8b07aa77c1c8b075088edd87b255c2d17820e6a buyer 2 purchases MTN buyer 2 has 500000000000000000 Configuring TokenPorter tx 0x48c6636d2e68def9b907d7b3ebc3884afea5de791c1812d1f5576afd2d19e519 tx 0xf100cddcc08b9867e45f98baf6b3983d5b8240501dd9ee4e464feefd7b905601 TokenPorter published at 0x6a063e17acfec6ea9a171a4a97b0d94840c1cc7c export tests are ready, invoke exportMTNFor(i), to test for export receipt monitoring true > exportMTNFor(0) buyer 0 has 500000000000000000 before export tx 0xfab1a38ca876c5577906be4a7a7041a9b1ba6a6351cb1ba83a365be97ca55f29 buyer 0 has 0 after burn undefined > export receipt found {"address":"0x6a063e17acfec6ea9a171a4a97b0d94840c1cc7c","args":{"amountToBurn":"500000000000000000","burnSequence":"1","currentBurnHash":"0x9541453b9ad54322389ee754692f8502f9319f96f85d336174afc4e84fee11dd","currentTick":"0","dailyMintable":"2.88e+21","destinationChain":"0x4554480000000000","destinationMetronomeAddr":"0xee35211c4d9126d520bbfeaf3cfee5fe7b86f221","destinationRecipientAddr":"0x97c250ac0b3669614e5ef1c6451ab3dc8528207b","extraData":"0x65787472612064617461","genesisTime":"1520717820","prevBurnHash":"0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a","supplyOnAllChains":["2.000001e+24","0","0","0","0","0"]},"blockHash":"0xed6375603f69e950ab0d2538e1478e293c589dc2ce2d6a094088ffed8bbeb4a9","blockNumber":24,"event":"ExportReceiptLog","logIndex":2,"transactionHash":"0xfab1a38ca876c5577906be4a7a7041a9b1ba6a6351cb1ba83a365be97ca55f29","transactionIndex":0,"transactionLogIndex":"0x2","type":"mined"} > exportMTNFor(1) buyer 1 has 500000000000000000 before export tx 0x53d436aa153c7120e0468ecd3f39d4f88faf1a723f44d3cfd13a4861e3dda89f buyer 1 has 0 after burn undefined > export receipt found {"address":"0x6a063e17acfec6ea9a171a4a97b0d94840c1cc7c","args":{"amountToBurn":"500000000000000000","burnSequence":"2","currentBurnHash":"0xea842f4dae3cc72559e5a1ba7d3e45eb0469d872db947776a529e44f9ed24801","currentTick":"0","dailyMintable":"2.879999856e+21","destinationChain":"0x4554480000000000","destinationMetronomeAddr":"0xee35211c4d9126d520bbfeaf3cfee5fe7b86f221","destinationRecipientAddr":"0x183ad823f9380aebbcc69ee06d8dd7a4a4364dd0","extraData":"0x65787472612064617461","genesisTime":"1520717820","prevBurnHash":"0x9541453b9ad54322389ee754692f8502f9319f96f85d336174afc4e84fee11dd","supplyOnAllChains":["2.0000005e+24","0","0","0","0","0"]},"blockHash":"0x2c5334a8ae49cd66e93059e7bf0b20567d12a6d748ea21ac048de609bba5453a","blockNumber":25,"event":"ExportReceiptLog","logIndex":2,"transactionHash":"0x53d436aa153c7120e0468ecd3f39d4f88faf1a723f44d3cfd13a4861e3dda89f","transactionIndex":0,"transactionLogIndex":"0x2","type":"mined"} > exportMTNFor(2) buyer 2 has 500000000000000000 before export tx 0x89858b2ddad1f1b857c15f0435926bfd4f623e435e1c3f8776eed7ed8c5965f7 buyer 2 has 0 after burn undefined > export receipt found {"address":"0x6a063e17acfec6ea9a171a4a97b0d94840c1cc7c","args":{"amountToBurn":"500000000000000000","burnSequence":"3","currentBurnHash":"0x026d796184aab58d9f4e6c253a7b2407966fc3811682180cb617c4eb19074ffd","currentTick":"0","dailyMintable":"2.879999712e+21","destinationChain":"0x4554480000000000","destinationMetronomeAddr":"0xee35211c4d9126d520bbfeaf3cfee5fe7b86f221","destinationRecipientAddr":"0x47c2bfeec3fa20dca941f6e87073b0f0b07076b0","extraData":"0x65787472612064617461","genesisTime":"1520717820","prevBurnHash":"0xea842f4dae3cc72559e5a1ba7d3e45eb0469d872db947776a529e44f9ed24801","supplyOnAllChains":["2e+24","0","0","0","0","0"]},"blockHash":"0x3940cb9f872619ec1dd854e2e2b94ad9e48fdca70558a68ce1ada29bb6e408ad","blockNumber":26,"event":"ExportReceiptLog","logIndex":2,"transactionHash":"0x89858b2ddad1f1b857c15f0435926bfd4f623e435e1c3f8776eed7ed8c5965f7","transactionIndex":0,"transactionLogIndex":"0x2","type":"mined"} >
@twleung @jgarzik ping
Added a JavaScript Test Script that can be used to emulate a process that is monitoring ExportReceiptLog events from the MET token contract.
Sample Usage: