commit 8f9834105d3ca2ed0e0ebfb46618d1aea4adb72f parent d1f2b2cbdc0daaad573acf97d0f9c8e054ebc70b Author: nolash <dev@holbrook.no> Date: Sun, 10 Jan 2021 22:03:26 +0100 Implement external signer Diffstat:
17 files changed, 226 insertions(+), 143 deletions(-)
diff --git a/python/CHANGELOG b/python/CHANGELOG @@ -1,3 +1,6 @@ +- 0.1.0-unreleased + * Implement external signer + * Standardize cli arg flags - 0.0.3 * Add viewer cli - 0.0.2 diff --git a/python/eth_address_declarator/data/AddressDeclarator.bin b/python/eth_address_declarator/data/AddressDeclarator.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b5060405162001bc838038062001bc8833981810160405281019062000037919062000717565b6060336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600581908060018154018082558091505060019003906000526020600020016000909190919091509080519060200190620000b69291906200068f565b5060056001600580549050620000cd91906200083e565b8154811062000105577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001434090806001815401808255809150506001900390600052602060002001600090919091909150556200014933836200015260201b60201c565b505050620009c3565b600080606060006200016b3387620003b360201b60201c565b92506002600084815260200190815260200160002054905060008114156200030c57600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506005829080600181540180825580915050600190039060005260206000200160009091909190915090805190602001906200026a9291906200068f565b50600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60016005805490506200032091906200083e565b90508060026000858152602001908152602001600020819055506005818154811062000375577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018590806001815401808255809150506001900390600052602060002001600090919091909150556001935050505092915050565b6000806000602867ffffffffffffffff811115620003fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156200042d5781602001600182028036833780820191505090505b50905060008560405160200162000445919062000795565b604051602081830303815290604052905060005b601481101562000527578181815181106200049d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b838281518110620004e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806200051e90620008f7565b91505062000459565b50846040516020016200053b919062000795565b604051602081830303815290604052905060005b60148110156200062b5781818151811062000593577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b83601483620005ae9190620007e1565b81518110620005e6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806200062290620008f7565b9150506200054f565b506002826040516200063e9190620007b2565b602060405180830381855afa1580156200065c573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019062000681919062000717565b925082935050505092915050565b828054828255906000526020600020908101928215620006ce579160200282015b82811115620006cd578251825591602001919060010190620006b0565b5b509050620006dd9190620006e1565b5090565b5b80821115620006fc576000816000905550600101620006e2565b5090565b6000815190506200071181620009a9565b92915050565b6000602082840312156200072a57600080fd5b60006200073a8482850162000700565b91505092915050565b62000758620007528262000879565b62000945565b82525050565b60006200076b82620007cb565b620007778185620007d6565b935062000789818560208601620008c1565b80840191505092915050565b6000620007a3828462000743565b60148201915081905092915050565b6000620007c082846200075e565b915081905092915050565b600081519050919050565b600081905092915050565b6000620007ee82620008b7565b9150620007fb83620008b7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156200083357620008326200096d565b5b828201905092915050565b60006200084b82620008b7565b91506200085883620008b7565b9250828210156200086e576200086d6200096d565b5b828203905092915050565b6000620008868262000897565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015620008e1578082015181840152602081019050620008c4565b83811115620008f1576000848401525b50505050565b60006200090482620008b7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156200093a57620009396200096d565b5b600182019050919050565b6000620009528262000959565b9050919050565b600062000966826200099c565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160601b9050919050565b620009b4816200088d565b8114620009c057600080fd5b50565b6111f580620009d36000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638c661b36116100665780638c661b361461016d5780638da5cb5b1461019d578063ae47ece0146101bb578063d0e95db1146101eb578063ff7496b41461021b5761009e565b806301ffc9a7146100a357806322168e4f146100d357806350e0c6d3146101035780637d64bf1d14610133578063880ad0af14610163575b600080fd5b6100bd60048036038101906100b89190610c91565b61024b565b6040516100ca9190610eae565b60405180910390f35b6100ed60048036038101906100e89190610c2c565b610252565b6040516100fa9190610e71565b60405180910390f35b61011d60048036038101906101189190610b8b565b6102fe565b60405161012a9190610f04565b60405180910390f35b61014d60048036038101906101489190610c2c565b61034a565b60405161015a9190610e71565b60405180910390f35b61016b6103f6565b005b61018760048036038101906101829190610bb4565b610431565b6040516101949190610e8c565b60405180910390f35b6101a56104f5565b6040516101b29190610e71565b60405180910390f35b6101d560048036038101906101d09190610bf0565b610519565b6040516101e29190610eae565b60405180910390f35b61020560048036038101906102009190610b8b565b61076c565b6040516102129190610f04565b60405180910390f35b61023560048036038101906102309190610cba565b6107b8565b6040516102429190610ec9565b60405180910390f35b6000919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106102cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106103c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905092915050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042890610ee4565b60405180910390fd5b606060008061044085856107f5565b91506002600083815260200190815260200160002054905060058181548110610492577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018054806020026020016040519081016040528092919081815260200182805480156104e657602002820191906000526020600020905b8154815260200190600101908083116104d2575b50505050509250505092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806060600061052a33876107f5565b92506002600084815260200190815260200160002054905060008114156106c857600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600582908060018154018082558091505060019003906000526020600020016000909190919091509080519060200190610626929190610ab8565b50600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60016005805490506106da9190610fd5565b90508060026000858152602001908152602001600020819055506005818154811061072e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018590806001815401808255809150506001900390600052602060002001600090919091909150556001935050505092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b600582815481106107c857600080fd5b9060005260206000200181815481106107e057600080fd5b90600052602060002001600091509150505481565b6000806000602867ffffffffffffffff81111561083b577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561086d5781602001600182028036833780820191505090505b5090506000856040516020016108839190610e3f565b604051602081830303815290604052905060005b601481101561095f578181815181106108d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b83828151811061091d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610957906110ba565b915050610897565b50846040516020016109719190610e3f565b604051602081830303815290604052905060005b6014811015610a59578181815181106109c7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b836014836109e09190610f7f565b81518110610a17577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610a51906110ba565b915050610985565b50600282604051610a6a9190610e5a565b602060405180830381855afa158015610a87573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610aaa9190610c68565b925082935050505092915050565b828054828255906000526020600020908101928215610af4579160200282015b82811115610af3578251825591602001919060010190610ad8565b5b509050610b019190610b05565b5090565b5b80821115610b1e576000816000905550600101610b06565b5090565b600081359050610b3181611163565b92915050565b600081359050610b468161117a565b92915050565b600081519050610b5b8161117a565b92915050565b600081359050610b7081611191565b92915050565b600081359050610b85816111a8565b92915050565b600060208284031215610b9d57600080fd5b6000610bab84828501610b22565b91505092915050565b60008060408385031215610bc757600080fd5b6000610bd585828601610b22565b9250506020610be685828601610b22565b9150509250929050565b60008060408385031215610c0357600080fd5b6000610c1185828601610b22565b9250506020610c2285828601610b37565b9150509250929050565b60008060408385031215610c3f57600080fd5b6000610c4d85828601610b22565b9250506020610c5e85828601610b76565b9150509250929050565b600060208284031215610c7a57600080fd5b6000610c8884828501610b4c565b91505092915050565b600060208284031215610ca357600080fd5b6000610cb184828501610b61565b91505092915050565b60008060408385031215610ccd57600080fd5b6000610cdb85828601610b76565b9250506020610cec85828601610b76565b9150509250929050565b6000610d028383610da1565b60208301905092915050565b610d1781611009565b82525050565b610d2e610d2982611009565b611103565b82525050565b6000610d3f82610f2f565b610d498185610f52565b9350610d5483610f1f565b8060005b83811015610d85578151610d6c8882610cf6565b9750610d7783610f45565b925050600181019050610d58565b5085935050505092915050565b610d9b8161101b565b82525050565b610daa81611027565b82525050565b610db981611027565b82525050565b6000610dca82610f3a565b610dd48185610f63565b9350610de4818560208601611087565b80840191505092915050565b6000610dfd601783610f6e565b91507f6f776e65722063616e6e6f74206265206368616e6765640000000000000000006000830152602082019050919050565b610e398161107d565b82525050565b6000610e4b8284610d1d565b60148201915081905092915050565b6000610e668284610dbf565b915081905092915050565b6000602082019050610e866000830184610d0e565b92915050565b60006020820190508181036000830152610ea68184610d34565b905092915050565b6000602082019050610ec36000830184610d92565b92915050565b6000602082019050610ede6000830184610db0565b92915050565b60006020820190508181036000830152610efd81610df0565b9050919050565b6000602082019050610f196000830184610e30565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b6000610f8a8261107d565b9150610f958361107d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fca57610fc9611127565b5b828201905092915050565b6000610fe08261107d565b9150610feb8361107d565b925082821015610ffe57610ffd611127565b5b828203905092915050565b60006110148261105d565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b838110156110a557808201518184015260208101905061108a565b838111156110b4576000848401525b50505050565b60006110c58261107d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156110f8576110f7611127565b5b600182019050919050565b600061110e82611115565b9050919050565b600061112082611156565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160601b9050919050565b61116c81611009565b811461117757600080fd5b50565b61118381611027565b811461118e57600080fd5b50565b61119a81611031565b81146111a557600080fd5b50565b6111b18161107d565b81146111bc57600080fd5b5056fea26469706673582212204460994967d4a16fb30d1f457d533e6929ca94e119064c8d4865ff61ed18590864736f6c63430008000033 -\ No newline at end of file +60806040523480156200001157600080fd5b506040516200140e3803806200140e833981810160405260208110156200003757600080fd5b81019080805190602001909291905050506060336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600581908060018154018082558091505060019003906000526020600020016000909190919091509080519060200190620000c79291906200065c565b50600560016005805490500381548110620000de57fe5b90600052602060002001434090806001815401808255809150506001900390600052602060002001600090919091909150556200012b338362000134640100000000026401000000009004565b505050620006cd565b6000806060600062000156338762000366640100000000026401000000009004565b9250600260008481526020019081526020016000205490506000811415620002f757600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600582908060018154018082558091505060019003906000526020600020016000909190919091509080519060200190620002559291906200065c565b50600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6001600580549050039050806002600085815260200190815260200160002081905550600581815481106200032857fe5b906000526020600020018590806001815401808255809150506001900390600052602060002001600090919091909150556001935050505092915050565b6000806060602867ffffffffffffffff811180156200038457600080fd5b506040519080825280601f01601f191660200182016040528015620003b85781602001600182028036833780820191505090505b509050606085604051602001808273ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401915050604051602081830303815290604052905060005b6014811015620004b2578181815181106200041e57fe5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028382815181106200047557fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808060010191505062000407565b5084604051602001808273ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401915050604051602081830303815290604052905060005b6014811015620005ab578181815181106200051457fe5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028360148301815181106200056e57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050620004fd565b506002826040518082805190602001908083835b60208310620005e45780518252602082019150602081019050602083039250620005bf565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa15801562000627573d6000803e3d6000fd5b5050506040513d60208110156200063d57600080fd5b8101908080519060200190929190505050925082935050505092915050565b8280548282559060005260206000209081019282156200069b579160200282015b828111156200069a5782518255916020019190600101906200067d565b5b509050620006aa9190620006ae565b5090565b5b80821115620006c9576000816000905550600101620006af565b5090565b610d3180620006dd6000396000f3fe608060405234801561001057600080fd5b50600436106100bb576000357c0100000000000000000000000000000000000000000000000000000000900480638c661b36116100835780638c661b36146102755780638da5cb5b1461032e578063ae47ece014610362578063d0e95db1146103c6578063ff7496b41461041e576100bb565b806301ffc9a7146100c057806322168e4f1461012357806350e0c6d31461019b5780637d64bf1d146101f3578063880ad0af1461026b575b600080fd5b61010b600480360360208110156100d657600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916906020019092919050505061046a565b60405180821515815260200191505060405180910390f35b61016f6004803603604081101561013957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610471565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101dd600480360360208110156101b157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104f0565b6040518082815260200191505060405180910390f35b61023f6004803603604081101561020957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061053c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102736105bb565b005b6102d76004803603604081101561028b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610629565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561031a5780820151818401526020810190506102ff565b505050509050019250505060405180910390f35b6103366106c0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103ae6004803603604081101561037857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e4565b60405180821515815260200191505060405180910390f35b610408600480360360208110156103dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610901565b6040518082815260200191505060405180910390f35b6104546004803603604081101561043457600080fd5b81019080803590602001909291908035906020019092919050505061094d565b6040518082815260200191505060405180910390f35b6000919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106104bd57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061058857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905092915050565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f6f776e65722063616e6e6f74206265206368616e67656400000000000000000081525060200191505060405180910390fd5b60606000806106388585610984565b9150600260008381526020019081526020016000205490506005818154811061065d57fe5b906000526020600020018054806020026020016040519081016040528092919081815260200182805480156106b157602002820191906000526020600020905b81548152602001906001019080831161069d575b50505050509250505092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080606060006106f53387610984565b925060026000848152602001908152602001600020549050600081141561089357600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506005829080600181540180825580915050600190039060005260206000200160009091909190915090805190602001906107f1929190610c6c565b50600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6001600580549050039050806002600085815260200190815260200160002081905550600581815481106108c357fe5b906000526020600020018590806001815401808255809150506001900390600052602060002001600090919091909150556001935050505092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b6005828154811061095a57fe5b90600052602060002001818154811061096f57fe5b90600052602060002001600091509150505481565b6000806060602867ffffffffffffffff811180156109a157600080fd5b506040519080825280601f01601f1916602001820160405280156109d45781602001600182028036833780820191505090505b509050606085604051602001808273ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401915050604051602081830303815290604052905060005b6014811015610aca57818181518110610a3857fe5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002838281518110610a8e57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050610a23565b5084604051602001808273ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401915050604051602081830303815290604052905060005b6014811015610bbf57818181518110610b2a57fe5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002836014830181518110610b8357fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050610b15565b506002826040518082805190602001908083835b60208310610bf65780518252602082019150602081019050602083039250610bd3565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015610c38573d6000803e3d6000fd5b5050506040513d6020811015610c4d57600080fd5b8101908080519060200190929190505050925082935050505092915050565b828054828255906000526020600020908101928215610ca8579160200282015b82811115610ca7578251825591602001919060010190610c8c565b5b509050610cb59190610cb9565b5090565b5b80821115610cd2576000816000905550600101610cba565b509056fea2646970667358221220d514108546e5c7028cd46823f97fbc7c70211eef191d14f42af773f7b6f2e8d464736f6c637827302e362e31322d646576656c6f702e323032312e312e382b636f6d6d69742e32376435313736350058 +\ No newline at end of file diff --git a/python/eth_address_declarator/runnable/add.py b/python/eth_address_declarator/runnable/add.py @@ -13,7 +13,9 @@ import logging # third-party imports import web3 - +from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer +from crypto_dev_signer.keystore import DictKeystore +from crypto_dev_signer.eth.helper import EthTxExecutor logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -26,33 +28,62 @@ data_dir = os.path.join(script_dir, '..', 'data') argparser = argparse.ArgumentParser() argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)') +argparser.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed') +argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed') +argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string') argparser.add_argument('-r', '--contract-address', dest='r', type=str, help='Address declaration contract address') -argparser.add_argument('-o', '--declarator-address', dest='o', type=str, help='Signing address for the declaration') +argparser.add_argument('-a', '--signer-address', dest='a', type=str, help='Accounts declarator owner') +argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing') argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir)) argparser.add_argument('-v', action='store_true', help='Be verbose') +argparser.add_argument('-vv', action='store_true', help='Be more verbose') argparser.add_argument('address', type=str, help='Ethereum address to add declaration to') argparser.add_argument('declaration', type=str, help='SHA256 sum of endorsement data to add') args = argparser.parse_args() -if args.v: +if args.vv: logg.setLevel(logging.DEBUG) +elif args.v: + logg.setLevel(logging.INFO) -def main(): - w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) +block_last = args.w +block_all = args.ww + +w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) + +signer_address = None +keystore = DictKeystore() +if args.y != None: + logg.debug('loading keystore file {}'.format(args.y)) + signer_address = keystore.import_keystore_file(args.y) + logg.debug('now have key for signer address {}'.format(signer_address)) +signer = EIP155Signer(keystore) + +chain_pair = args.i.split(':') +chain_id = int(chain_pair[1]) +helper = EthTxExecutor( + w3, + signer_address, + signer, + chain_id, + block=args.ww, + ) + + +def main(): f = open(os.path.join(args.abi_dir, 'AddressDeclarator.json'), 'r') abi = json.load(f) f.close() - w3.eth.defaultAccount = w3.eth.accounts[0] - if args.o != None: - w3.eth.defaultAccount = args.o - logg.debug('endorser address {}'.format(w3.eth.defaultAccount)) - c = w3.eth.contract(abi=abi, address=args.r) - tx_hash = c.functions.addDeclaration(args.address, args.declaration).transact() - print(tx_hash.hex()) + (tx_hash, rcpt) = helper.sign_and_send( + [ + c.functions.addDeclaration(args.address, args.declaration).buildTransaction, + ], + ) + print(tx_hash) if __name__ == '__main__': diff --git a/python/eth_address_declarator/runnable/deploy.py b/python/eth_address_declarator/runnable/deploy.py @@ -13,7 +13,9 @@ import logging # third-party imports import web3 - +from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer +from crypto_dev_signer.keystore import DictKeystore +from crypto_dev_signer.eth.helper import EthTxExecutor logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -26,18 +28,48 @@ data_dir = os.path.join(script_dir, '..', 'data') argparser = argparse.ArgumentParser() argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)') -argparser.add_argument('-o', '--owner', dest='o', type=str, help='Accounts declarator owner') +argparser.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed') +argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed') +argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string') +argparser.add_argument('-a', '--signer-address', dest='a', type=str, help='Accounts declarator owner') +argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing') argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir)) argparser.add_argument('-v', action='store_true', help='Be verbose') +argparser.add_argument('-vv', action='store_true', help='Be more verbose') argparser.add_argument('owner_description_digest', type=str, help='SHA256 of description metadata of contract deployer') args = argparser.parse_args() -if args.v: +if args.vv: logg.setLevel(logging.DEBUG) +elif args.v: + logg.setLevel(logging.INFO) -def main(): - w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) +block_last = args.w +block_all = args.ww + +w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) + +signer_address = None +keystore = DictKeystore() +if args.y != None: + logg.debug('loading keystore file {}'.format(args.y)) + signer_address = keystore.import_keystore_file(args.y) + logg.debug('now have key for signer address {}'.format(signer_address)) +signer = EIP155Signer(keystore) + +chain_pair = args.i.split(':') +chain_id = int(chain_pair[1]) +helper = EthTxExecutor( + w3, + signer_address, + signer, + chain_id, + block=args.ww, + ) + + +def main(): f = open(os.path.join(args.abi_dir, 'AddressDeclarator.json'), 'r') abi = json.load(f) f.close() @@ -46,15 +78,15 @@ def main(): bytecode = f.read() f.close() - w3.eth.defaultAccount = w3.eth.accounts[0] - if args.o != None: - w3.eth.defaultAccount = args.o - logg.debug('owner address {}'.format(w3.eth.defaultAccount)) - c = w3.eth.contract(abi=abi, bytecode=bytecode) logg.info('digest {}'.format(args.owner_description_digest)) - tx_hash = c.constructor(args.owner_description_digest).transact() + (tx_hash, rcpt) = helper.sign_and_send( + [ + c.constructor(args.owner_description_digest).buildTransaction, + ], + force_wait=True, + ) rcpt = w3.eth.getTransactionReceipt(tx_hash) print(rcpt.contractAddress) diff --git a/python/eth_address_declarator/runnable/view.py b/python/eth_address_declarator/runnable/view.py @@ -14,7 +14,7 @@ import logging # third-party imports import web3 - +from crypto_dev_signer.keystore import DictKeystore logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -28,17 +28,23 @@ data_dir = os.path.join(script_dir, '..', 'data') argparser = argparse.ArgumentParser() argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)') argparser.add_argument('-r', '--contract-address', dest='r', type=str, help='Address declaration contract address') -argparser.add_argument('-o', '--declarator-address', dest='o', type=str, help='Signing address for the declaration') +argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string') +argparser.add_argument('-a', '-declarator-address', dest='a', type=str, help='Signing address for the declaration') +argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing') argparser.add_argument('--resolve', action='store_true', help='Attempt to resolve the hashes to actual content') argparser.add_argument('--resolve-http', dest='resolve_http', type=str, help='Base url to look up content hashes') argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir)) argparser.add_argument('-v', action='store_true', help='Be verbose') +argparser.add_argument('-vv', action='store_true', help='Be more verbose') argparser.add_argument('address', type=str, help='Ethereum declaration address to look up') args = argparser.parse_args() -if args.v: +if args.vv: logg.setLevel(logging.DEBUG) +elif args.v: + logg.setLevel(logging.INFO) +w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) def try_sha256(s): r = urllib.request.urlopen(os.path.join(args.resolve_http, s.hex())) @@ -47,22 +53,32 @@ def try_sha256(s): def try_utf8(s): return s.decode('utf-8') +signer_address = None +keystore = DictKeystore() +if args.y != None: + logg.debug('loading keystore file {}'.format(args.y)) + signer_address = keystore.import_keystore_file(args.y) + logg.debug('now have key for signer address {}'.format(signer_address)) + def main(): - w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) f = open(os.path.join(args.abi_dir, 'AddressDeclarator.json'), 'r') abi = json.load(f) f.close() - w3.eth.defaultAccount = w3.eth.accounts[0] - if args.o != None: - w3.eth.defaultAccount = args.o - logg.debug('endorser address {}'.format(w3.eth.defaultAccount)) + declarator_address = signer_address + if declarator_address == None: + declarator_address = args.a + if declarator_address == None: + sys.stderr.write('missing declarator address, specify -y or -a\n') + sys.exit(1) + + logg.debug('declarator address {}'.format(declarator_address)) c = w3.eth.contract(abi=abi, address=args.r) - declarations = c.functions.declaration(w3.eth.defaultAccount, args.address).call() + declarations = c.functions.declaration(declarator_address, args.address).call() for d in declarations: if not args.resolve: diff --git a/python/eth_token_index/data/TokenUniqueSymbolIndex.bin b/python/eth_token_index/data/TokenUniqueSymbolIndex.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c57806100c46000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063bb34534c1161005b578063bb34534c14610115578063cbb8343414610145578063d22057a914610163578063e2095c071461019357610088565b806301ffc9a71461008d5780637ef50298146100bd578063880ad0af146100ed5780638da5cb5b146100f7575b600080fd5b6100a760048036038101906100a291906107eb565b6101c3565b6040516100b4919061094e565b60405180910390f35b6100d760048036038101906100d2919061075d565b61027b565b6040516100e49190610989565b60405180910390f35b6100f5610293565b005b6100ff6102ce565b60405161010c9190610933565b60405180910390f35b61012f600480360381019061012a919061075d565b6102f2565b60405161013c9190610933565b60405180910390f35b61014d610378565b60405161015a9190610989565b60405180910390f35b61017d600480360381019061017891906107af565b610391565b60405161018a919061094e565b60405180910390f35b6101ad60048036038101906101a89190610855565b610612565b6040516101ba9190610933565b60405180910390f35b600063325d15e260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561021b5760019050610276565b6301ffc9a760e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156102715760019050610276565b600090505b919050565b60016020528060005260406000206000915090505481565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c590610969565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806001600084815260200190815260200160002054905060028181548110610345577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915050919050565b6000600160028054905061038c9190610a82565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103ec57600080fd5b60606000806000808673ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f95d89b41000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161049b919061091c565b6000604051808303816000865af19150503d80600081146104d8576040519150601f19603f3d011682016040523d82523d6000602084013e6104dd565b606091505b5091509150816104ec57600080fd5b808060200190518101906105009190610814565b9450600285604051610512919061091c565b602060405180830381855afa15801561052f573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906105529190610786565b935083881461056057600080fd5b600160008581526020019081526020016000205492506000831461058357600080fd5b60028054905060016000868152602001908152602001600020819055506002879080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019550505050505092915050565b600060026001836106239190610a2c565b8154811061065a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061069f61069a846109d5565b6109a4565b9050828152602081018484840111156106b757600080fd5b6106c2848285610b34565b509392505050565b6000813590506106d981610bc5565b92915050565b6000813590506106ee81610bdc565b92915050565b60008151905061070381610bdc565b92915050565b60008135905061071881610bf3565b92915050565b600082601f83011261072f57600080fd5b815161073f84826020860161068c565b91505092915050565b60008135905061075781610c0a565b92915050565b60006020828403121561076f57600080fd5b600061077d848285016106df565b91505092915050565b60006020828403121561079857600080fd5b60006107a6848285016106f4565b91505092915050565b600080604083850312156107c257600080fd5b60006107d0858286016106df565b92505060206107e1858286016106ca565b9150509250929050565b6000602082840312156107fd57600080fd5b600061080b84828501610709565b91505092915050565b60006020828403121561082657600080fd5b600082015167ffffffffffffffff81111561084057600080fd5b61084c8482850161071e565b91505092915050565b60006020828403121561086757600080fd5b600061087584828501610748565b91505092915050565b61088781610ab6565b82525050565b61089681610ac8565b82525050565b60006108a782610a05565b6108b18185610a10565b93506108c1818560208601610b34565b80840191505092915050565b60006108da601783610a1b565b91507f6f776e65722063616e6e6f74206265206368616e6765640000000000000000006000830152602082019050919050565b61091681610b2a565b82525050565b6000610928828461089c565b915081905092915050565b6000602082019050610948600083018461087e565b92915050565b6000602082019050610963600083018461088d565b92915050565b60006020820190508181036000830152610982816108cd565b9050919050565b600060208201905061099e600083018461090d565b92915050565b6000604051905081810181811067ffffffffffffffff821117156109cb576109ca610b96565b5b8060405250919050565b600067ffffffffffffffff8211156109f0576109ef610b96565b5b601f19601f8301169050602081019050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610a3782610b2a565b9150610a4283610b2a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610a7757610a76610b67565b5b828201905092915050565b6000610a8d82610b2a565b9150610a9883610b2a565b925082821015610aab57610aaa610b67565b5b828203905092915050565b6000610ac182610b0a565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015610b52578082015181840152602081019050610b37565b83811115610b61576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610bce81610ab6565b8114610bd957600080fd5b50565b610be581610ad4565b8114610bf057600080fd5b50565b610bfc81610ade565b8114610c0757600080fd5b50565b610c1381610b2a565b8114610c1e57600080fd5b5056fea2646970667358221220ddfe90639c05ff4cfde92247820a70440251493847b735f6c9e4493db9f5fe6764736f6c63430008000033 -\ No newline at end of file +608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610938806100c46000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063bb34534c11610078578063bb34534c1461018d578063cbb83434146101e5578063d22057a914610203578063e2095c0714610267576100a5565b806301ffc9a7146100aa5780637ef502981461010d578063880ad0af1461014f5780638da5cb5b14610159575b600080fd5b6100f5600480360360208110156100c057600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690602001909291905050506102bf565b60405180821515815260200191505060405180910390f35b6101396004803603602081101561012357600080fd5b81019080803590602001909291905050506103af565b6040518082815260200191505060405180910390f35b6101576103c7565b005b610161610435565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101b9600480360360208110156101a357600080fd5b8101908080359060200190929190505050610459565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101ed6104b2565b6040518082815260200191505060405180910390f35b61024f6004803603604081101561021957600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104c2565b60405180821515815260200191505060405180910390f35b6102936004803603602081101561027d57600080fd5b8101908080359060200190929190505050610899565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600063325d15e27c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561033357600190506103aa565b6301ffc9a77c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156103a557600190506103aa565b600090505b919050565b60016020528060005260406000206000915090505481565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f6f776e65722063616e6e6f74206265206368616e67656400000000000000000081525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600160008481526020019081526020016000205490506002818154811061047f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915050919050565b6000600160028054905003905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461051d57600080fd5b6060600080600060608673ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f95d89b41000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518082805190602001908083835b602083106105f357805182526020820191506020810190506020830392506105d0565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610655576040519150601f19603f3d011682016040523d82523d6000602084013e61065a565b606091505b50915091508161066957600080fd5b80806020019051602081101561067e57600080fd5b810190808051604051939291908464010000000082111561069e57600080fd5b838201915060208201858111156106b457600080fd5b82518660018202830111640100000000821117156106d157600080fd5b8083526020830192505050908051906020019080838360005b838110156107055780820151818401526020810190506106ea565b50505050905090810190601f1680156107325780820380516001836020036101000a031916815260200191505b5060405250505094506002856040518082805190602001908083835b60208310610771578051825260208201915060208101905060208303925061074e565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa1580156107b3573d6000803e3d6000fd5b5050506040513d60208110156107c857600080fd5b810190808051906020019092919050505093508388146107e757600080fd5b600160008581526020019081526020016000205492506000831461080a57600080fd5b60028054905060016000868152602001908152602001600020819055506002879080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019550505050505092915050565b6000600260018301815481106108ab57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905091905056fea2646970667358221220ce760022fc7bb7f92ad2fd58865b52c3c6f9908d39e825564e6ea958b598504964736f6c637827302e362e31322d646576656c6f702e323032312e312e382b636f6d6d69742e32376435313736350058 +\ No newline at end of file diff --git a/python/eth_token_index/runnable/add.py b/python/eth_token_index/runnable/add.py @@ -14,7 +14,9 @@ import hashlib # third-party imports import web3 - +from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer +from crypto_dev_signer.keystore import DictKeystore +from crypto_dev_signer.eth.helper import EthTxExecutor logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -27,19 +29,49 @@ data_dir = os.path.join(script_dir, '..', 'data') argparser = argparse.ArgumentParser() argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)') +argparser.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed') +argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed') +argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing') +argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string') argparser.add_argument('-r', '--contract-address', dest='r', type=str, help='Token endorsement contract address') -argparser.add_argument('-o', '--owner-address', dest='o', type=str, help='Address to use to sign endorsement transaction') +argparser.add_argument('-a', '--signer-address', dest='a', type=str, help='Accounts declarator owner') argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir)) argparser.add_argument('-v', action='store_true', help='Be verbose') +argparser.add_argument('-vv', action='store_true', help='Be more verbose') argparser.add_argument('address', type=str, help='Ethereum address to add declaration to') args = argparser.parse_args() -if args.v: +if args.vv: logg.setLevel(logging.DEBUG) +elif args.v: + logg.setLevel(logging.INFO) -def main(): - w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) +block_last = args.w +block_all = args.ww + +w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) + +signer_address = None +keystore = DictKeystore() +if args.y != None: + logg.debug('loading keystore file {}'.format(args.y)) + signer_address = keystore.import_keystore_file(args.y) + logg.debug('now have key for signer address {}'.format(signer_address)) +signer = EIP155Signer(keystore) + +chain_pair = args.i.split(':') +chain_id = int(chain_pair[1]) +helper = EthTxExecutor( + w3, + signer_address, + signer, + chain_id, + block=args.ww, + ) + + +def main(): f = open(os.path.join(args.abi_dir, 'TokenUniqueSymbolIndex.json'), 'r') abi = json.load(f) f.close() @@ -51,11 +83,6 @@ def main(): t = w3.eth.contract(abi=erc20_abi, address=args.address) token_symbol = t.functions.symbol().call() - w3.eth.defaultAccount = w3.eth.accounts[0] - if args.o != None: - w3.eth.defaultAccount = args.o - logg.debug('owner address {}'.format(w3.eth.defaultAccount)) - c = w3.eth.contract(abi=abi, address=args.r) h = hashlib.new('sha256') @@ -63,8 +90,13 @@ def main(): z = h.digest() logg.info('token symbol {} => {}'.format(token_symbol, z.hex())) - tx_hash = c.functions.register('0x' + z.hex(), args.address).transact() - print(tx_hash.hex()) + (tx_hash, rcpt) = helper.sign_and_send( + [ + c.functions.register('0x' + z.hex(), args.address).buildTransaction, + ], + ) + + print(tx_hash) if __name__ == '__main__': diff --git a/python/eth_token_index/runnable/deploy.py b/python/eth_token_index/runnable/deploy.py @@ -13,7 +13,9 @@ import logging # third-party imports import web3 - +from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer +from crypto_dev_signer.keystore import DictKeystore +from crypto_dev_signer.eth.helper import EthTxExecutor logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -26,17 +28,47 @@ data_dir = os.path.join(script_dir, '..', 'data') argparser = argparse.ArgumentParser() argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)') -argparser.add_argument('-o', '--owner', dest='o', type=str, help='Accounts declarator owner') +argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string') +argparser.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed') +argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed') +argparser.add_argument('-a', '--signer-address', dest='a', type=str, help='Accounts declarator owner') +argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing') argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir)) argparser.add_argument('-v', action='store_true', help='Be verbose') +argparser.add_argument('-vv', action='store_true', help='Be more verbose') args = argparser.parse_args() -if args.v: +if args.vv: logg.setLevel(logging.DEBUG) +elif args.v: + logg.setLevel(logging.INFO) -def main(): - w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) +block_last = args.w +block_all = args.ww + +w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) + +signer_address = None +keystore = DictKeystore() +if args.y != None: + logg.debug('loading keystore file {}'.format(args.y)) + signer_address = keystore.import_keystore_file(args.y) + logg.debug('now have key for signer address {}'.format(signer_address)) +signer = EIP155Signer(keystore) + +chain_pair = args.i.split(':') +chain_id = int(chain_pair[1]) +helper = EthTxExecutor( + w3, + signer_address, + signer, + chain_id, + block=args.ww, + ) + + +def main(): f = open(os.path.join(args.abi_dir, 'TokenUniqueSymbolIndex.json'), 'r') abi = json.load(f) f.close() @@ -45,16 +77,14 @@ def main(): bytecode = f.read() f.close() - w3.eth.defaultAccount = w3.eth.accounts[0] - if args.o != None: - w3.eth.defaultAccount = args.o - logg.debug('owner address {}'.format(w3.eth.defaultAccount)) - c = w3.eth.contract(abi=abi, bytecode=bytecode) - tx_hash = c.constructor().transact() - - rcpt = w3.eth.getTransactionReceipt(tx_hash) + (tx_hash, rcpt) = helper.sign_and_send( + [ + c.constructor().buildTransaction, + ], + force_wait=True, + ) print(rcpt.contractAddress) diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = eth-address-index -version = 0.0.3 +version = 0.1.0a1 description = Signed metadata declarations for ethereum addresses author = Louis Holbrook author_email = dev@holbrook.no @@ -30,6 +30,7 @@ packages = eth_token_index.runnable install_requires = web3==5.12.2 + crypto-dev-signer~=0.4.13b2 tests_require = eth-tester==0.5.0b2 py-evm==0.3.0a20 diff --git a/solidity/AddressDeclarator.bin b/solidity/AddressDeclarator.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b5060405162001bc838038062001bc8833981810160405281019062000037919062000717565b6060336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600581908060018154018082558091505060019003906000526020600020016000909190919091509080519060200190620000b69291906200068f565b5060056001600580549050620000cd91906200083e565b8154811062000105577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001434090806001815401808255809150506001900390600052602060002001600090919091909150556200014933836200015260201b60201c565b505050620009c3565b600080606060006200016b3387620003b360201b60201c565b92506002600084815260200190815260200160002054905060008114156200030c57600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506005829080600181540180825580915050600190039060005260206000200160009091909190915090805190602001906200026a9291906200068f565b50600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60016005805490506200032091906200083e565b90508060026000858152602001908152602001600020819055506005818154811062000375577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018590806001815401808255809150506001900390600052602060002001600090919091909150556001935050505092915050565b6000806000602867ffffffffffffffff811115620003fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156200042d5781602001600182028036833780820191505090505b50905060008560405160200162000445919062000795565b604051602081830303815290604052905060005b601481101562000527578181815181106200049d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b838281518110620004e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806200051e90620008f7565b91505062000459565b50846040516020016200053b919062000795565b604051602081830303815290604052905060005b60148110156200062b5781818151811062000593577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b83601483620005ae9190620007e1565b81518110620005e6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806200062290620008f7565b9150506200054f565b506002826040516200063e9190620007b2565b602060405180830381855afa1580156200065c573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019062000681919062000717565b925082935050505092915050565b828054828255906000526020600020908101928215620006ce579160200282015b82811115620006cd578251825591602001919060010190620006b0565b5b509050620006dd9190620006e1565b5090565b5b80821115620006fc576000816000905550600101620006e2565b5090565b6000815190506200071181620009a9565b92915050565b6000602082840312156200072a57600080fd5b60006200073a8482850162000700565b91505092915050565b62000758620007528262000879565b62000945565b82525050565b60006200076b82620007cb565b620007778185620007d6565b935062000789818560208601620008c1565b80840191505092915050565b6000620007a3828462000743565b60148201915081905092915050565b6000620007c082846200075e565b915081905092915050565b600081519050919050565b600081905092915050565b6000620007ee82620008b7565b9150620007fb83620008b7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156200083357620008326200096d565b5b828201905092915050565b60006200084b82620008b7565b91506200085883620008b7565b9250828210156200086e576200086d6200096d565b5b828203905092915050565b6000620008868262000897565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015620008e1578082015181840152602081019050620008c4565b83811115620008f1576000848401525b50505050565b60006200090482620008b7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156200093a57620009396200096d565b5b600182019050919050565b6000620009528262000959565b9050919050565b600062000966826200099c565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160601b9050919050565b620009b4816200088d565b8114620009c057600080fd5b50565b6111f580620009d36000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638c661b36116100665780638c661b361461016d5780638da5cb5b1461019d578063ae47ece0146101bb578063d0e95db1146101eb578063ff7496b41461021b5761009e565b806301ffc9a7146100a357806322168e4f146100d357806350e0c6d3146101035780637d64bf1d14610133578063880ad0af14610163575b600080fd5b6100bd60048036038101906100b89190610c91565b61024b565b6040516100ca9190610eae565b60405180910390f35b6100ed60048036038101906100e89190610c2c565b610252565b6040516100fa9190610e71565b60405180910390f35b61011d60048036038101906101189190610b8b565b6102fe565b60405161012a9190610f04565b60405180910390f35b61014d60048036038101906101489190610c2c565b61034a565b60405161015a9190610e71565b60405180910390f35b61016b6103f6565b005b61018760048036038101906101829190610bb4565b610431565b6040516101949190610e8c565b60405180910390f35b6101a56104f5565b6040516101b29190610e71565b60405180910390f35b6101d560048036038101906101d09190610bf0565b610519565b6040516101e29190610eae565b60405180910390f35b61020560048036038101906102009190610b8b565b61076c565b6040516102129190610f04565b60405180910390f35b61023560048036038101906102309190610cba565b6107b8565b6040516102429190610ec9565b60405180910390f35b6000919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106102cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106103c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905092915050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042890610ee4565b60405180910390fd5b606060008061044085856107f5565b91506002600083815260200190815260200160002054905060058181548110610492577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018054806020026020016040519081016040528092919081815260200182805480156104e657602002820191906000526020600020905b8154815260200190600101908083116104d2575b50505050509250505092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806060600061052a33876107f5565b92506002600084815260200190815260200160002054905060008114156106c857600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600582908060018154018082558091505060019003906000526020600020016000909190919091509080519060200190610626929190610ab8565b50600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60016005805490506106da9190610fd5565b90508060026000858152602001908152602001600020819055506005818154811061072e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018590806001815401808255809150506001900390600052602060002001600090919091909150556001935050505092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b600582815481106107c857600080fd5b9060005260206000200181815481106107e057600080fd5b90600052602060002001600091509150505481565b6000806000602867ffffffffffffffff81111561083b577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561086d5781602001600182028036833780820191505090505b5090506000856040516020016108839190610e3f565b604051602081830303815290604052905060005b601481101561095f578181815181106108d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b83828151811061091d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610957906110ba565b915050610897565b50846040516020016109719190610e3f565b604051602081830303815290604052905060005b6014811015610a59578181815181106109c7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b836014836109e09190610f7f565b81518110610a17577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610a51906110ba565b915050610985565b50600282604051610a6a9190610e5a565b602060405180830381855afa158015610a87573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610aaa9190610c68565b925082935050505092915050565b828054828255906000526020600020908101928215610af4579160200282015b82811115610af3578251825591602001919060010190610ad8565b5b509050610b019190610b05565b5090565b5b80821115610b1e576000816000905550600101610b06565b5090565b600081359050610b3181611163565b92915050565b600081359050610b468161117a565b92915050565b600081519050610b5b8161117a565b92915050565b600081359050610b7081611191565b92915050565b600081359050610b85816111a8565b92915050565b600060208284031215610b9d57600080fd5b6000610bab84828501610b22565b91505092915050565b60008060408385031215610bc757600080fd5b6000610bd585828601610b22565b9250506020610be685828601610b22565b9150509250929050565b60008060408385031215610c0357600080fd5b6000610c1185828601610b22565b9250506020610c2285828601610b37565b9150509250929050565b60008060408385031215610c3f57600080fd5b6000610c4d85828601610b22565b9250506020610c5e85828601610b76565b9150509250929050565b600060208284031215610c7a57600080fd5b6000610c8884828501610b4c565b91505092915050565b600060208284031215610ca357600080fd5b6000610cb184828501610b61565b91505092915050565b60008060408385031215610ccd57600080fd5b6000610cdb85828601610b76565b9250506020610cec85828601610b76565b9150509250929050565b6000610d028383610da1565b60208301905092915050565b610d1781611009565b82525050565b610d2e610d2982611009565b611103565b82525050565b6000610d3f82610f2f565b610d498185610f52565b9350610d5483610f1f565b8060005b83811015610d85578151610d6c8882610cf6565b9750610d7783610f45565b925050600181019050610d58565b5085935050505092915050565b610d9b8161101b565b82525050565b610daa81611027565b82525050565b610db981611027565b82525050565b6000610dca82610f3a565b610dd48185610f63565b9350610de4818560208601611087565b80840191505092915050565b6000610dfd601783610f6e565b91507f6f776e65722063616e6e6f74206265206368616e6765640000000000000000006000830152602082019050919050565b610e398161107d565b82525050565b6000610e4b8284610d1d565b60148201915081905092915050565b6000610e668284610dbf565b915081905092915050565b6000602082019050610e866000830184610d0e565b92915050565b60006020820190508181036000830152610ea68184610d34565b905092915050565b6000602082019050610ec36000830184610d92565b92915050565b6000602082019050610ede6000830184610db0565b92915050565b60006020820190508181036000830152610efd81610df0565b9050919050565b6000602082019050610f196000830184610e30565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b6000610f8a8261107d565b9150610f958361107d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fca57610fc9611127565b5b828201905092915050565b6000610fe08261107d565b9150610feb8361107d565b925082821015610ffe57610ffd611127565b5b828203905092915050565b60006110148261105d565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b838110156110a557808201518184015260208101905061108a565b838111156110b4576000848401525b50505050565b60006110c58261107d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156110f8576110f7611127565b5b600182019050919050565b600061110e82611115565b9050919050565b600061112082611156565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160601b9050919050565b61116c81611009565b811461117757600080fd5b50565b61118381611027565b811461118e57600080fd5b50565b61119a81611031565b81146111a557600080fd5b50565b6111b18161107d565b81146111bc57600080fd5b5056fea26469706673582212204460994967d4a16fb30d1f457d533e6929ca94e119064c8d4865ff61ed18590864736f6c63430008000033 -\ No newline at end of file +60806040523480156200001157600080fd5b506040516200140e3803806200140e833981810160405260208110156200003757600080fd5b81019080805190602001909291905050506060336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600581908060018154018082558091505060019003906000526020600020016000909190919091509080519060200190620000c79291906200065c565b50600560016005805490500381548110620000de57fe5b90600052602060002001434090806001815401808255809150506001900390600052602060002001600090919091909150556200012b338362000134640100000000026401000000009004565b505050620006cd565b6000806060600062000156338762000366640100000000026401000000009004565b9250600260008481526020019081526020016000205490506000811415620002f757600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600582908060018154018082558091505060019003906000526020600020016000909190919091509080519060200190620002559291906200065c565b50600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6001600580549050039050806002600085815260200190815260200160002081905550600581815481106200032857fe5b906000526020600020018590806001815401808255809150506001900390600052602060002001600090919091909150556001935050505092915050565b6000806060602867ffffffffffffffff811180156200038457600080fd5b506040519080825280601f01601f191660200182016040528015620003b85781602001600182028036833780820191505090505b509050606085604051602001808273ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401915050604051602081830303815290604052905060005b6014811015620004b2578181815181106200041e57fe5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028382815181106200047557fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808060010191505062000407565b5084604051602001808273ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401915050604051602081830303815290604052905060005b6014811015620005ab578181815181106200051457fe5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028360148301815181106200056e57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050620004fd565b506002826040518082805190602001908083835b60208310620005e45780518252602082019150602081019050602083039250620005bf565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa15801562000627573d6000803e3d6000fd5b5050506040513d60208110156200063d57600080fd5b8101908080519060200190929190505050925082935050505092915050565b8280548282559060005260206000209081019282156200069b579160200282015b828111156200069a5782518255916020019190600101906200067d565b5b509050620006aa9190620006ae565b5090565b5b80821115620006c9576000816000905550600101620006af565b5090565b610d3180620006dd6000396000f3fe608060405234801561001057600080fd5b50600436106100bb576000357c0100000000000000000000000000000000000000000000000000000000900480638c661b36116100835780638c661b36146102755780638da5cb5b1461032e578063ae47ece014610362578063d0e95db1146103c6578063ff7496b41461041e576100bb565b806301ffc9a7146100c057806322168e4f1461012357806350e0c6d31461019b5780637d64bf1d146101f3578063880ad0af1461026b575b600080fd5b61010b600480360360208110156100d657600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916906020019092919050505061046a565b60405180821515815260200191505060405180910390f35b61016f6004803603604081101561013957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610471565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101dd600480360360208110156101b157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104f0565b6040518082815260200191505060405180910390f35b61023f6004803603604081101561020957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061053c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102736105bb565b005b6102d76004803603604081101561028b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610629565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561031a5780820151818401526020810190506102ff565b505050509050019250505060405180910390f35b6103366106c0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103ae6004803603604081101561037857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e4565b60405180821515815260200191505060405180910390f35b610408600480360360208110156103dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610901565b6040518082815260200191505060405180910390f35b6104546004803603604081101561043457600080fd5b81019080803590602001909291908035906020019092919050505061094d565b6040518082815260200191505060405180910390f35b6000919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106104bd57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061058857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905092915050565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f6f776e65722063616e6e6f74206265206368616e67656400000000000000000081525060200191505060405180910390fd5b60606000806106388585610984565b9150600260008381526020019081526020016000205490506005818154811061065d57fe5b906000526020600020018054806020026020016040519081016040528092919081815260200182805480156106b157602002820191906000526020600020905b81548152602001906001019080831161069d575b50505050509250505092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080606060006106f53387610984565b925060026000848152602001908152602001600020549050600081141561089357600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506005829080600181540180825580915050600190039060005260206000200160009091909190915090805190602001906107f1929190610c6c565b50600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6001600580549050039050806002600085815260200190815260200160002081905550600581815481106108c357fe5b906000526020600020018590806001815401808255809150506001900390600052602060002001600090919091909150556001935050505092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b6005828154811061095a57fe5b90600052602060002001818154811061096f57fe5b90600052602060002001600091509150505481565b6000806060602867ffffffffffffffff811180156109a157600080fd5b506040519080825280601f01601f1916602001820160405280156109d45781602001600182028036833780820191505090505b509050606085604051602001808273ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401915050604051602081830303815290604052905060005b6014811015610aca57818181518110610a3857fe5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002838281518110610a8e57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050610a23565b5084604051602001808273ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401915050604051602081830303815290604052905060005b6014811015610bbf57818181518110610b2a57fe5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002836014830181518110610b8357fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050610b15565b506002826040518082805190602001908083835b60208310610bf65780518252602082019150602081019050602083039250610bd3565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015610c38573d6000803e3d6000fd5b5050506040513d6020811015610c4d57600080fd5b8101908080519060200190929190505050925082935050505092915050565b828054828255906000526020600020908101928215610ca8579160200282015b82811115610ca7578251825591602001919060010190610c8c565b5b509050610cb59190610cb9565b5090565b5b80821115610cd2576000816000905550600101610cba565b509056fea2646970667358221220d514108546e5c7028cd46823f97fbc7c70211eef191d14f42af773f7b6f2e8d464736f6c637827302e362e31322d646576656c6f702e323032312e312e382b636f6d6d69742e32376435313736350058 +\ No newline at end of file diff --git a/solidity/AddressDeclarator.sol b/solidity/AddressDeclarator.sol @@ -1,4 +1,4 @@ -pragma solidity >=0.6.12; +pragma solidity >0.6.11; // SPDX-License-Identifier: GPL-3.0-or-later @@ -13,7 +13,7 @@ contract AddressDeclarator { mapping( address => address[] ) declaratorReverse; bytes32[][] public contents; - constructor(bytes32 _initialDescription) { + constructor(bytes32 _initialDescription) public { bytes32[] memory foundation; owner = msg.sender; diff --git a/solidity/Makefile b/solidity/Makefile @@ -1,19 +1,19 @@ +SOLC = /usr/bin/solc + all: - solc AddressDeclarator.sol --abi | awk 'NR>3' > AddressDeclarator.json - solc AddressDeclarator.sol --bin | awk 'NR>3' > AddressDeclarator.bin + $(SOLC) AddressDeclarator.sol --abi --evm-version byzantium | awk 'NR>3' > AddressDeclarator.json + $(SOLC) AddressDeclarator.sol --bin --evm-version byzantium | awk 'NR>3' > AddressDeclarator.bin truncate -s -1 AddressDeclarator.bin - solc TokenUniqueSymbolIndex.sol --abi | awk 'NR>3' > TokenUniqueSymbolIndex.json - solc TokenUniqueSymbolIndex.sol --bin | awk 'NR>3' > TokenUniqueSymbolIndex.bin + $(SOLC) TokenUniqueSymbolIndex.sol --abi --evm-version byzantium | awk 'NR>3' > TokenUniqueSymbolIndex.json + $(SOLC) TokenUniqueSymbolIndex.sol --bin --evm-version byzantium | awk 'NR>3' > TokenUniqueSymbolIndex.bin truncate -s -1 TokenUniqueSymbolIndex.bin - -old: - solc TokenEndorser.sol --abi | awk 'NR>3' > TokenEndorser.json - solc TokenEndorser.sol --bin | awk 'NR>3' > TokenEndorser.bin - truncate -s -1 TokenEndorser.bin - test: all #python test.py python test_tokenindex.py + +install: all + cp -v AddressDeclarator.{json,bin} ../python/eth_address_declarator/data/ + cp -v TokenUniqueSymbolIndex.{json,bin} ../python/eth_token_index/data/ -.PHONY: test +.PHONY: test install diff --git a/solidity/TokenEndorser.bin b/solidity/TokenEndorser.bin @@ -1 +0,0 @@ -608060405234801561001057600080fd5b506001600081905550600660009080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506111398061008c6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063427f91a61161005b578063427f91a6146101125780634f64b2be146101425780639367d97514610172578063e6088e83146101a25761007d565b80630f1244d3146100825780632d580ef6146100b25780633fac3587146100e2575b600080fd5b61009c60048036038101906100979190610c5a565b6101d2565b6040516100a99190610e03565b60405180910390f35b6100cc60048036038101906100c79190610b90565b61021b565b6040516100d99190610e1e565b60405180910390f35b6100fc60048036038101906100f79190610bcc565b610685565b6040516101099190610e54565b60405180910390f35b61012c60048036038101906101279190610b67565b6106b6565b6040516101399190610e54565b60405180910390f35b61015c60048036038101906101579190610cdc565b6106ce565b6040516101699190610e03565b60405180910390f35b61018c60048036038101906101879190610b67565b61070d565b6040516101999190610e54565b60405180910390f35b6101bc60048036038101906101b79190610c08565b610725565b6040516101c99190610e39565b60405180910390f35b6005818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006102268361073d565b50600080602867ffffffffffffffff81111561026b577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561029d5781602001600182028036833780820191505090505b5090506000856040516020016102b39190610dba565b604051602081830303815290604052905060005b601481101561038f57818181518110610309577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b83828151811061034d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808061038790610fe6565b9150506102c7565b50336040516020016103a19190610dba565b604051602081830303815290604052905060005b6014811015610489578181815181106103f7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b836014836104109190610efc565b81518110610447577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808061048190610fe6565b9150506103b5565b5060028260405161049a9190610dd5565b602060405180830381855afa1580156104b7573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906104da9190610c31565b92506000801b6001600085815260200190815260200160002054146104fe57600080fd5b846001600085815260200190815260200160002081905550600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549080600181540180825580915050600190039060005260206000200160009091909190915055600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061060b90610fe6565b91905055506000543373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fb8a4220b7c147fc6e04861db14024976c551727749a09806414670fac57e5340886040516106709190610e39565b60405180910390a46001935050505092915050565b600360205281600052604060002081815481106106a157600080fd5b90600052602060002001600091509150505481565b60026020528060005260406000206000915090505481565b600681815481106106de57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60046020528060005260406000206000915090505481565b60016020528060005260406000206000915090505481565b600080600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561078f5760009050610a3e565b6000808373ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f95d89b41000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516108399190610dd5565b6000604051808303816000865af19150503d8060008114610876576040519150601f19603f3d011682016040523d82523d6000602084013e61087b565b606091505b50915091508161088a57600080fd5b6000818060200190518101906108a09190610c9b565b9050600073ffffffffffffffffffffffffffffffffffffffff166005826040516108ca9190610dec565b908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461091957600080fd5b6006859080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600054600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550846005826040516109d39190610dec565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600080815480929190610a3190610fe6565b9190505550600193505050505b919050565b6000610a56610a5184610ea0565b610e6f565b905082815260208101848484011115610a6e57600080fd5b610a79848285610fa4565b509392505050565b6000610a94610a8f84610ea0565b610e6f565b905082815260208101848484011115610aac57600080fd5b610ab7848285610fb3565b509392505050565b600081359050610ace816110be565b92915050565b600081359050610ae3816110d5565b92915050565b600081519050610af8816110d5565b92915050565b600082601f830112610b0f57600080fd5b8135610b1f848260208601610a43565b91505092915050565b600082601f830112610b3957600080fd5b8151610b49848260208601610a81565b91505092915050565b600081359050610b61816110ec565b92915050565b600060208284031215610b7957600080fd5b6000610b8784828501610abf565b91505092915050565b60008060408385031215610ba357600080fd5b6000610bb185828601610abf565b9250506020610bc285828601610ad4565b9150509250929050565b60008060408385031215610bdf57600080fd5b6000610bed85828601610abf565b9250506020610bfe85828601610b52565b9150509250929050565b600060208284031215610c1a57600080fd5b6000610c2884828501610ad4565b91505092915050565b600060208284031215610c4357600080fd5b6000610c5184828501610ae9565b91505092915050565b600060208284031215610c6c57600080fd5b600082013567ffffffffffffffff811115610c8657600080fd5b610c9284828501610afe565b91505092915050565b600060208284031215610cad57600080fd5b600082015167ffffffffffffffff811115610cc757600080fd5b610cd384828501610b28565b91505092915050565b600060208284031215610cee57600080fd5b6000610cfc84828501610b52565b91505092915050565b610d0e81610f52565b82525050565b610d25610d2082610f52565b61102f565b82525050565b610d3481610f64565b82525050565b610d4381610f70565b82525050565b6000610d5482610ed0565b610d5e8185610ee6565b9350610d6e818560208601610fb3565b80840191505092915050565b6000610d8582610edb565b610d8f8185610ef1565b9350610d9f818560208601610fb3565b80840191505092915050565b610db481610f9a565b82525050565b6000610dc68284610d14565b60148201915081905092915050565b6000610de18284610d49565b915081905092915050565b6000610df88284610d7a565b915081905092915050565b6000602082019050610e186000830184610d05565b92915050565b6000602082019050610e336000830184610d2b565b92915050565b6000602082019050610e4e6000830184610d3a565b92915050565b6000602082019050610e696000830184610dab565b92915050565b6000604051905081810181811067ffffffffffffffff82111715610e9657610e95611082565b5b8060405250919050565b600067ffffffffffffffff821115610ebb57610eba611082565b5b601f19601f8301169050602081019050919050565b600081519050919050565b600081519050919050565b600081905092915050565b600081905092915050565b6000610f0782610f9a565b9150610f1283610f9a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610f4757610f46611053565b5b828201905092915050565b6000610f5d82610f7a565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610fd1578082015181840152602081019050610fb6565b83811115610fe0576000848401525b50505050565b6000610ff182610f9a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561102457611023611053565b5b600182019050919050565b600061103a82611041565b9050919050565b600061104c826110b1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008160601b9050919050565b6110c781610f52565b81146110d257600080fd5b50565b6110de81610f70565b81146110e957600080fd5b50565b6110f581610f9a565b811461110057600080fd5b5056fea2646970667358221220b8f2c7741375a75c920a4152b00634fd6b771f728ba3117ab25bf6d17dc721f764736f6c63430008000033 -\ No newline at end of file diff --git a/solidity/TokenEndorser.json b/solidity/TokenEndorser.json @@ -1 +0,0 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":true,"internalType":"address","name":"_adder","type":"address"},{"indexed":true,"internalType":"uint256","name":"_index","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"EndorsementAdded","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"endorsement","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"endorser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"endorserTokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"tokenSymbolIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] diff --git a/solidity/TokenEndorser.sol b/solidity/TokenEndorser.sol @@ -1,59 +0,0 @@ -pragma solidity >=0.6.12; - -// SPDX-License-Identifier: GPL-3.0-or-later - -contract TokenEndorsement { - - uint256 count; - mapping ( bytes32 => bytes32 ) public endorsement; - mapping ( address => uint256 ) public tokenIndex; - mapping ( address => uint256[] ) public endorser; - mapping ( address => uint256 ) public endorserTokenCount; - mapping ( string => address ) public tokenSymbolIndex; - address[] public tokens; - - event EndorsementAdded(address indexed _token, address indexed _adder, uint256 indexed _index, bytes32 _data); - - constructor() { - count = 1; - tokens.push(address(0x0)); - } - - function register(address _token) private returns (bool) { - if (tokenIndex[_token] > 0) { - return false; - } - (bool _ok, bytes memory _r) = _token.call(abi.encodeWithSignature('symbol()')); - require(_ok); - - string memory token_symbol = abi.decode(_r, (string)); - require(tokenSymbolIndex[token_symbol] == address(0)); - - tokens.push(_token); - tokenIndex[_token] = count; - tokenSymbolIndex[token_symbol] = _token; - count++; - return true; - } - - function add(address _token, bytes32 _data) public returns (bool) { - register(_token); - bytes32 k; - bytes memory signMaterial = new bytes(40); - bytes memory addrBytes = abi.encodePacked(_token); - for (uint256 i = 0; i < 20; i++) { - signMaterial[i] = addrBytes[i]; - } - addrBytes = abi.encodePacked(msg.sender); - for (uint256 i = 0; i < 20; i++) { - signMaterial[i+20] = addrBytes[i]; - } - k = sha256(signMaterial); - require(endorsement[k] == bytes32(0x00)); - endorsement[k] = _data; - endorser[msg.sender].push(tokenIndex[_token]); - endorserTokenCount[msg.sender]++; - emit EndorsementAdded(_token, msg.sender, count, _data); - return true; - } -} diff --git a/solidity/TokenUniqueSymbolIndex.bin b/solidity/TokenUniqueSymbolIndex.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c57806100c46000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063bb34534c1161005b578063bb34534c14610115578063cbb8343414610145578063d22057a914610163578063e2095c071461019357610088565b806301ffc9a71461008d5780637ef50298146100bd578063880ad0af146100ed5780638da5cb5b146100f7575b600080fd5b6100a760048036038101906100a291906107eb565b6101c3565b6040516100b4919061094e565b60405180910390f35b6100d760048036038101906100d2919061075d565b61027b565b6040516100e49190610989565b60405180910390f35b6100f5610293565b005b6100ff6102ce565b60405161010c9190610933565b60405180910390f35b61012f600480360381019061012a919061075d565b6102f2565b60405161013c9190610933565b60405180910390f35b61014d610378565b60405161015a9190610989565b60405180910390f35b61017d600480360381019061017891906107af565b610391565b60405161018a919061094e565b60405180910390f35b6101ad60048036038101906101a89190610855565b610612565b6040516101ba9190610933565b60405180910390f35b600063325d15e260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561021b5760019050610276565b6301ffc9a760e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156102715760019050610276565b600090505b919050565b60016020528060005260406000206000915090505481565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c590610969565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806001600084815260200190815260200160002054905060028181548110610345577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915050919050565b6000600160028054905061038c9190610a82565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103ec57600080fd5b60606000806000808673ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f95d89b41000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161049b919061091c565b6000604051808303816000865af19150503d80600081146104d8576040519150601f19603f3d011682016040523d82523d6000602084013e6104dd565b606091505b5091509150816104ec57600080fd5b808060200190518101906105009190610814565b9450600285604051610512919061091c565b602060405180830381855afa15801561052f573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906105529190610786565b935083881461056057600080fd5b600160008581526020019081526020016000205492506000831461058357600080fd5b60028054905060016000868152602001908152602001600020819055506002879080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019550505050505092915050565b600060026001836106239190610a2c565b8154811061065a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061069f61069a846109d5565b6109a4565b9050828152602081018484840111156106b757600080fd5b6106c2848285610b34565b509392505050565b6000813590506106d981610bc5565b92915050565b6000813590506106ee81610bdc565b92915050565b60008151905061070381610bdc565b92915050565b60008135905061071881610bf3565b92915050565b600082601f83011261072f57600080fd5b815161073f84826020860161068c565b91505092915050565b60008135905061075781610c0a565b92915050565b60006020828403121561076f57600080fd5b600061077d848285016106df565b91505092915050565b60006020828403121561079857600080fd5b60006107a6848285016106f4565b91505092915050565b600080604083850312156107c257600080fd5b60006107d0858286016106df565b92505060206107e1858286016106ca565b9150509250929050565b6000602082840312156107fd57600080fd5b600061080b84828501610709565b91505092915050565b60006020828403121561082657600080fd5b600082015167ffffffffffffffff81111561084057600080fd5b61084c8482850161071e565b91505092915050565b60006020828403121561086757600080fd5b600061087584828501610748565b91505092915050565b61088781610ab6565b82525050565b61089681610ac8565b82525050565b60006108a782610a05565b6108b18185610a10565b93506108c1818560208601610b34565b80840191505092915050565b60006108da601783610a1b565b91507f6f776e65722063616e6e6f74206265206368616e6765640000000000000000006000830152602082019050919050565b61091681610b2a565b82525050565b6000610928828461089c565b915081905092915050565b6000602082019050610948600083018461087e565b92915050565b6000602082019050610963600083018461088d565b92915050565b60006020820190508181036000830152610982816108cd565b9050919050565b600060208201905061099e600083018461090d565b92915050565b6000604051905081810181811067ffffffffffffffff821117156109cb576109ca610b96565b5b8060405250919050565b600067ffffffffffffffff8211156109f0576109ef610b96565b5b601f19601f8301169050602081019050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610a3782610b2a565b9150610a4283610b2a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610a7757610a76610b67565b5b828201905092915050565b6000610a8d82610b2a565b9150610a9883610b2a565b925082821015610aab57610aaa610b67565b5b828203905092915050565b6000610ac182610b0a565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015610b52578082015181840152602081019050610b37565b83811115610b61576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610bce81610ab6565b8114610bd957600080fd5b50565b610be581610ad4565b8114610bf057600080fd5b50565b610bfc81610ade565b8114610c0757600080fd5b50565b610c1381610b2a565b8114610c1e57600080fd5b5056fea2646970667358221220ddfe90639c05ff4cfde92247820a70440251493847b735f6c9e4493db9f5fe6764736f6c63430008000033 -\ No newline at end of file +608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610938806100c46000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063bb34534c11610078578063bb34534c1461018d578063cbb83434146101e5578063d22057a914610203578063e2095c0714610267576100a5565b806301ffc9a7146100aa5780637ef502981461010d578063880ad0af1461014f5780638da5cb5b14610159575b600080fd5b6100f5600480360360208110156100c057600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690602001909291905050506102bf565b60405180821515815260200191505060405180910390f35b6101396004803603602081101561012357600080fd5b81019080803590602001909291905050506103af565b6040518082815260200191505060405180910390f35b6101576103c7565b005b610161610435565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101b9600480360360208110156101a357600080fd5b8101908080359060200190929190505050610459565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101ed6104b2565b6040518082815260200191505060405180910390f35b61024f6004803603604081101561021957600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104c2565b60405180821515815260200191505060405180910390f35b6102936004803603602081101561027d57600080fd5b8101908080359060200190929190505050610899565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600063325d15e27c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561033357600190506103aa565b6301ffc9a77c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156103a557600190506103aa565b600090505b919050565b60016020528060005260406000206000915090505481565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f6f776e65722063616e6e6f74206265206368616e67656400000000000000000081525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600160008481526020019081526020016000205490506002818154811061047f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915050919050565b6000600160028054905003905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461051d57600080fd5b6060600080600060608673ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f95d89b41000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518082805190602001908083835b602083106105f357805182526020820191506020810190506020830392506105d0565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610655576040519150601f19603f3d011682016040523d82523d6000602084013e61065a565b606091505b50915091508161066957600080fd5b80806020019051602081101561067e57600080fd5b810190808051604051939291908464010000000082111561069e57600080fd5b838201915060208201858111156106b457600080fd5b82518660018202830111640100000000821117156106d157600080fd5b8083526020830192505050908051906020019080838360005b838110156107055780820151818401526020810190506106ea565b50505050905090810190601f1680156107325780820380516001836020036101000a031916815260200191505b5060405250505094506002856040518082805190602001908083835b60208310610771578051825260208201915060208101905060208303925061074e565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa1580156107b3573d6000803e3d6000fd5b5050506040513d60208110156107c857600080fd5b810190808051906020019092919050505093508388146107e757600080fd5b600160008581526020019081526020016000205492506000831461080a57600080fd5b60028054905060016000868152602001908152602001600020819055506002879080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019550505050505092915050565b6000600260018301815481106108ab57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905091905056fea2646970667358221220ce760022fc7bb7f92ad2fd58865b52c3c6f9908d39e825564e6ea958b598504964736f6c637827302e362e31322d646576656c6f702e323032312e312e382b636f6d6d69742e32376435313736350058 +\ No newline at end of file diff --git a/solidity/TokenUniqueSymbolIndex.sol b/solidity/TokenUniqueSymbolIndex.sol @@ -1,4 +1,4 @@ -pragma solidity >=0.6.12; +pragma solidity >0.6.11; // SPDX-License-Identifier: GPL-3.0-or-later @@ -10,7 +10,7 @@ contract TokenUniqueSymbolIndex { mapping ( bytes32 => uint256 ) public registry; address[] tokens; - constructor() { + constructor() public { owner = msg.sender; tokens.push(address(0)); }