#[allow(dead_code)]
pub mod erc20_preset_fixed_supply {
# [rustfmt :: skip] use ethcontract as ethcontract ;
#[doc = "Generated by `ethcontract`"]
#[derive(Clone)]
pub struct Contract {
methods: Methods,
}
impl Contract {
#[doc = r" Retrieves the truffle artifact used to generate the type safe"]
#[doc = r" API for this contract."]
pub fn artifact() -> &'static self::ethcontract::Artifact {
use self::ethcontract::private::lazy_static;
use self::ethcontract::Artifact;
lazy_static! {
pub static ref ARTIFACT: Artifact = {
# [allow (unused_mut)] let mut artifact = Artifact :: from_json ("{\n \"_format\": \"hh-sol-artifact-1\",\n \"contractName\": \"ERC20PresetFixedSupply\",\n \"sourceName\": \"contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol\",\n \"abi\": [\n {\n \"inputs\": [\n {\n \"internalType\": \"string\",\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"internalType\": \"string\",\n \"name\": \"symbol\",\n \"type\": \"string\"\n },\n {\n \"internalType\": \"uint256\",\n \"name\": \"initialSupply\",\n \"type\": \"uint256\"\n },\n {\n \"internalType\": \"address\",\n \"name\": \"owner\",\n \"type\": \"address\"\n }\n ],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"constructor\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"internalType\": \"address\",\n \"name\": \"owner\",\n \"type\": \"address\"\n },\n {\n \"indexed\": true,\n \"internalType\": \"address\",\n \"name\": \"spender\",\n \"type\": \"address\"\n },\n {\n \"indexed\": false,\n \"internalType\": \"uint256\",\n \"name\": \"value\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"Approval\",\n \"type\": \"event\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"internalType\": \"address\",\n \"name\": \"from\",\n \"type\": \"address\"\n },\n {\n \"indexed\": true,\n \"internalType\": \"address\",\n \"name\": \"to\",\n \"type\": \"address\"\n },\n {\n \"indexed\": false,\n \"internalType\": \"uint256\",\n \"name\": \"value\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"Transfer\",\n \"type\": \"event\"\n },\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"owner\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"address\",\n \"name\": \"spender\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"allowance\",\n \"outputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"spender\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"uint256\",\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"approve\",\n \"outputs\": [\n {\n \"internalType\": \"bool\",\n \"name\": \"\",\n \"type\": \"bool\"\n }\n ],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"account\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"balanceOf\",\n \"outputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"burn\",\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"account\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"uint256\",\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"burnFrom\",\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [],\n \"name\": \"decimals\",\n \"outputs\": [\n {\n \"internalType\": \"uint8\",\n \"name\": \"\",\n \"type\": \"uint8\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"spender\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"uint256\",\n \"name\": \"subtractedValue\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"decreaseAllowance\",\n \"outputs\": [\n {\n \"internalType\": \"bool\",\n \"name\": \"\",\n \"type\": \"bool\"\n }\n ],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"spender\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"uint256\",\n \"name\": \"addedValue\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"increaseAllowance\",\n \"outputs\": [\n {\n \"internalType\": \"bool\",\n \"name\": \"\",\n \"type\": \"bool\"\n }\n ],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [],\n \"name\": \"name\",\n \"outputs\": [\n {\n \"internalType\": \"string\",\n \"name\": \"\",\n \"type\": \"string\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [],\n \"name\": \"symbol\",\n \"outputs\": [\n {\n \"internalType\": \"string\",\n \"name\": \"\",\n \"type\": \"string\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [],\n \"name\": \"totalSupply\",\n \"outputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"recipient\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"uint256\",\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"transfer\",\n \"outputs\": [\n {\n \"internalType\": \"bool\",\n \"name\": \"\",\n \"type\": \"bool\"\n }\n ],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"sender\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"address\",\n \"name\": \"recipient\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"uint256\",\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"transferFrom\",\n \"outputs\": [\n {\n \"internalType\": \"bool\",\n \"name\": \"\",\n \"type\": \"bool\"\n }\n ],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n }\n ],\n \"bytecode\": \"0x60806040523480156200001157600080fd5b5060405162000f1538038062000f158339810160408190526200003491620002c3565b8351849084906200004d9060039060208501906200016a565b508051620000639060049060208401906200016a565b5050506200007881836200008260201b60201c565b50505050620003cc565b6001600160a01b038216620000dd5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b8060026000828254620000f1919062000354565b90915550506001600160a01b038216600090815260208190526040812080548392906200012090849062000354565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b828054620001789062000379565b90600052602060002090601f0160209004810192826200019c5760008555620001e7565b82601f10620001b757805160ff1916838001178555620001e7565b82800160010185558215620001e7579182015b82811115620001e7578251825591602001919060010190620001ca565b50620001f5929150620001f9565b5090565b5b80821115620001f55760008155600101620001fa565b600082601f83011262000221578081fd5b81516001600160401b03808211156200023e576200023e620003b6565b604051601f8301601f19908116603f01168101908282118183101715620002695762000269620003b6565b8160405283815260209250868385880101111562000285578485fd5b8491505b83821015620002a8578582018301518183018401529082019062000289565b83821115620002b957848385830101525b9695505050505050565b60008060008060808587031215620002d9578384fd5b84516001600160401b0380821115620002f0578586fd5b620002fe8883890162000210565b9550602087015191508082111562000314578485fd5b50620003238782880162000210565b60408701516060880151919550935090506001600160a01b038116811462000349578182fd5b939692955090935050565b600082198211156200037457634e487b7160e01b81526011600452602481fd5b500190565b600181811c908216806200038e57607f821691505b60208210811415620003b057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610b3980620003dc6000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806342966c681161008c57806395d89b411161006657806395d89b4114610197578063a457c2d71461019f578063a9059cbb146101b2578063dd62ed3e146101c5576100cf565b806342966c681461015c57806370a082311461017157806379cc679014610184576100cf565b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461011557806323b872dd14610127578063313ce5671461013a5780633950935114610149575b600080fd5b6100dc6101fe565b6040516100e99190610a30565b60405180910390f35b6101056101003660046109ef565b610290565b60405190151581526020016100e9565b6002545b6040519081526020016100e9565b6101056101353660046109b4565b6102a6565b604051601281526020016100e9565b6101056101573660046109ef565b61035c565b61016f61016a366004610a18565b610393565b005b61011961017f366004610961565b6103a0565b61016f6101923660046109ef565b6103bf565b6100dc610447565b6101056101ad3660046109ef565b610456565b6101056101c03660046109ef565b6104f1565b6101196101d3366004610982565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60606003805461020d90610ab2565b80601f016020809104026020016040519081016040528092919081815260200182805461023990610ab2565b80156102865780601f1061025b57610100808354040283529160200191610286565b820191906000526020600020905b81548152906001019060200180831161026957829003601f168201915b5050505050905090565b600061029d3384846104fe565b50600192915050565b60006102b3848484610623565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561033d5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610351853361034c8685610a9b565b6104fe565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161029d91859061034c908690610a83565b61039d33826107fb565b50565b6001600160a01b0381166000908152602081905260409020545b919050565b60006103cb83336101d3565b9050818110156104295760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b6064820152608401610334565b610438833361034c8585610a9b565b61044283836107fb565b505050565b60606004805461020d90610ab2565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156104d85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610334565b6104e7338561034c8685610a9b565b5060019392505050565b600061029d338484610623565b6001600160a01b0383166105605760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610334565b6001600160a01b0382166105c15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610334565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166106875760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610334565b6001600160a01b0382166106e95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610334565b6001600160a01b038316600090815260208190526040902054818110156107615760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610334565b61076b8282610a9b565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906107a1908490610a83565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107ed91815260200190565b60405180910390a350505050565b6001600160a01b03821661085b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610334565b6001600160a01b038216600090815260208190526040902054818110156108cf5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610334565b6108d98282610a9b565b6001600160a01b03841660009081526020819052604081209190915560028054849290610907908490610a9b565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610616565b80356001600160a01b03811681146103ba57600080fd5b600060208284031215610972578081fd5b61097b8261094a565b9392505050565b60008060408385031215610994578081fd5b61099d8361094a565b91506109ab6020840161094a565b90509250929050565b6000806000606084860312156109c8578081fd5b6109d18461094a565b92506109df6020850161094a565b9150604084013590509250925092565b60008060408385031215610a01578182fd5b610a0a8361094a565b946020939093013593505050565b600060208284031215610a29578081fd5b5035919050565b6000602080835283518082850152825b81811015610a5c57858101830151858201604001528201610a40565b81811115610a6d5783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610a9657610a96610aed565b500190565b600082821015610aad57610aad610aed565b500390565b600181811c90821680610ac657607f821691505b60208210811415610ae757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea264697066735822122096a715a44c68349547f9848628faa41936efe5efbc0bf0359a6b708a7eda798764736f6c63430008030033\",\n \"deployedBytecode\": \"0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806342966c681161008c57806395d89b411161006657806395d89b4114610197578063a457c2d71461019f578063a9059cbb146101b2578063dd62ed3e146101c5576100cf565b806342966c681461015c57806370a082311461017157806379cc679014610184576100cf565b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461011557806323b872dd14610127578063313ce5671461013a5780633950935114610149575b600080fd5b6100dc6101fe565b6040516100e99190610a30565b60405180910390f35b6101056101003660046109ef565b610290565b60405190151581526020016100e9565b6002545b6040519081526020016100e9565b6101056101353660046109b4565b6102a6565b604051601281526020016100e9565b6101056101573660046109ef565b61035c565b61016f61016a366004610a18565b610393565b005b61011961017f366004610961565b6103a0565b61016f6101923660046109ef565b6103bf565b6100dc610447565b6101056101ad3660046109ef565b610456565b6101056101c03660046109ef565b6104f1565b6101196101d3366004610982565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60606003805461020d90610ab2565b80601f016020809104026020016040519081016040528092919081815260200182805461023990610ab2565b80156102865780601f1061025b57610100808354040283529160200191610286565b820191906000526020600020905b81548152906001019060200180831161026957829003601f168201915b5050505050905090565b600061029d3384846104fe565b50600192915050565b60006102b3848484610623565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561033d5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610351853361034c8685610a9b565b6104fe565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161029d91859061034c908690610a83565b61039d33826107fb565b50565b6001600160a01b0381166000908152602081905260409020545b919050565b60006103cb83336101d3565b9050818110156104295760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b6064820152608401610334565b610438833361034c8585610a9b565b61044283836107fb565b505050565b60606004805461020d90610ab2565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156104d85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610334565b6104e7338561034c8685610a9b565b5060019392505050565b600061029d338484610623565b6001600160a01b0383166105605760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610334565b6001600160a01b0382166105c15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610334565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166106875760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610334565b6001600160a01b0382166106e95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610334565b6001600160a01b038316600090815260208190526040902054818110156107615760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610334565b61076b8282610a9b565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906107a1908490610a83565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107ed91815260200190565b60405180910390a350505050565b6001600160a01b03821661085b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610334565b6001600160a01b038216600090815260208190526040902054818110156108cf5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610334565b6108d98282610a9b565b6001600160a01b03841660009081526020819052604081209190915560028054849290610907908490610a9b565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610616565b80356001600160a01b03811681146103ba57600080fd5b600060208284031215610972578081fd5b61097b8261094a565b9392505050565b60008060408385031215610994578081fd5b61099d8361094a565b91506109ab6020840161094a565b90509250929050565b6000806000606084860312156109c8578081fd5b6109d18461094a565b92506109df6020850161094a565b9150604084013590509250925092565b60008060408385031215610a01578182fd5b610a0a8361094a565b946020939093013593505050565b600060208284031215610a29578081fd5b5035919050565b6000602080835283518082850152825b81811015610a5c57858101830151858201604001528201610a40565b81811115610a6d5783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610a9657610a96610aed565b500190565b600082821015610aad57610aad610aed565b500390565b600181811c90821680610ac657607f821691505b60208210811415610ae757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea264697066735822122096a715a44c68349547f9848628faa41936efe5efbc0bf0359a6b708a7eda798764736f6c63430008030033\",\n \"linkReferences\": {},\n \"deployedLinkReferences\": {}\n}\n") . expect ("valid artifact JSON") ;
artifact
};
}
&ARTIFACT
}
#[doc = r" Creates a new contract instance with the specified `web3`"]
#[doc = r" provider at the given `Address`."]
#[doc = r""]
#[doc = r" Note that this does not verify that a contract with a matching"]
#[doc = r" `Abi` is actually deployed at the given address."]
pub fn at<F, T>(
web3: &self::ethcontract::web3::api::Web3<T>,
address: self::ethcontract::Address,
) -> Self
where
F: std::future::Future<
Output = Result<self::ethcontract::json::Value, self::ethcontract::web3::Error>,
> + Send
+ 'static,
T: self::ethcontract::web3::Transport<Out = F> + Send + Sync + 'static,
{
Contract::with_deployment_info(web3, address, None)
}
#[doc = r" Creates a new contract instance with the specified `web3` provider with"]
#[doc = r" the given `Abi` at the given `Address` and an optional transaction hash."]
#[doc = r" This hash is used to retrieve contract related information such as the"]
#[doc = r" creation block (which is useful for fetching all historic events)."]
#[doc = r""]
#[doc = r" Note that this does not verify that a contract with a matching `Abi` is"]
#[doc = r" actually deployed at the given address nor that the transaction hash,"]
#[doc = r" when provided, is actually for this contract deployment."]
pub fn with_deployment_info<F, T>(
web3: &self::ethcontract::web3::api::Web3<T>,
address: self::ethcontract::Address,
deployment_information: Option<ethcontract::common::DeploymentInformation>,
) -> Self
where
F: std::future::Future<
Output = Result<self::ethcontract::json::Value, self::ethcontract::web3::Error>,
> + Send
+ 'static,
T: self::ethcontract::web3::Transport<Out = F> + Send + Sync + 'static,
{
use self::ethcontract::transport::DynTransport;
use self::ethcontract::web3::api::Web3;
use self::ethcontract::Instance;
let transport = DynTransport::new(web3.transport().clone());
let web3 = Web3::new(transport);
let abi = Self::artifact().abi.clone();
let instance = Instance::with_deployment_info(web3, abi, address, deployment_information);
Contract::from_raw(instance)
}
#[doc = r" Creates a contract from a raw instance."]
fn from_raw(instance: self::ethcontract::dyns::DynInstance) -> Self {
let methods = Methods { instance };
Contract { methods }
}
#[doc = r" Returns the contract address being used by this instance."]
pub fn address(&self) -> self::ethcontract::Address {
self.raw_instance().address()
}
#[doc = r" Returns the deployment information of the contract"]
#[doc = r" if it is known, `None` otherwise."]
pub fn deployment_information(&self) -> Option<ethcontract::common::DeploymentInformation> {
self.raw_instance().deployment_information()
}
#[doc = r" Returns a reference to the default method options used by this"]
#[doc = r" contract."]
pub fn defaults(&self) -> &self::ethcontract::contract::MethodDefaults {
&self.raw_instance().defaults
}
#[doc = r" Returns a mutable reference to the default method options used"]
#[doc = r" by this contract."]
pub fn defaults_mut(&mut self) -> &mut self::ethcontract::contract::MethodDefaults {
&mut self.raw_instance_mut().defaults
}
#[doc = r" Returns a reference to the raw runtime instance used by this"]
#[doc = r" contract."]
pub fn raw_instance(&self) -> &self::ethcontract::dyns::DynInstance {
&self.methods.instance
}
#[doc = r" Returns a mutable reference to the raw runtime instance used by"]
#[doc = r" this contract."]
fn raw_instance_mut(&mut self) -> &mut self::ethcontract::dyns::DynInstance {
&mut self.methods.instance
}
}
impl std::fmt::Debug for Contract {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_tuple(stringify!(ERC20PresetFixedSupply))
.field(&self.address())
.finish()
}
}
impl Contract {
#[doc = "Generated by `ethcontract`"]
#[allow(clippy::too_many_arguments)]
pub fn builder<F, T>(
web3: &self::ethcontract::web3::api::Web3<T>,
name: String,
symbol: String,
initial_supply: self::ethcontract::U256,
owner: self::ethcontract::Address,
) -> self::ethcontract::dyns::DynDeployBuilder<Self>
where
F: std::future::Future<
Output = Result<self::ethcontract::json::Value, self::ethcontract::web3::Error>,
> + Send
+ 'static,
T: self::ethcontract::web3::Transport<Out = F> + Send + Sync + 'static,
{
use self::ethcontract::contract::DeployBuilder;
use self::ethcontract::dyns::DynTransport;
use self::ethcontract::web3::api::Web3;
let transport = DynTransport::new(web3.transport().clone());
let web3 = Web3::new(transport);
let bytecode = Self::artifact().bytecode.clone();
DeployBuilder::new(web3, bytecode, (name, symbol, initial_supply, owner))
.expect("valid deployment args")
}
}
impl self::ethcontract::contract::Deploy<self::ethcontract::dyns::DynTransport> for Contract {
type Context = self::ethcontract::common::Bytecode;
fn bytecode(cx: &Self::Context) -> &self::ethcontract::common::Bytecode {
cx
}
fn abi(_: &Self::Context) -> &self::ethcontract::common::Abi {
&Self::artifact().abi
}
fn from_deployment(
web3: self::ethcontract::dyns::DynWeb3,
address: self::ethcontract::Address,
transaction_hash: self::ethcontract::H256,
_: Self::Context,
) -> Self {
Self::with_deployment_info(&web3, address, Some(transaction_hash.into()))
}
}
impl Contract {
#[doc = r" Retrieves a reference to type containing all the generated"]
#[doc = r" contract methods. This can be used for methods where the name"]
#[doc = r" would collide with a common method (like `at` or `deployed`)."]
pub fn methods(&self) -> &Methods {
&self.methods
}
}
#[doc = r" Type containing all contract methods for generated contract type."]
#[derive(Clone)]
pub struct Methods {
instance: self::ethcontract::dyns::DynInstance,
}
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
impl Methods {
#[doc = "Generated by `ethcontract`"]
pub fn decimals(&self) -> self::ethcontract::dyns::DynViewMethodBuilder<u8> {
self
.instance
.view_method([49, 60, 229, 103], ())
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn transfer_from(
&self,
sender: self::ethcontract::Address,
recipient: self::ethcontract::Address,
amount: self::ethcontract::U256,
) -> self::ethcontract::dyns::DynMethodBuilder<bool> {
self
.instance
.method([35, 184, 114, 221], (sender, recipient, amount))
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn allowance(
&self,
owner: self::ethcontract::Address,
spender: self::ethcontract::Address,
) -> self::ethcontract::dyns::DynViewMethodBuilder<self::ethcontract::U256> {
self
.instance
.view_method([221, 98, 237, 62], (owner, spender))
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn burn_from(
&self,
account: self::ethcontract::Address,
amount: self::ethcontract::U256,
) -> self::ethcontract::dyns::DynMethodBuilder<()> {
self
.instance
.method([121, 204, 103, 144], (account, amount))
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn decrease_allowance(
&self,
spender: self::ethcontract::Address,
subtracted_value: self::ethcontract::U256,
) -> self::ethcontract::dyns::DynMethodBuilder<bool> {
self
.instance
.method([164, 87, 194, 215], (spender, subtracted_value))
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn burn(
&self,
amount: self::ethcontract::U256,
) -> self::ethcontract::dyns::DynMethodBuilder<()> {
self
.instance
.method([66, 150, 108, 104], (amount,))
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn name(&self) -> self::ethcontract::dyns::DynViewMethodBuilder<String> {
self
.instance
.view_method([6, 253, 222, 3], ())
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn symbol(&self) -> self::ethcontract::dyns::DynViewMethodBuilder<String> {
self
.instance
.view_method([149, 216, 155, 65], ())
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn approve(
&self,
spender: self::ethcontract::Address,
amount: self::ethcontract::U256,
) -> self::ethcontract::dyns::DynMethodBuilder<bool> {
self
.instance
.method([9, 94, 167, 179], (spender, amount))
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn balance_of(
&self,
account: self::ethcontract::Address,
) -> self::ethcontract::dyns::DynViewMethodBuilder<self::ethcontract::U256> {
self
.instance
.view_method([112, 160, 130, 49], (account,))
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn total_supply(
&self,
) -> self::ethcontract::dyns::DynViewMethodBuilder<self::ethcontract::U256> {
self
.instance
.view_method([24, 22, 13, 221], ())
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn transfer(
&self,
recipient: self::ethcontract::Address,
amount: self::ethcontract::U256,
) -> self::ethcontract::dyns::DynMethodBuilder<bool> {
self
.instance
.method([169, 5, 156, 187], (recipient, amount))
.expect("generated call")
}
#[doc = "Generated by `ethcontract`"]
pub fn increase_allowance(
&self,
spender: self::ethcontract::Address,
added_value: self::ethcontract::U256,
) -> self::ethcontract::dyns::DynMethodBuilder<bool> {
self
.instance
.method([57, 80, 147, 81], (spender, added_value))
.expect("generated call")
}
}
impl std::ops::Deref for Contract {
type Target = Methods;
fn deref(&self) -> &Self::Target {
&self.methods
}
}
#[doc = r" Module containing all generated data models for this contract's"]
#[doc = r" events."]
pub mod event_data {
use super::ethcontract;
#[derive(Clone, Debug, Default, Eq, PartialEq, serde :: Deserialize, serde :: Serialize)]
pub struct Transfer {
pub from: self::ethcontract::Address,
pub to: self::ethcontract::Address,
pub value: self::ethcontract::U256,
}
impl Transfer {
#[doc = r" Retrieves the signature for the event this data corresponds to."]
#[doc = r" This signature is the Keccak-256 hash of the ABI signature of"]
#[doc = r" this event."]
pub fn signature() -> self::ethcontract::H256 {
self::ethcontract::H256([
221, 242, 82, 173, 27, 226, 200, 155, 105, 194, 176, 104, 252, 55, 141, 170, 149, 43,
167, 241, 99, 196, 161, 22, 40, 245, 90, 77, 245, 35, 179, 239,
])
}
#[doc = r" Retrieves the ABI signature for the event this data corresponds"]
#[doc = r" to. For this event the value should always be:"]
#[doc = r""]
#[doc = "`Transfer(address,address,uint256)`"]
pub fn abi_signature() -> &'static str {
"Transfer(address,address,uint256)"
}
}
impl self::ethcontract::tokens::Tokenize for Transfer {
fn from_token(
token: self::ethcontract::common::abi::Token,
) -> Result<Self, self::ethcontract::tokens::Error> {
let (from, to, value) = self::ethcontract::tokens::Tokenize::from_token(token)?;
Ok(Transfer { from, to, value })
}
fn into_token(self) -> self::ethcontract::common::abi::Token {
unimplemented!("events are only decoded, not encoded")
}
}
#[derive(Clone, Debug, Default, Eq, PartialEq, serde :: Deserialize, serde :: Serialize)]
pub struct Approval {
pub owner: self::ethcontract::Address,
pub spender: self::ethcontract::Address,
pub value: self::ethcontract::U256,
}
impl Approval {
#[doc = r" Retrieves the signature for the event this data corresponds to."]
#[doc = r" This signature is the Keccak-256 hash of the ABI signature of"]
#[doc = r" this event."]
pub fn signature() -> self::ethcontract::H256 {
self::ethcontract::H256([
140, 91, 225, 229, 235, 236, 125, 91, 209, 79, 113, 66, 125, 30, 132, 243, 221, 3, 20,
192, 247, 178, 41, 30, 91, 32, 10, 200, 199, 195, 185, 37,
])
}
#[doc = r" Retrieves the ABI signature for the event this data corresponds"]
#[doc = r" to. For this event the value should always be:"]
#[doc = r""]
#[doc = "`Approval(address,address,uint256)`"]
pub fn abi_signature() -> &'static str {
"Approval(address,address,uint256)"
}
}
impl self::ethcontract::tokens::Tokenize for Approval {
fn from_token(
token: self::ethcontract::common::abi::Token,
) -> Result<Self, self::ethcontract::tokens::Error> {
let (owner, spender, value) = self::ethcontract::tokens::Tokenize::from_token(token)?;
Ok(Approval {
owner,
spender,
value,
})
}
fn into_token(self) -> self::ethcontract::common::abi::Token {
unimplemented!("events are only decoded, not encoded")
}
}
}
impl Contract {
#[doc = r" Retrieves a handle to a type containing for creating event"]
#[doc = r" streams for all the contract events."]
pub fn events(&self) -> Events<'_> {
Events {
instance: self.raw_instance(),
}
}
}
pub struct Events<'a> {
instance: &'a self::ethcontract::dyns::DynInstance,
}
impl Events<'_> {
#[doc = r" Generated by `ethcontract`."]
pub fn transfer(&self) -> self::event_builders::TransferBuilder {
self::event_builders::TransferBuilder(
self
.instance
.event(self::ethcontract::H256([
221, 242, 82, 173, 27, 226, 200, 155, 105, 194, 176, 104, 252, 55, 141, 170, 149, 43,
167, 241, 99, 196, 161, 22, 40, 245, 90, 77, 245, 35, 179, 239,
]))
.expect("generated event filter"),
)
}
#[doc = r" Generated by `ethcontract`."]
pub fn approval(&self) -> self::event_builders::ApprovalBuilder {
self::event_builders::ApprovalBuilder(
self
.instance
.event(self::ethcontract::H256([
140, 91, 225, 229, 235, 236, 125, 91, 209, 79, 113, 66, 125, 30, 132, 243, 221, 3, 20,
192, 247, 178, 41, 30, 91, 32, 10, 200, 199, 195, 185, 37,
]))
.expect("generated event filter"),
)
}
}
#[doc = r" Module containing the generated event stream builders with type safe"]
#[doc = r" filter methods for this contract's events."]
pub mod event_builders {
use super::ethcontract;
use super::event_data;
#[doc = "A builder for creating a filtered stream of `Transfer` events."]
pub struct TransferBuilder(
#[doc = r" The inner event builder."]
pub self::ethcontract::dyns::DynEventBuilder<self::event_data::Transfer>,
);
impl TransferBuilder {
#[doc = r" Sets the starting block from which to stream logs for."]
#[doc = r""]
#[doc = r" If left unset defaults to the latest block."]
#[allow(clippy::wrong_self_convention)]
pub fn from_block(mut self, block: self::ethcontract::BlockNumber) -> Self {
self.0 = (self.0).from_block(block);
self
}
#[doc = r" Sets the last block from which to stream logs for."]
#[doc = r""]
#[doc = r" If left unset defaults to the streaming until the end of days."]
#[allow(clippy::wrong_self_convention)]
pub fn to_block(mut self, block: self::ethcontract::BlockNumber) -> Self {
self.0 = (self.0).to_block(block);
self
}
#[doc = r" Limit the number of events that can be retrieved by this filter."]
#[doc = r""]
#[doc = r" Note that this parameter is non-standard."]
pub fn limit(mut self, value: usize) -> Self {
self.0 = (self.0).limit(value);
self
}
#[doc = r" The polling interval. This is used as the interval between"]
#[doc = r" consecutive `eth_getFilterChanges` calls to get filter updates."]
pub fn poll_interval(mut self, value: std::time::Duration) -> Self {
self.0 = (self.0).poll_interval(value);
self
}
#[doc = "Adds a filter for the from event parameter."]
pub fn from(mut self, topic: self::ethcontract::Topic<self::ethcontract::Address>) -> Self {
self.0 = (self.0).topic0(topic);
self
}
#[doc = "Adds a filter for the to event parameter."]
pub fn to(mut self, topic: self::ethcontract::Topic<self::ethcontract::Address>) -> Self {
self.0 = (self.0).topic1(topic);
self
}
#[doc = r" Returns a future that resolves with a collection of all existing"]
#[doc = r" logs matching the builder parameters."]
pub async fn query(
self,
) -> std::result::Result<
std::vec::Vec<self::ethcontract::Event<self::event_data::Transfer>>,
self::ethcontract::errors::EventError,
> {
(self.0).query().await
}
#[doc = r" Creates an event stream from the current event builder."]
pub fn stream(
self,
) -> impl self::ethcontract::futures::stream::Stream<
Item = std::result::Result<
self::ethcontract::StreamEvent<self::event_data::Transfer>,
self::ethcontract::errors::EventError,
>,
> {
(self.0).stream()
}
}
#[doc = "A builder for creating a filtered stream of `Approval` events."]
pub struct ApprovalBuilder(
#[doc = r" The inner event builder."]
pub self::ethcontract::dyns::DynEventBuilder<self::event_data::Approval>,
);
impl ApprovalBuilder {
#[doc = r" Sets the starting block from which to stream logs for."]
#[doc = r""]
#[doc = r" If left unset defaults to the latest block."]
#[allow(clippy::wrong_self_convention)]
pub fn from_block(mut self, block: self::ethcontract::BlockNumber) -> Self {
self.0 = (self.0).from_block(block);
self
}
#[doc = r" Sets the last block from which to stream logs for."]
#[doc = r""]
#[doc = r" If left unset defaults to the streaming until the end of days."]
#[allow(clippy::wrong_self_convention)]
pub fn to_block(mut self, block: self::ethcontract::BlockNumber) -> Self {
self.0 = (self.0).to_block(block);
self
}
#[doc = r" Limit the number of events that can be retrieved by this filter."]
#[doc = r""]
#[doc = r" Note that this parameter is non-standard."]
pub fn limit(mut self, value: usize) -> Self {
self.0 = (self.0).limit(value);
self
}
#[doc = r" The polling interval. This is used as the interval between"]
#[doc = r" consecutive `eth_getFilterChanges` calls to get filter updates."]
pub fn poll_interval(mut self, value: std::time::Duration) -> Self {
self.0 = (self.0).poll_interval(value);
self
}
#[doc = "Adds a filter for the owner event parameter."]
pub fn owner(mut self, topic: self::ethcontract::Topic<self::ethcontract::Address>) -> Self {
self.0 = (self.0).topic0(topic);
self
}
#[doc = "Adds a filter for the spender event parameter."]
pub fn spender(
mut self,
topic: self::ethcontract::Topic<self::ethcontract::Address>,
) -> Self {
self.0 = (self.0).topic1(topic);
self
}
#[doc = r" Returns a future that resolves with a collection of all existing"]
#[doc = r" logs matching the builder parameters."]
pub async fn query(
self,
) -> std::result::Result<
std::vec::Vec<self::ethcontract::Event<self::event_data::Approval>>,
self::ethcontract::errors::EventError,
> {
(self.0).query().await
}
#[doc = r" Creates an event stream from the current event builder."]
pub fn stream(
self,
) -> impl self::ethcontract::futures::stream::Stream<
Item = std::result::Result<
self::ethcontract::StreamEvent<self::event_data::Approval>,
self::ethcontract::errors::EventError,
>,
> {
(self.0).stream()
}
}
}
impl Contract {
#[doc = r" Returns a log stream with all events."]
pub fn all_events(&self) -> self::ethcontract::dyns::DynAllEventsBuilder<Event> {
self::ethcontract::dyns::DynAllEventsBuilder::new(
self.raw_instance().web3(),
self.address(),
self.deployment_information(),
)
}
}
#[doc = r" A contract event."]
#[derive(Clone, Debug, Eq, PartialEq, serde :: Deserialize, serde :: Serialize)]
pub enum Event {
Approval(self::event_data::Approval),
Transfer(self::event_data::Transfer),
}
impl self::ethcontract::contract::ParseLog for Event {
fn parse_log(
log: self::ethcontract::RawLog,
) -> Result<Self, self::ethcontract::errors::ExecutionError> {
let standard_event = log . topics . get (0) . copied () . map (| topic | match topic { self :: ethcontract :: H256 ([140 , 91 , 225 , 229 , 235 , 236 , 125 , 91 , 209 , 79 , 113 , 66 , 125 , 30 , 132 , 243 , 221 , 3 , 20 , 192 , 247 , 178 , 41 , 30 , 91 , 32 , 10 , 200 , 199 , 195 , 185 , 37]) => Ok (Event :: Approval (log . clone () . decode (Contract :: artifact () . abi . event ("Approval") . expect ("generated event decode")) ?)) , self :: ethcontract :: H256 ([221 , 242 , 82 , 173 , 27 , 226 , 200 , 155 , 105 , 194 , 176 , 104 , 252 , 55 , 141 , 170 , 149 , 43 , 167 , 241 , 99 , 196 , 161 , 22 , 40 , 245 , 90 , 77 , 245 , 35 , 179 , 239]) => Ok (Event :: Transfer (log . clone () . decode (Contract :: artifact () . abi . event ("Transfer") . expect ("generated event decode")) ?)) , _ => Err (self :: ethcontract :: errors :: ExecutionError :: from (self :: ethcontract :: common :: abi :: Error :: InvalidData)) , }) ;
if let Some(Ok(data)) = standard_event {
return Ok(data);
}
Err(self::ethcontract::errors::ExecutionError::from(
self::ethcontract::common::abi::Error::InvalidData,
))
}
}
}
pub use self::erc20_preset_fixed_supply::Contract as ERC20PresetFixedSupply;