{"id":21347144,"url":"https://github.com/kybernetwork/erc20-contract-classification","last_synced_at":"2025-03-16T03:44:37.045Z","repository":{"id":195698612,"uuid":"693470035","full_name":"KyberNetwork/ERC20-contract-classification","owner":"KyberNetwork","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-28T08:15:51.000Z","size":19571,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T16:31:13.993Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KyberNetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-19T05:09:33.000Z","updated_at":"2023-09-19T05:10:52.000Z","dependencies_parsed_at":"2024-11-22T02:23:04.546Z","dependency_job_id":null,"html_url":"https://github.com/KyberNetwork/ERC20-contract-classification","commit_stats":null,"previous_names":["kybernetwork/erc20-contract-classification"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyberNetwork%2FERC20-contract-classification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyberNetwork%2FERC20-contract-classification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyberNetwork%2FERC20-contract-classification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyberNetwork%2FERC20-contract-classification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KyberNetwork","download_url":"https://codeload.github.com/KyberNetwork/ERC20-contract-classification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243822277,"owners_count":20353499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T02:12:49.806Z","updated_at":"2025-03-16T03:44:37.022Z","avatar_url":"https://github.com/KyberNetwork.png","language":"Go","readme":"# ERC20-contract-classification\n\nThe ERC20 Contract Classification library is a Go package that provides a simple interface for classifying Ethereum ERC20 contracts. It allows users to determine whether a given contract is a fee-on-transfer contract and obtain information about the fee-on-transfer formula. Additionally, it provides a method to check if a contract is a standard ERC20 contract.\n\n## Installation\nTo use this library in your Go project, you can simply install it using the following go get command:\n\n```bash\ngo get github.com/KyberNetwork/erc20-contract-classification\n```\n\n## Usage\nImport the library in your Go code:\n\n```go\nimport \"github.com/your-username/ERC20-contract-classification\"\n```\n\nInitialize the classifier: for now the classifer we're going to use is EventFilter (https://www.notion.so/kybernetwork/Transfer-event-based-heuristic-approach-40bcf7e9fa55404884984395267d5263). \n\n```go\n\t// numTx is the minimum number of Tx to get before classification. Higher numTx will take longer to run but will result in a finer result \n\t// regressR2 is the threshold R2 in regression of which the contract is recognized as fot. Default is 0.9\n\tc := NewEventFiterClassifier(rpcClient, numTx, regressR2)\n```\n\nExample: Check if a Contract is Fee-On-Transfer\n\n```go\nercContract := common.HexToAddress(\"0x123456789abcdef123456789abcdef123456789a\")\n\n//if logs == nil, the program will automatically fetch required log\nresult, err := classifier.IsFeeOnTransfer(ercContract, logs)\nif err != nil {\n    log.Fatal(err)\n}\n\nfmt.Printf(\"Is Fee-On-Transfer: %t\\n\", result.IsFeeOnTransfer)\nif result.IsFeeOnTransfer {\n    fmt.Printf(\"Fee Formula: %s\\n\", result.FeeFormula)\n}\n```\n\nExample: Check if a Contract is ERC20\n```go\nercContract := common.HexToAddress(\"0x123456789abcdef123456789abcdef123456789a\")\n\n\n//if codes == nil, the program will automatically fetch required codes\nisERC20 := classifier.IsErc20(ercContract, codes)\nfmt.Printf(\"Is ERC20: %t\\n\", isERC20)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkybernetwork%2Ferc20-contract-classification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkybernetwork%2Ferc20-contract-classification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkybernetwork%2Ferc20-contract-classification/lists"}