├── .gitignore ├── Gopkg.lock ├── Gopkg.toml ├── TronToken.sol ├── docker-compose.yml ├── docker └── go │ └── Dockerfile ├── main.go └── token.go /.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | -------------------------------------------------------------------------------- /Gopkg.lock: -------------------------------------------------------------------------------- 1 | # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. 2 | 3 | 4 | [[projects]] 5 | branch = "master" 6 | name = "github.com/aristanetworks/goarista" 7 | packages = ["monotime"] 8 | revision = "c294d07ad966d5db9cedf32a67c62837a46e9d90" 9 | 10 | [[projects]] 11 | branch = "master" 12 | name = "github.com/btcsuite/btcd" 13 | packages = ["btcec"] 14 | revision = "50de9da05b50eb15658bb350f6ea24368a111ab7" 15 | 16 | [[projects]] 17 | name = "github.com/ethereum/go-ethereum" 18 | packages = [".","accounts","accounts/abi","accounts/abi/bind","accounts/keystore","common","common/hexutil","common/math","common/mclock","core/types","crypto","crypto/randentropy","crypto/secp256k1","crypto/sha3","ethclient","event","log","params","rlp","rpc","trie"] 19 | revision = "4bb3c89d44e372e6a9ab85a8be0c9345265c763a" 20 | version = "v1.7.3" 21 | 22 | [[projects]] 23 | name = "github.com/go-stack/stack" 24 | packages = ["."] 25 | revision = "259ab82a6cad3992b4e21ff5cac294ccb06474bc" 26 | version = "v1.7.0" 27 | 28 | [[projects]] 29 | name = "github.com/pborman/uuid" 30 | packages = ["."] 31 | revision = "e790cca94e6cc75c7064b1332e63811d4aae1a53" 32 | version = "v1.1" 33 | 34 | [[projects]] 35 | branch = "master" 36 | name = "github.com/rcrowley/go-metrics" 37 | packages = ["."] 38 | revision = "8732c616f52954686704c8645fe1a9d59e9df7c1" 39 | 40 | [[projects]] 41 | branch = "master" 42 | name = "github.com/rjeczalik/notify" 43 | packages = ["."] 44 | revision = "c31e5f2cb22b3e4ef3f882f413847669bf2652b9" 45 | 46 | [[projects]] 47 | name = "github.com/rs/cors" 48 | packages = ["."] 49 | revision = "7af7a1e09ba336d2ea14b1ce73bf693c6837dbf6" 50 | version = "v1.2" 51 | 52 | [[projects]] 53 | branch = "master" 54 | name = "golang.org/x/crypto" 55 | packages = ["pbkdf2","scrypt"] 56 | revision = "5119cf507ed5294cc409c092980c7497ee5d6fd2" 57 | 58 | [[projects]] 59 | branch = "master" 60 | name = "golang.org/x/net" 61 | packages = ["websocket"] 62 | revision = "f5dfe339be1d06f81b22525fe34671ee7d2c8904" 63 | 64 | [[projects]] 65 | branch = "master" 66 | name = "golang.org/x/sys" 67 | packages = ["unix"] 68 | revision = "37707fdb30a5b38865cfb95e5aab41707daec7fd" 69 | 70 | [[projects]] 71 | branch = "master" 72 | name = "golang.org/x/tools" 73 | packages = ["go/ast/astutil","imports"] 74 | revision = "66487607e2081c7c2af2281c62c14ee000d5024b" 75 | 76 | [[projects]] 77 | name = "gopkg.in/fatih/set.v0" 78 | packages = ["."] 79 | revision = "57907de300222151a123d29255ed17f5ed43fad3" 80 | version = "v0.1.0" 81 | 82 | [[projects]] 83 | branch = "v2" 84 | name = "gopkg.in/karalabe/cookiejar.v2" 85 | packages = ["collections/prque"] 86 | revision = "8dcd6a7f4951f6ff3ee9cbb919a06d8925822e57" 87 | 88 | [[projects]] 89 | branch = "v2" 90 | name = "gopkg.in/natefinch/npipe.v2" 91 | packages = ["."] 92 | revision = "c1b8fa8bdccecb0b8db834ee0b92fdbcfa606dd6" 93 | 94 | [solve-meta] 95 | analyzer-name = "dep" 96 | analyzer-version = 1 97 | inputs-digest = "b642ff489fb87e5fed23568d5e9125f4dad05c2e515de2c953f9d68e3c61d006" 98 | solver-name = "gps-cdcl" 99 | solver-version = 1 100 | -------------------------------------------------------------------------------- /Gopkg.toml: -------------------------------------------------------------------------------- 1 | 2 | # Gopkg.toml example 3 | # 4 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md 5 | # for detailed Gopkg.toml documentation. 6 | # 7 | # required = ["github.com/user/thing/cmd/thing"] 8 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 9 | # 10 | # [[constraint]] 11 | # name = "github.com/user/project" 12 | # version = "1.0.0" 13 | # 14 | # [[constraint]] 15 | # name = "github.com/user/project2" 16 | # branch = "dev" 17 | # source = "github.com/myfork/project2" 18 | # 19 | # [[override]] 20 | # name = "github.com/x/y" 21 | # version = "2.4.0" 22 | 23 | 24 | [[constraint]] 25 | name = "github.com/ethereum/go-ethereum" 26 | version = "1.7.3" 27 | -------------------------------------------------------------------------------- /TronToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.11; 2 | 3 | contract TronToken { 4 | 5 | string public name = "Tronix"; // token name 6 | string public symbol = "TRX"; // token symbol 7 | uint256 public decimals = 6; // token digit 8 | 9 | mapping (address => uint256) public balanceOf; 10 | mapping (address => mapping (address => uint256)) public allowance; 11 | 12 | uint256 public totalSupply = 0; 13 | bool public stopped = false; 14 | 15 | uint256 constant valueFounder = 100000000000000000; 16 | address owner = 0x0; 17 | 18 | modifier isOwner { 19 | assert(owner == msg.sender); 20 | _; 21 | } 22 | 23 | modifier isRunning { 24 | assert (!stopped); 25 | _; 26 | } 27 | 28 | modifier validAddress { 29 | assert(0x0 != msg.sender); 30 | _; 31 | } 32 | 33 | function TronToken(address _addressFounder) { 34 | owner = msg.sender; 35 | totalSupply = valueFounder; 36 | balanceOf[_addressFounder] = valueFounder; 37 | Transfer(0x0, _addressFounder, valueFounder); 38 | } 39 | 40 | function transfer(address _to, uint256 _value) isRunning validAddress returns (bool success) { 41 | require(balanceOf[msg.sender] >= _value); 42 | require(balanceOf[_to] + _value >= balanceOf[_to]); 43 | balanceOf[msg.sender] -= _value; 44 | balanceOf[_to] += _value; 45 | Transfer(msg.sender, _to, _value); 46 | return true; 47 | } 48 | 49 | function transferFrom(address _from, address _to, uint256 _value) isRunning validAddress returns (bool success) { 50 | require(balanceOf[_from] >= _value); 51 | require(balanceOf[_to] + _value >= balanceOf[_to]); 52 | require(allowance[_from][msg.sender] >= _value); 53 | balanceOf[_to] += _value; 54 | balanceOf[_from] -= _value; 55 | allowance[_from][msg.sender] -= _value; 56 | Transfer(_from, _to, _value); 57 | return true; 58 | } 59 | 60 | function approve(address _spender, uint256 _value) isRunning validAddress returns (bool success) { 61 | require(_value == 0 || allowance[msg.sender][_spender] == 0); 62 | allowance[msg.sender][_spender] = _value; 63 | Approval(msg.sender, _spender, _value); 64 | return true; 65 | } 66 | 67 | function stop() isOwner { 68 | stopped = true; 69 | } 70 | 71 | function start() isOwner { 72 | stopped = false; 73 | } 74 | 75 | function setName(string _name) isOwner { 76 | name = _name; 77 | } 78 | 79 | function burn(uint256 _value) { 80 | require(balanceOf[msg.sender] >= _value); 81 | balanceOf[msg.sender] -= _value; 82 | balanceOf[0x0] += _value; 83 | Transfer(msg.sender, 0x0, _value); 84 | } 85 | 86 | event Transfer(address indexed _from, address indexed _to, uint256 _value); 87 | event Approval(address indexed _owner, address indexed _spender, uint256 _value); 88 | } -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | 5 | go: 6 | stdin_open: true 7 | tty: true 8 | build: docker/go 9 | volumes: 10 | - .:/go/src/github.com/ezynda3/wtf-ethereum-contracts-golang 11 | working_dir: /go/src/github.com/ezynda3/wtf-ethereum-contracts-golang 12 | -------------------------------------------------------------------------------- /docker/go/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ethereum/solc:stable as solc 2 | 3 | FROM golang:1.9.2 4 | 5 | COPY --from=solc /usr/bin/solc /usr/bin/solc 6 | 7 | RUN go get -u github.com/golang/dep/... 8 | RUN go get -u github.com/ethereum/go-ethereum/... 9 | RUN cd $GOPATH/src/github.com/ethereum/go-ethereum/ && \ 10 | make && make devtools -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | 7 | "github.com/ethereum/go-ethereum/accounts/abi/bind" 8 | "github.com/ethereum/go-ethereum/common" 9 | "github.com/ethereum/go-ethereum/ethclient" 10 | ) 11 | 12 | func main() { 13 | conn, err := ethclient.Dial("https://mainnet.infura.io") 14 | if err != nil { 15 | log.Fatalf("Failed to connect to the Ethereum network: %v", err) 16 | } 17 | 18 | contract, err := NewTronToken(common.HexToAddress("0xf230b790E05390FC8295F4d3F60332c93BEd42e2"), conn) 19 | if err != nil { 20 | log.Fatalf("Failed to instantiate contract: %v", err) 21 | } 22 | 23 | amt, _ := contract.BalanceOf(&bind.CallOpts{}, common.HexToAddress("0x387fc6939b5e54b2f11793df05388f9d11942948")) 24 | 25 | fmt.Println(amt) 26 | } 27 | -------------------------------------------------------------------------------- /token.go: -------------------------------------------------------------------------------- 1 | // Code generated - DO NOT EDIT. 2 | // This file is a generated binding and any manual changes will be lost. 3 | 4 | package main 5 | 6 | import ( 7 | "math/big" 8 | "strings" 9 | 10 | "github.com/ethereum/go-ethereum/accounts/abi" 11 | "github.com/ethereum/go-ethereum/accounts/abi/bind" 12 | "github.com/ethereum/go-ethereum/common" 13 | "github.com/ethereum/go-ethereum/core/types" 14 | ) 15 | 16 | // TronTokenABI is the input ABI used to generate the binding from. 17 | const TronTokenABI = "[{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"stop\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"stopped\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"start\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_addressFounder\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_spender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"}]" 18 | 19 | // TronTokenBin is the compiled bytecode used for deploying new contracts. 20 | const TronTokenBin = `0x606060405260408051908101604052600681527f54726f6e697800000000000000000000000000000000000000000000000000006020820152600090805161004b929160200190610155565b5060408051908101604052600381527f545258000000000000000000000000000000000000000000000000000000000060208201526001908051610093929160200190610155565b506006600281905560006005558054600160a860020a031916905534156100b957600080fd5b604051602080610b288339810160405280805160068054600160a060020a033381166101000261010060a860020a03199092169190911790915567016345785d8a00006005819055908216600081815260036020526040808220849055939550909350917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91905190815260200160405180910390a3506101f0565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061019657805160ff19168380011785556101c3565b828001600101855582156101c3579182015b828111156101c35782518255916020019190600101906101a8565b506101cf9291506101d3565b5090565b6101ed91905b808211156101cf57600081556001016101d9565b90565b610929806101ff6000396000f3006060604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d457806307da68f51461015e578063095ea7b31461017357806318160ddd146101a957806323b872dd146101ce578063313ce567146101f657806342966c681461020957806370a082311461021f57806375f12b211461023e57806395d89b4114610251578063a9059cbb14610264578063be9a655514610286578063c47f002714610299578063dd62ed3e146102ea575b600080fd5b34156100df57600080fd5b6100e761030f565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561012357808201518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561016957600080fd5b6101716103ad565b005b341561017e57600080fd5b610195600160a060020a03600435166024356103d9565b604051901515815260200160405180910390f35b34156101b457600080fd5b6101bc61049f565b60405190815260200160405180910390f35b34156101d957600080fd5b610195600160a060020a03600435811690602435166044356104a5565b341561020157600080fd5b6101bc6105d6565b341561021457600080fd5b6101716004356105dc565b341561022a57600080fd5b6101bc600160a060020a0360043516610685565b341561024957600080fd5b610195610697565b341561025c57600080fd5b6100e76106a0565b341561026f57600080fd5b610195600160a060020a036004351660243561070b565b341561029157600080fd5b6101716107e8565b34156102a457600080fd5b61017160046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061081195505050505050565b34156102f557600080fd5b6101bc600160a060020a0360043581169060243516610845565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103a55780601f1061037a576101008083540402835291602001916103a5565b820191906000526020600020905b81548152906001019060200180831161038857829003601f168201915b505050505081565b60065433600160a060020a0390811661010090920416146103ca57fe5b6006805460ff19166001179055565b60065460009060ff16156103e957fe5b600160a060020a03331615156103fb57fe5b81158061042b5750600160a060020a03338116600090815260046020908152604080832093871683529290522054155b151561043657600080fd5b600160a060020a03338116600081815260046020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60055481565b60065460009060ff16156104b557fe5b600160a060020a03331615156104c757fe5b600160a060020a038416600090815260036020526040902054829010156104ed57600080fd5b600160a060020a038316600090815260036020526040902054828101101561051457600080fd5b600160a060020a03808516600090815260046020908152604080832033909416835292905220548290101561054857600080fd5b600160a060020a03808416600081815260036020908152604080832080548801905588851680845281842080548990039055600483528184203390961684529490915290819020805486900390559091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b60025481565b600160a060020a0333166000908152600360205260409020548190101561060257600080fd5b600160a060020a033316600081815260036020526040808220805485900390558180527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff8054850190559091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9084905190815260200160405180910390a350565b60036020526000908152604090205481565b60065460ff1681565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103a55780601f1061037a576101008083540402835291602001916103a5565b60065460009060ff161561071b57fe5b600160a060020a033316151561072d57fe5b600160a060020a0333166000908152600360205260409020548290101561075357600080fd5b600160a060020a038316600090815260036020526040902054828101101561077a57600080fd5b600160a060020a033381166000818152600360205260408082208054879003905592861680825290839020805486019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b60065433600160a060020a03908116610100909204161461080557fe5b6006805460ff19169055565b60065433600160a060020a03908116610100909204161461082e57fe5b6000818051610841929160200190610862565b5050565b600460209081526000928352604080842090915290825290205481565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106108a357805160ff19168380011785556108d0565b828001600101855582156108d0579182015b828111156108d05782518255916020019190600101906108b5565b506108dc9291506108e0565b5090565b6108fa91905b808211156108dc57600081556001016108e6565b905600a165627a7a72305820a67dd93f272d17e75b4d0df2e65eb6a908f5c33c0c17b8ee999ca39d7d5cdb890029` 21 | 22 | // DeployTronToken deploys a new Ethereum contract, binding an instance of TronToken to it. 23 | func DeployTronToken(auth *bind.TransactOpts, backend bind.ContractBackend, _addressFounder common.Address) (common.Address, *types.Transaction, *TronToken, error) { 24 | parsed, err := abi.JSON(strings.NewReader(TronTokenABI)) 25 | if err != nil { 26 | return common.Address{}, nil, nil, err 27 | } 28 | address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(TronTokenBin), backend, _addressFounder) 29 | if err != nil { 30 | return common.Address{}, nil, nil, err 31 | } 32 | return address, tx, &TronToken{TronTokenCaller: TronTokenCaller{contract: contract}, TronTokenTransactor: TronTokenTransactor{contract: contract}}, nil 33 | } 34 | 35 | // TronToken is an auto generated Go binding around an Ethereum contract. 36 | type TronToken struct { 37 | TronTokenCaller // Read-only binding to the contract 38 | TronTokenTransactor // Write-only binding to the contract 39 | } 40 | 41 | // TronTokenCaller is an auto generated read-only Go binding around an Ethereum contract. 42 | type TronTokenCaller struct { 43 | contract *bind.BoundContract // Generic contract wrapper for the low level calls 44 | } 45 | 46 | // TronTokenTransactor is an auto generated write-only Go binding around an Ethereum contract. 47 | type TronTokenTransactor struct { 48 | contract *bind.BoundContract // Generic contract wrapper for the low level calls 49 | } 50 | 51 | // TronTokenSession is an auto generated Go binding around an Ethereum contract, 52 | // with pre-set call and transact options. 53 | type TronTokenSession struct { 54 | Contract *TronToken // Generic contract binding to set the session for 55 | CallOpts bind.CallOpts // Call options to use throughout this session 56 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 57 | } 58 | 59 | // TronTokenCallerSession is an auto generated read-only Go binding around an Ethereum contract, 60 | // with pre-set call options. 61 | type TronTokenCallerSession struct { 62 | Contract *TronTokenCaller // Generic contract caller binding to set the session for 63 | CallOpts bind.CallOpts // Call options to use throughout this session 64 | } 65 | 66 | // TronTokenTransactorSession is an auto generated write-only Go binding around an Ethereum contract, 67 | // with pre-set transact options. 68 | type TronTokenTransactorSession struct { 69 | Contract *TronTokenTransactor // Generic contract transactor binding to set the session for 70 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 71 | } 72 | 73 | // TronTokenRaw is an auto generated low-level Go binding around an Ethereum contract. 74 | type TronTokenRaw struct { 75 | Contract *TronToken // Generic contract binding to access the raw methods on 76 | } 77 | 78 | // TronTokenCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. 79 | type TronTokenCallerRaw struct { 80 | Contract *TronTokenCaller // Generic read-only contract binding to access the raw methods on 81 | } 82 | 83 | // TronTokenTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. 84 | type TronTokenTransactorRaw struct { 85 | Contract *TronTokenTransactor // Generic write-only contract binding to access the raw methods on 86 | } 87 | 88 | // NewTronToken creates a new instance of TronToken, bound to a specific deployed contract. 89 | func NewTronToken(address common.Address, backend bind.ContractBackend) (*TronToken, error) { 90 | contract, err := bindTronToken(address, backend, backend) 91 | if err != nil { 92 | return nil, err 93 | } 94 | return &TronToken{TronTokenCaller: TronTokenCaller{contract: contract}, TronTokenTransactor: TronTokenTransactor{contract: contract}}, nil 95 | } 96 | 97 | // NewTronTokenCaller creates a new read-only instance of TronToken, bound to a specific deployed contract. 98 | func NewTronTokenCaller(address common.Address, caller bind.ContractCaller) (*TronTokenCaller, error) { 99 | contract, err := bindTronToken(address, caller, nil) 100 | if err != nil { 101 | return nil, err 102 | } 103 | return &TronTokenCaller{contract: contract}, nil 104 | } 105 | 106 | // NewTronTokenTransactor creates a new write-only instance of TronToken, bound to a specific deployed contract. 107 | func NewTronTokenTransactor(address common.Address, transactor bind.ContractTransactor) (*TronTokenTransactor, error) { 108 | contract, err := bindTronToken(address, nil, transactor) 109 | if err != nil { 110 | return nil, err 111 | } 112 | return &TronTokenTransactor{contract: contract}, nil 113 | } 114 | 115 | // bindTronToken binds a generic wrapper to an already deployed contract. 116 | func bindTronToken(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) { 117 | parsed, err := abi.JSON(strings.NewReader(TronTokenABI)) 118 | if err != nil { 119 | return nil, err 120 | } 121 | return bind.NewBoundContract(address, parsed, caller, transactor), nil 122 | } 123 | 124 | // Call invokes the (constant) contract method with params as input values and 125 | // sets the output to result. The result type might be a single field for simple 126 | // returns, a slice of interfaces for anonymous returns and a struct for named 127 | // returns. 128 | func (_TronToken *TronTokenRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { 129 | return _TronToken.Contract.TronTokenCaller.contract.Call(opts, result, method, params...) 130 | } 131 | 132 | // Transfer initiates a plain transaction to move funds to the contract, calling 133 | // its default method if one is available. 134 | func (_TronToken *TronTokenRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 135 | return _TronToken.Contract.TronTokenTransactor.contract.Transfer(opts) 136 | } 137 | 138 | // Transact invokes the (paid) contract method with params as input values. 139 | func (_TronToken *TronTokenRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 140 | return _TronToken.Contract.TronTokenTransactor.contract.Transact(opts, method, params...) 141 | } 142 | 143 | // Call invokes the (constant) contract method with params as input values and 144 | // sets the output to result. The result type might be a single field for simple 145 | // returns, a slice of interfaces for anonymous returns and a struct for named 146 | // returns. 147 | func (_TronToken *TronTokenCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { 148 | return _TronToken.Contract.contract.Call(opts, result, method, params...) 149 | } 150 | 151 | // Transfer initiates a plain transaction to move funds to the contract, calling 152 | // its default method if one is available. 153 | func (_TronToken *TronTokenTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 154 | return _TronToken.Contract.contract.Transfer(opts) 155 | } 156 | 157 | // Transact invokes the (paid) contract method with params as input values. 158 | func (_TronToken *TronTokenTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 159 | return _TronToken.Contract.contract.Transact(opts, method, params...) 160 | } 161 | 162 | // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 163 | // 164 | // Solidity: function allowance( address, address) constant returns(uint256) 165 | func (_TronToken *TronTokenCaller) Allowance(opts *bind.CallOpts, arg0 common.Address, arg1 common.Address) (*big.Int, error) { 166 | var ( 167 | ret0 = new(*big.Int) 168 | ) 169 | out := ret0 170 | err := _TronToken.contract.Call(opts, out, "allowance", arg0, arg1) 171 | return *ret0, err 172 | } 173 | 174 | // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 175 | // 176 | // Solidity: function allowance( address, address) constant returns(uint256) 177 | func (_TronToken *TronTokenSession) Allowance(arg0 common.Address, arg1 common.Address) (*big.Int, error) { 178 | return _TronToken.Contract.Allowance(&_TronToken.CallOpts, arg0, arg1) 179 | } 180 | 181 | // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 182 | // 183 | // Solidity: function allowance( address, address) constant returns(uint256) 184 | func (_TronToken *TronTokenCallerSession) Allowance(arg0 common.Address, arg1 common.Address) (*big.Int, error) { 185 | return _TronToken.Contract.Allowance(&_TronToken.CallOpts, arg0, arg1) 186 | } 187 | 188 | // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 189 | // 190 | // Solidity: function balanceOf( address) constant returns(uint256) 191 | func (_TronToken *TronTokenCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { 192 | var ( 193 | ret0 = new(*big.Int) 194 | ) 195 | out := ret0 196 | err := _TronToken.contract.Call(opts, out, "balanceOf", arg0) 197 | return *ret0, err 198 | } 199 | 200 | // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 201 | // 202 | // Solidity: function balanceOf( address) constant returns(uint256) 203 | func (_TronToken *TronTokenSession) BalanceOf(arg0 common.Address) (*big.Int, error) { 204 | return _TronToken.Contract.BalanceOf(&_TronToken.CallOpts, arg0) 205 | } 206 | 207 | // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 208 | // 209 | // Solidity: function balanceOf( address) constant returns(uint256) 210 | func (_TronToken *TronTokenCallerSession) BalanceOf(arg0 common.Address) (*big.Int, error) { 211 | return _TronToken.Contract.BalanceOf(&_TronToken.CallOpts, arg0) 212 | } 213 | 214 | // Decimals is a free data retrieval call binding the contract method 0x313ce567. 215 | // 216 | // Solidity: function decimals() constant returns(uint256) 217 | func (_TronToken *TronTokenCaller) Decimals(opts *bind.CallOpts) (*big.Int, error) { 218 | var ( 219 | ret0 = new(*big.Int) 220 | ) 221 | out := ret0 222 | err := _TronToken.contract.Call(opts, out, "decimals") 223 | return *ret0, err 224 | } 225 | 226 | // Decimals is a free data retrieval call binding the contract method 0x313ce567. 227 | // 228 | // Solidity: function decimals() constant returns(uint256) 229 | func (_TronToken *TronTokenSession) Decimals() (*big.Int, error) { 230 | return _TronToken.Contract.Decimals(&_TronToken.CallOpts) 231 | } 232 | 233 | // Decimals is a free data retrieval call binding the contract method 0x313ce567. 234 | // 235 | // Solidity: function decimals() constant returns(uint256) 236 | func (_TronToken *TronTokenCallerSession) Decimals() (*big.Int, error) { 237 | return _TronToken.Contract.Decimals(&_TronToken.CallOpts) 238 | } 239 | 240 | // Name is a free data retrieval call binding the contract method 0x06fdde03. 241 | // 242 | // Solidity: function name() constant returns(string) 243 | func (_TronToken *TronTokenCaller) Name(opts *bind.CallOpts) (string, error) { 244 | var ( 245 | ret0 = new(string) 246 | ) 247 | out := ret0 248 | err := _TronToken.contract.Call(opts, out, "name") 249 | return *ret0, err 250 | } 251 | 252 | // Name is a free data retrieval call binding the contract method 0x06fdde03. 253 | // 254 | // Solidity: function name() constant returns(string) 255 | func (_TronToken *TronTokenSession) Name() (string, error) { 256 | return _TronToken.Contract.Name(&_TronToken.CallOpts) 257 | } 258 | 259 | // Name is a free data retrieval call binding the contract method 0x06fdde03. 260 | // 261 | // Solidity: function name() constant returns(string) 262 | func (_TronToken *TronTokenCallerSession) Name() (string, error) { 263 | return _TronToken.Contract.Name(&_TronToken.CallOpts) 264 | } 265 | 266 | // Stopped is a free data retrieval call binding the contract method 0x75f12b21. 267 | // 268 | // Solidity: function stopped() constant returns(bool) 269 | func (_TronToken *TronTokenCaller) Stopped(opts *bind.CallOpts) (bool, error) { 270 | var ( 271 | ret0 = new(bool) 272 | ) 273 | out := ret0 274 | err := _TronToken.contract.Call(opts, out, "stopped") 275 | return *ret0, err 276 | } 277 | 278 | // Stopped is a free data retrieval call binding the contract method 0x75f12b21. 279 | // 280 | // Solidity: function stopped() constant returns(bool) 281 | func (_TronToken *TronTokenSession) Stopped() (bool, error) { 282 | return _TronToken.Contract.Stopped(&_TronToken.CallOpts) 283 | } 284 | 285 | // Stopped is a free data retrieval call binding the contract method 0x75f12b21. 286 | // 287 | // Solidity: function stopped() constant returns(bool) 288 | func (_TronToken *TronTokenCallerSession) Stopped() (bool, error) { 289 | return _TronToken.Contract.Stopped(&_TronToken.CallOpts) 290 | } 291 | 292 | // Symbol is a free data retrieval call binding the contract method 0x95d89b41. 293 | // 294 | // Solidity: function symbol() constant returns(string) 295 | func (_TronToken *TronTokenCaller) Symbol(opts *bind.CallOpts) (string, error) { 296 | var ( 297 | ret0 = new(string) 298 | ) 299 | out := ret0 300 | err := _TronToken.contract.Call(opts, out, "symbol") 301 | return *ret0, err 302 | } 303 | 304 | // Symbol is a free data retrieval call binding the contract method 0x95d89b41. 305 | // 306 | // Solidity: function symbol() constant returns(string) 307 | func (_TronToken *TronTokenSession) Symbol() (string, error) { 308 | return _TronToken.Contract.Symbol(&_TronToken.CallOpts) 309 | } 310 | 311 | // Symbol is a free data retrieval call binding the contract method 0x95d89b41. 312 | // 313 | // Solidity: function symbol() constant returns(string) 314 | func (_TronToken *TronTokenCallerSession) Symbol() (string, error) { 315 | return _TronToken.Contract.Symbol(&_TronToken.CallOpts) 316 | } 317 | 318 | // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 319 | // 320 | // Solidity: function totalSupply() constant returns(uint256) 321 | func (_TronToken *TronTokenCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { 322 | var ( 323 | ret0 = new(*big.Int) 324 | ) 325 | out := ret0 326 | err := _TronToken.contract.Call(opts, out, "totalSupply") 327 | return *ret0, err 328 | } 329 | 330 | // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 331 | // 332 | // Solidity: function totalSupply() constant returns(uint256) 333 | func (_TronToken *TronTokenSession) TotalSupply() (*big.Int, error) { 334 | return _TronToken.Contract.TotalSupply(&_TronToken.CallOpts) 335 | } 336 | 337 | // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 338 | // 339 | // Solidity: function totalSupply() constant returns(uint256) 340 | func (_TronToken *TronTokenCallerSession) TotalSupply() (*big.Int, error) { 341 | return _TronToken.Contract.TotalSupply(&_TronToken.CallOpts) 342 | } 343 | 344 | // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 345 | // 346 | // Solidity: function approve(_spender address, _value uint256) returns(success bool) 347 | func (_TronToken *TronTokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) { 348 | return _TronToken.contract.Transact(opts, "approve", _spender, _value) 349 | } 350 | 351 | // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 352 | // 353 | // Solidity: function approve(_spender address, _value uint256) returns(success bool) 354 | func (_TronToken *TronTokenSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) { 355 | return _TronToken.Contract.Approve(&_TronToken.TransactOpts, _spender, _value) 356 | } 357 | 358 | // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 359 | // 360 | // Solidity: function approve(_spender address, _value uint256) returns(success bool) 361 | func (_TronToken *TronTokenTransactorSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) { 362 | return _TronToken.Contract.Approve(&_TronToken.TransactOpts, _spender, _value) 363 | } 364 | 365 | // Burn is a paid mutator transaction binding the contract method 0x42966c68. 366 | // 367 | // Solidity: function burn(_value uint256) returns() 368 | func (_TronToken *TronTokenTransactor) Burn(opts *bind.TransactOpts, _value *big.Int) (*types.Transaction, error) { 369 | return _TronToken.contract.Transact(opts, "burn", _value) 370 | } 371 | 372 | // Burn is a paid mutator transaction binding the contract method 0x42966c68. 373 | // 374 | // Solidity: function burn(_value uint256) returns() 375 | func (_TronToken *TronTokenSession) Burn(_value *big.Int) (*types.Transaction, error) { 376 | return _TronToken.Contract.Burn(&_TronToken.TransactOpts, _value) 377 | } 378 | 379 | // Burn is a paid mutator transaction binding the contract method 0x42966c68. 380 | // 381 | // Solidity: function burn(_value uint256) returns() 382 | func (_TronToken *TronTokenTransactorSession) Burn(_value *big.Int) (*types.Transaction, error) { 383 | return _TronToken.Contract.Burn(&_TronToken.TransactOpts, _value) 384 | } 385 | 386 | // SetName is a paid mutator transaction binding the contract method 0xc47f0027. 387 | // 388 | // Solidity: function setName(_name string) returns() 389 | func (_TronToken *TronTokenTransactor) SetName(opts *bind.TransactOpts, _name string) (*types.Transaction, error) { 390 | return _TronToken.contract.Transact(opts, "setName", _name) 391 | } 392 | 393 | // SetName is a paid mutator transaction binding the contract method 0xc47f0027. 394 | // 395 | // Solidity: function setName(_name string) returns() 396 | func (_TronToken *TronTokenSession) SetName(_name string) (*types.Transaction, error) { 397 | return _TronToken.Contract.SetName(&_TronToken.TransactOpts, _name) 398 | } 399 | 400 | // SetName is a paid mutator transaction binding the contract method 0xc47f0027. 401 | // 402 | // Solidity: function setName(_name string) returns() 403 | func (_TronToken *TronTokenTransactorSession) SetName(_name string) (*types.Transaction, error) { 404 | return _TronToken.Contract.SetName(&_TronToken.TransactOpts, _name) 405 | } 406 | 407 | // Start is a paid mutator transaction binding the contract method 0xbe9a6555. 408 | // 409 | // Solidity: function start() returns() 410 | func (_TronToken *TronTokenTransactor) Start(opts *bind.TransactOpts) (*types.Transaction, error) { 411 | return _TronToken.contract.Transact(opts, "start") 412 | } 413 | 414 | // Start is a paid mutator transaction binding the contract method 0xbe9a6555. 415 | // 416 | // Solidity: function start() returns() 417 | func (_TronToken *TronTokenSession) Start() (*types.Transaction, error) { 418 | return _TronToken.Contract.Start(&_TronToken.TransactOpts) 419 | } 420 | 421 | // Start is a paid mutator transaction binding the contract method 0xbe9a6555. 422 | // 423 | // Solidity: function start() returns() 424 | func (_TronToken *TronTokenTransactorSession) Start() (*types.Transaction, error) { 425 | return _TronToken.Contract.Start(&_TronToken.TransactOpts) 426 | } 427 | 428 | // Stop is a paid mutator transaction binding the contract method 0x07da68f5. 429 | // 430 | // Solidity: function stop() returns() 431 | func (_TronToken *TronTokenTransactor) Stop(opts *bind.TransactOpts) (*types.Transaction, error) { 432 | return _TronToken.contract.Transact(opts, "stop") 433 | } 434 | 435 | // Stop is a paid mutator transaction binding the contract method 0x07da68f5. 436 | // 437 | // Solidity: function stop() returns() 438 | func (_TronToken *TronTokenSession) Stop() (*types.Transaction, error) { 439 | return _TronToken.Contract.Stop(&_TronToken.TransactOpts) 440 | } 441 | 442 | // Stop is a paid mutator transaction binding the contract method 0x07da68f5. 443 | // 444 | // Solidity: function stop() returns() 445 | func (_TronToken *TronTokenTransactorSession) Stop() (*types.Transaction, error) { 446 | return _TronToken.Contract.Stop(&_TronToken.TransactOpts) 447 | } 448 | 449 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 450 | // 451 | // Solidity: function transfer(_to address, _value uint256) returns(success bool) 452 | func (_TronToken *TronTokenTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) { 453 | return _TronToken.contract.Transact(opts, "transfer", _to, _value) 454 | } 455 | 456 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 457 | // 458 | // Solidity: function transfer(_to address, _value uint256) returns(success bool) 459 | func (_TronToken *TronTokenSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) { 460 | return _TronToken.Contract.Transfer(&_TronToken.TransactOpts, _to, _value) 461 | } 462 | 463 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 464 | // 465 | // Solidity: function transfer(_to address, _value uint256) returns(success bool) 466 | func (_TronToken *TronTokenTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) { 467 | return _TronToken.Contract.Transfer(&_TronToken.TransactOpts, _to, _value) 468 | } 469 | 470 | // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 471 | // 472 | // Solidity: function transferFrom(_from address, _to address, _value uint256) returns(success bool) 473 | func (_TronToken *TronTokenTransactor) TransferFrom(opts *bind.TransactOpts, _from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error) { 474 | return _TronToken.contract.Transact(opts, "transferFrom", _from, _to, _value) 475 | } 476 | 477 | // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 478 | // 479 | // Solidity: function transferFrom(_from address, _to address, _value uint256) returns(success bool) 480 | func (_TronToken *TronTokenSession) TransferFrom(_from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error) { 481 | return _TronToken.Contract.TransferFrom(&_TronToken.TransactOpts, _from, _to, _value) 482 | } 483 | 484 | // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 485 | // 486 | // Solidity: function transferFrom(_from address, _to address, _value uint256) returns(success bool) 487 | func (_TronToken *TronTokenTransactorSession) TransferFrom(_from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error) { 488 | return _TronToken.Contract.TransferFrom(&_TronToken.TransactOpts, _from, _to, _value) 489 | } 490 | --------------------------------------------------------------------------------