eth-token-index

Token symbol to address unique index
Log | Files | Refs

commit 8b07a9f3dc3e436b90e90ab5a73affe3a22e1e02
parent 3fc9d4ed58360a384773d342d5a62f6676a42465
Author: lash <dev@holbrook.no>
Date:   Sat, 25 Mar 2023 16:10:36 +0000

Change identifiers to literal instead of hashes

Diffstat:
Mpython/CHANGELOG | 4++++
Mpython/eth_token_index/data/TokenUniqueSymbolIndex.bin | 4++--
Mpython/eth_token_index/data/TokenUniqueSymbolIndex.json | 2+-
Mpython/eth_token_index/data/TokenUniqueSymbolIndex.metadata.json | 2+-
Mpython/eth_token_index/index.py | 6+++---
Mpython/setup.cfg | 2+-
Msolidity/TokenUniqueSymbolIndex.sol | 109++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
7 files changed, 93 insertions(+), 36 deletions(-)

diff --git a/python/CHANGELOG b/python/CHANGELOG @@ -1,3 +1,7 @@ +- 0.6.0 + * Use literal keys instead of hashes in registry +- 0.5.0 + * Update python classifiers - 0.4.3 * Upgrade deps - 0.4.2 diff --git a/python/eth_token_index/data/TokenUniqueSymbolIndex.bin b/python/eth_token_index/data/TokenUniqueSymbolIndex.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600460009080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061122b806100c46000396000f3fe608060405234801561001057600080fd5b50600436106100d1576000357c0100000000000000000000000000000000000000000000000000000000900480637ef502981161008e5780637ef50298146101d25780638da5cb5b14610202578063bb34534c14610220578063da2824a814610250578063e2095c0714610280578063f2fde38b146102b0576100d1565b806301ffc9a7146100d65780630a3b0a4f146101065780630cbb0f83146101365780634420e486146101545780635ae06f7e1461018457806379ba5097146101b4575b600080fd5b6100f060048036038101906100eb9190610cdd565b6102e0565b6040516100fd9190610d25565b60405180910390f35b610120600480360381019061011b9190610d9e565b6104d8565b60405161012d9190610d25565b60405180910390f35b61013e6104ea565b60405161014b9190610de4565b60405180910390f35b61016e60048036038101906101699190610d9e565b610503565b60405161017b9190610d25565b60405180910390f35b61019e60048036038101906101999190610d9e565b6107c9565b6040516101ab9190610d25565b60405180910390f35b6101bc61087b565b6040516101c99190610d25565b60405180910390f35b6101ec60048036038101906101e79190610e35565b610a21565b6040516101f99190610de4565b60405180910390f35b61020a610a39565b6040516102179190610e71565b60405180910390f35b61023a60048036038101906102359190610e35565b610a5d565b6040516102479190610e71565b60405180910390f35b61026a60048036038101906102659190610d9e565b610abd565b6040516102779190610d25565b60405180910390f35b61029a60048036038101906102959190610eb8565b610b78565b6040516102a79190610e71565b60405180910390f35b6102ca60048036038101906102c59190610d9e565b610bcc565b6040516102d79190610d25565b60405180910390f35b600063cbdb05c77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361033457600190506104d3565b63bb34534c7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361038657600190506104d3565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103d857600190506104d3565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361042a57600190506104d3565b6337a47be47c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361047c57600190506104d3565b6380c84bd67c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036104ce57600190506104d3565b600090505b919050565b60006104e382610503565b9050919050565b600060016004805490506104fe9190610f14565b905090565b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661055b57600080fd5b60606000806000808673ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f95d89b41000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161060a9190610fb9565b6000604051808303816000865af19150503d8060008114610647576040519150601f19603f3d011682016040523d82523d6000602084013e61064c565b606091505b50915091508161065b57600080fd5b8080602001905181019061066f9190611107565b94506002856040516106819190610fb9565b602060405180830381855afa15801561069e573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906106c19190611165565b935060036000858152602001908152602001600020549250600083146106e657600080fd5b60048054905060036000868152602001908152602001600020819055506004879080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016004805490506107789190610f14565b8773ffffffffffffffffffffffffffffffffffffffff167f9cc987676e7d63379f176ea50df0ae8d2d9d1141d1231d4ce15b5965f73c943060405160405180910390a3600195505050505050919050565b60003373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461082357600080fd5b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905560019050919050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108d857600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600191505090565b60036020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806003600084815260200190815260200160002054905060048181548110610a8a57610a89611192565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915050919050565b60003373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b1757600080fd5b6001600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b60006004600183610b8991906111c1565b81548110610b9a57610b99611192565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c2757600080fd5b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610cba81610c85565b8114610cc557600080fd5b50565b600081359050610cd781610cb1565b92915050565b600060208284031215610cf357610cf2610c7b565b5b6000610d0184828501610cc8565b91505092915050565b60008115159050919050565b610d1f81610d0a565b82525050565b6000602082019050610d3a6000830184610d16565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610d6b82610d40565b9050919050565b610d7b81610d60565b8114610d8657600080fd5b50565b600081359050610d9881610d72565b92915050565b600060208284031215610db457610db3610c7b565b5b6000610dc284828501610d89565b91505092915050565b6000819050919050565b610dde81610dcb565b82525050565b6000602082019050610df96000830184610dd5565b92915050565b6000819050919050565b610e1281610dff565b8114610e1d57600080fd5b50565b600081359050610e2f81610e09565b92915050565b600060208284031215610e4b57610e4a610c7b565b5b6000610e5984828501610e20565b91505092915050565b610e6b81610d60565b82525050565b6000602082019050610e866000830184610e62565b92915050565b610e9581610dcb565b8114610ea057600080fd5b50565b600081359050610eb281610e8c565b92915050565b600060208284031215610ece57610ecd610c7b565b5b6000610edc84828501610ea3565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610f1f82610dcb565b9150610f2a83610dcb565b9250828203905081811115610f4257610f41610ee5565b5b92915050565b600081519050919050565b600081905092915050565b60005b83811015610f7c578082015181840152602081019050610f61565b60008484015250505050565b6000610f9382610f48565b610f9d8185610f53565b9350610fad818560208601610f5e565b80840191505092915050565b6000610fc58284610f88565b915081905092915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61102382610fda565b810181811067ffffffffffffffff8211171561104257611041610feb565b5b80604052505050565b6000611055610c71565b9050611061828261101a565b919050565b600067ffffffffffffffff82111561108157611080610feb565b5b61108a82610fda565b9050602081019050919050565b60006110aa6110a584611066565b61104b565b9050828152602081018484840111156110c6576110c5610fd5565b5b6110d1848285610f5e565b509392505050565b600082601f8301126110ee576110ed610fd0565b5b81516110fe848260208601611097565b91505092915050565b60006020828403121561111d5761111c610c7b565b5b600082015167ffffffffffffffff81111561113b5761113a610c80565b5b611147848285016110d9565b91505092915050565b60008151905061115f81610e09565b92915050565b60006020828403121561117b5761117a610c7b565b5b600061118984828501611150565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006111cc82610dcb565b91506111d783610dcb565b92508282019050808211156111ef576111ee610ee5565b5b9291505056fea26469706673582212206cf2d3c037fb979b3fc0ab5fc99911be644587e1f813236d1f9957174262643b64736f6c63430008120033 -\ No newline at end of file +608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600460009080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611721806100c46000396000f3fe608060405234801561001057600080fd5b50600436106100ec576000357c0100000000000000000000000000000000000000000000000000000000900480634420e486116100a9578063bb34534c11610083578063bb34534c1461027d578063da2824a8146102ad578063e2095c07146102dd578063f2fde38b1461030d576100ec565b80634420e486146101ff5780635ae06f7e1461022f5780638da5cb5b1461025f576100ec565b806301ffc9a7146100f15780630a3b0a4f146101215780630cbb0f83146101515780631c5a9d9c1461016f57806329092d0e1461019f5780633ea053eb146101cf575b600080fd5b61010b60048036038101906101069190610ff5565b61033d565b604051610118919061103d565b60405180910390f35b61013b600480360381019061013691906110b6565b610535565b604051610148919061103d565b60405180910390f35b610159610547565b60405161016691906110fc565b60405180910390f35b610189600480360381019061018491906110b6565b610560565b604051610196919061103d565b60405180910390f35b6101b960048036038101906101b491906110b6565b610567565b6040516101c6919061103d565b60405180910390f35b6101e960048036038101906101e491906110b6565b61086b565b6040516101f6919061103d565b60405180910390f35b610219600480360381019061021491906110b6565b610872565b604051610226919061103d565b60405180910390f35b610249600480360381019061024491906110b6565b610b95565b604051610256919061103d565b60405180910390f35b610267610c7e565b6040516102749190611126565b60405180910390f35b61029760048036038101906102929190611177565b610ca2565b6040516102a49190611126565b60405180910390f35b6102c760048036038101906102c291906110b6565b610d02565b6040516102d4919061103d565b60405180910390f35b6102f760048036038101906102f291906111d0565b610df3565b6040516103049190611126565b60405180910390f35b610327600480360381019061032291906110b6565b610e47565b604051610334919061103d565b60405180910390f35b60006312625fe57c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103915760019050610530565b63b7bca6257c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103e35760019050610530565b639479f0ae7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036104355760019050610530565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036104875760019050610530565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036104d95760019050610530565b6380c84bd67c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361052b5760019050610530565b600090505b919050565b600061054082610872565b9050919050565b6000600160048054905061055b919061122c565b905090565b6000919050565b6000806000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166105f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ef906112bd565b60405180910390fd5b6000600102600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540361067d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067490611329565b60405180910390fd5b600160048054905061068f919061122c565b905060026000600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481526020019081526020016000205491508082101561078a576004818154811061070257610701611349565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166004838154811061074157610740611349565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600480548061079c5761079b611378565b5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055600060026000600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548152602001908152602001600020819055507f24a12366c02e13fe4a9e03d86a8952e85bb74a456c16e4a18b6d8295700b74bb846040516108589190611126565b60405180910390a1600192505050919050565b6000919050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166108ca57600080fd5b60606000806000808673ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f95d89b41000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516109799190611418565b6000604051808303816000865af19150503d80600081146109b6576040519150601f19603f3d011682016040523d82523d6000602084013e6109bb565b606091505b5091509150816109ca57600080fd5b808060200190518101906109de9190611566565b9450602085511115610a25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1c906115fb565b60405180910390fd5b84610a2f90611650565b93506002600085815260200190815260200160002054925060008314610a5457600080fd5b60048054905060026000868152602001908152602001600020819055506004879080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550837f3465c39c7e9b14641553cf015fbfe670207bd64c689d17806d885bda47899feb88604051610b489190611126565b60405180910390a27fa226db3f664042183ee0281230bba26cbf7b5057e50aee7f25a175ff45ce4d7f87604051610b7f9190611126565b60405180910390a1600195505050505050919050565b60003373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bef57600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff02191690557f9002f14780245e47491e7a2caae4712e7cea2e298e4e76c6916845145b90a51c82604051610c6d9190611126565b60405180910390a160019050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806002600084815260200190815260200160002054905060048181548110610ccf57610cce611349565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915050919050565b60003373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d5c57600080fd5b60018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f6ff3aa2ea7b53070f6d9d07a445d338d89e8edef44250ffa8be19f53910d4a2e82604051610de29190611126565b60405180910390a160019050919050565b60006004600183610e0491906116b7565b81548110610e1557610e14611349565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ea257600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610fd281610f9d565b8114610fdd57600080fd5b50565b600081359050610fef81610fc9565b92915050565b60006020828403121561100b5761100a610f93565b5b600061101984828501610fe0565b91505092915050565b60008115159050919050565b61103781611022565b82525050565b6000602082019050611052600083018461102e565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061108382611058565b9050919050565b61109381611078565b811461109e57600080fd5b50565b6000813590506110b08161108a565b92915050565b6000602082840312156110cc576110cb610f93565b5b60006110da848285016110a1565b91505092915050565b6000819050919050565b6110f6816110e3565b82525050565b600060208201905061111160008301846110ed565b92915050565b61112081611078565b82525050565b600060208201905061113b6000830184611117565b92915050565b6000819050919050565b61115481611141565b811461115f57600080fd5b50565b6000813590506111718161114b565b92915050565b60006020828403121561118d5761118c610f93565b5b600061119b84828501611162565b91505092915050565b6111ad816110e3565b81146111b857600080fd5b50565b6000813590506111ca816111a4565b92915050565b6000602082840312156111e6576111e5610f93565b5b60006111f4848285016111bb565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611237826110e3565b9150611242836110e3565b925082820390508181111561125a576112596111fd565b5b92915050565b600082825260208201905092915050565b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b60006112a7600783611260565b91506112b282611271565b602082019050919050565b600060208201905081810360008301526112d68161129a565b9050919050565b7f4552525f4e4f545f464f554e4400000000000000000000000000000000000000600082015250565b6000611313600d83611260565b915061131e826112dd565b602082019050919050565b6000602082019050818103600083015261134281611306565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600081519050919050565b600081905092915050565b60005b838110156113db5780820151818401526020810190506113c0565b60008484015250505050565b60006113f2826113a7565b6113fc81856113b2565b935061140c8185602086016113bd565b80840191505092915050565b600061142482846113e7565b915081905092915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61148282611439565b810181811067ffffffffffffffff821117156114a1576114a061144a565b5b80604052505050565b60006114b4610f89565b90506114c08282611479565b919050565b600067ffffffffffffffff8211156114e0576114df61144a565b5b6114e982611439565b9050602081019050919050565b6000611509611504846114c5565b6114aa565b90508281526020810184848401111561152557611524611434565b5b6115308482856113bd565b509392505050565b600082601f83011261154d5761154c61142f565b5b815161155d8482602086016114f6565b91505092915050565b60006020828403121561157c5761157b610f93565b5b600082015167ffffffffffffffff81111561159a57611599610f98565b5b6115a684828501611538565b91505092915050565b7f4552525f544f4b454e5f53594d424f4c5f544f4f5f4c4f4e4700000000000000600082015250565b60006115e5601983611260565b91506115f0826115af565b602082019050919050565b60006020820190508181036000830152611614816115d8565b9050919050565b6000819050602082019050919050565b60006116378251611141565b80915050919050565b60008160020a8302905092915050565b600061165b826113a7565b826116658461161b565b90506116708161162b565b925060208210156116b0576116ab7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83602003600802611640565b831692505b5050919050565b60006116c2826110e3565b91506116cd836110e3565b92508282019050808211156116e5576116e46111fd565b5b9291505056fea26469706673582212202d5e34e38d3848059ea59164361dfb3c8b17c65d37e48efb3db4959be9855b3764736f6c63430008120033 +\ No newline at end of file diff --git a/python/eth_token_index/data/TokenUniqueSymbolIndex.json b/python/eth_token_index/data/TokenUniqueSymbolIndex.json @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addedAccount","type":"address"},{"indexed":true,"internalType":"uint256","name":"accountIndex","type":"uint256"}],"name":"AddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"register","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"registry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_token","type":"address"}],"name":"AddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_symbol","type":"bytes32"},{"indexed":false,"internalType":"address","name":"_token","type":"address"}],"name":"AddressKey","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_token","type":"address"}],"name":"AddressRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_writer","type":"address"}],"name":"WriterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_writer","type":"address"}],"name":"WriterDeleted","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"activate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"deactivate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"register","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"remove","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] diff --git a/python/eth_token_index/data/TokenUniqueSymbolIndex.metadata.json b/python/eth_token_index/data/TokenUniqueSymbolIndex.metadata.json @@ -1 +1 @@ -{"compiler":{"version":"0.8.18+commit.87f61d96"},"language":"Solidity","output":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addedAccount","type":"address"},{"indexed":true,"internalType":"uint256","name":"accountIndex","type":"uint256"}],"name":"AddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"register","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"registry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"TokenUniqueSymbolIndex.sol":"TokenUniqueSymbolIndex"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"TokenUniqueSymbolIndex.sol":{"keccak256":"0xcf9df7f7998e4e1f3978bb9c9c4c3d530b995d7ab7fdc5b096df7229044b9e1f","license":"GPL-3.0-or-later","urls":["bzz-raw://479c6b796953506e685c9d03d1158606adc0d409d9f7de3dfff5c2b578f37eb5","dweb:/ipfs/QmRhpDCSTnrPYGQL2dDGee3GZAGiqoVBLLqXc2NaDP8gPz"]}},"version":1} +{"compiler":{"version":"0.8.18+commit.87f61d96"},"language":"Solidity","output":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_token","type":"address"}],"name":"AddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_symbol","type":"bytes32"},{"indexed":false,"internalType":"address","name":"_token","type":"address"}],"name":"AddressKey","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_token","type":"address"}],"name":"AddressRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_writer","type":"address"}],"name":"WriterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_writer","type":"address"}],"name":"WriterDeleted","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"activate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"deactivate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"register","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"remove","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"TokenUniqueSymbolIndex.sol":"TokenUniqueSymbolIndex"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"TokenUniqueSymbolIndex.sol":{"keccak256":"0x2a6fff0204fcb0f35a4995b0679ed49bf3044e15956122f5aaaeeb95f9f61fd4","license":"AGPL-3.0-or-later","urls":["bzz-raw://1180f1d3ab2a9791db5cadf8637baaf6719d8089af03307e59a6c2b0ec70a2c4","dweb:/ipfs/QmWczv5ERbmVFBUbWdW87afzDbXsq31FtuujpJ3vyWk9WL"]}},"version":1} diff --git a/python/eth_token_index/index.py b/python/eth_token_index/index.py @@ -32,9 +32,9 @@ datadir = os.path.join(moddir, 'data') def to_identifier(s): - h = hashlib.new('sha256') - h.update(s.encode('utf-8')) - return h.digest().hex() + r = s.encode('utf-8').hex() + assert len(r) < 64 + return '{:0<64}'.format(r) class TokenUniqueSymbolIndex(TxFactory): diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = eth-token-index -version = 0.5.0 +version = 0.6.0 description = Token symbol to address unique index author = Louis Holbrook author_email = dev@holbrook.no diff --git a/solidity/TokenUniqueSymbolIndex.sol b/solidity/TokenUniqueSymbolIndex.sol @@ -1,19 +1,35 @@ -pragma solidity >0.6.11; +pragma solidity >=0.8.0; -// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-License-Identifier: AGPL-3.0-or-later contract TokenUniqueSymbolIndex { // EIP 173 address public owner; - address newOwner; - mapping(address => bool) writers; + mapping(address => bool) isWriter; - mapping ( bytes32 => uint256 ) public registry; + mapping ( bytes32 => uint256 ) registry; + //address[] tokenIndex; + mapping ( address => bytes32 ) tokenIndex; address[] tokens; - event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); // EIP173 - event AddressAdded(address indexed addedAccount, uint256 indexed accountIndex); // AccountsIndex + // Implements EIP173 + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + // Implements AccountsIndex + event AddressKey(bytes32 indexed _symbol, address _token); + + // Implements AccountsIndex + event AddressAdded(address _token); + + // Implements AccountsIndexMutable + event AddressRemoved(address _token); + + // Implements Writer + event WriterAdded(address _writer); + + // Implements Writer + event WriterDeleted(address _writer); constructor() { owner = msg.sender; @@ -33,8 +49,10 @@ contract TokenUniqueSymbolIndex { return tokens[idx]; } + // Attempt to register the token at the given address. + // Will revet if symbol cannot be retrieved, or if symbol already exists. function register(address _token) public returns (bool) { - require(writers[msg.sender]); + require(isWriter[msg.sender]); bytes memory token_symbol; bytes32 token_symbol_key; @@ -44,14 +62,17 @@ contract TokenUniqueSymbolIndex { require(_ok); token_symbol = abi.decode(_r, (bytes)); - token_symbol_key = sha256(token_symbol); + require(token_symbol.length <= 32, 'ERR_TOKEN_SYMBOL_TOO_LONG'); + token_symbol_key = bytes32(token_symbol); idx = registry[token_symbol_key]; require(idx == 0); registry[token_symbol_key] = tokens.length; tokens.push(_token); - emit AddressAdded(_token, tokens.length - 1); + tokenIndex[_token] = token_symbol_key; + emit AddressKey(token_symbol_key, _token); + emit AddressAdded(_token); return true; } @@ -60,6 +81,38 @@ contract TokenUniqueSymbolIndex { return register(_token); } + // Implements AccountsIndexMutable + function remove(address _token) external returns (bool) { + uint256 i; + uint256 l; + + require(isWriter[msg.sender], 'ERR_AXX'); + require(tokenIndex[_token] != bytes32(0), 'ERR_NOT_FOUND'); + + l = tokens.length - 1; + + i = registry[tokenIndex[_token]]; + if (i < l) { + tokens[i] = tokens[l]; + } + tokens.pop(); + registry[tokenIndex[_token]] = 0; + emit AddressRemoved(_token); + return true; + } + + // Implements AccountsIndexMutable + function activate(address _token) public pure returns(bool) { + _token; + return false; + } + + // Implements AccountsIndexMutable + function deactivate(address _token) public pure returns(bool) { + _token; + return false; + } + // Implements AccountsIndex function entryCount() public view returns ( uint256 ) { @@ -68,52 +121,52 @@ contract TokenUniqueSymbolIndex { // Implements EIP173 function transferOwnership(address _newOwner) public returns (bool) { - require(msg.sender == owner); - newOwner = _newOwner; - return true; - } - - // Implements OwnedAccepter - function acceptOwnership() public returns (bool) { address oldOwner; - require(msg.sender == newOwner); - oldOwner = owner; - owner = newOwner; - newOwner = address(0); + require(msg.sender == owner); + oldOwner = owner; + owner = _newOwner; + emit OwnershipTransferred(oldOwner, owner); + return true; } // Implements Writer function addWriter(address _writer) public returns (bool) { require(owner == msg.sender); - writers[_writer] = true; + isWriter[_writer] = true; + + emit WriterAdded(_writer); + return true; } // Implements Writer function deleteWriter(address _writer) public returns (bool) { require(owner == msg.sender); - delete writers[_writer]; + delete isWriter[_writer]; + + emit WriterDeleted(_writer); + return true; } // Implements EIP165 function supportsInterface(bytes4 _sum) public pure returns (bool) { - if (_sum == 0xcbdb05c7) { // AccountsIndex + if (_sum == 0x12625fe5) { // Registry return true; } - if (_sum == 0xbb34534c) { // RegistryClient + if (_sum == 0xb7bca625) { // AccountsIndex return true; } - if (_sum == 0x01ffc9a7) { // EIP165 + if (_sum == 0x9479f0ae) { // AccountsIndexMutable return true; } - if (_sum == 0x9493f8b2) { // EIP173 + if (_sum == 0x01ffc9a7) { // EIP165 return true; } - if (_sum == 0x37a47be4) { // OwnedAccepter + if (_sum == 0x9493f8b2) { // EIP173 return true; } if (_sum == 0x80c84bd6) { // Writer