Skip to content

Instantly share code, notes, and snippets.

@frozeman
Last active October 23, 2022 00:47
Show Gist options
  • Save frozeman/090ae32041bcfe120824 to your computer and use it in GitHub Desktop.
Save frozeman/090ae32041bcfe120824 to your computer and use it in GitHub Desktop.
Token proposal

This is outdated: The ERC-20 is here: ethereum/EIPs#20

Token

Methods

totalSupply

function totalSupply() constant returns (uint256 supply)

Get the total coin supply

balanceOf

function balanceOf(address _address) constant returns (uint256 balance)

Get the account balance of another account with address _address

transfer

function transfer(address _to, uint256 _value) returns (bool _success)

Send _value amount of coins to address _to

transferFrom

function transferFrom(address _from, address _to, uint256 _value) returns (bool success)

Send _value amount of coins from address _from to address _to

The transferFrom method is used for a "direct debit" workflow, allowing contracts to send coins on your behalf, for example to "deposit" to a contract address and/or to charge fees in sub-currencies; the command should fail unless the _from account has deliberately authorized the sender of the message via some mechanism; we propose these standardized APIs for approval:

approve

function approve(address _address) returns (bool success)

Allow _address to direct debit from your account with full custody. Only implement if absolutely required and use carefully. See approveOnce below for a more limited method.

unapprove

function unapprove(address _address) returns (bool success)

Unapprove address _address to direct debit from your account if it was previously approved. Must reset both one-time and full custody approvals.

isApprovedFor

function isApprovedFor(address _target, address _proxy) constant returns (bool success)

Returns 1 if _proxy is allowed to direct debit from _target

approveOnce

function approveOnce(address _address, uint256 _maxValue) returns (bool success)

Makes a one-time approval for _address to send a maximum amount of currency equal to _maxValue

isApprovedOnceFor

function isApprovedOnceFor(address _target, address _proxy) returns (uint256 maxValue)

Returns _maxValue if _proxy is allowed to direct debit the returned maxValue from address _target only once. The approval must be reset on any transfer by _proxy of _maxValue or less.

Events

Transfer

event Transfer(address indexed _from, address indexed _to, uint256 _value)

Triggered when tokens are transferred.

AddressApproval

event AddressApproval(address indexed _address, address indexed _proxy, bool _result)

Triggered when an _address approves _proxy to direct debit from their account.

AddressApprovalOnce

event AddressApprovalOnce(address indexed _address, address indexed _proxy, uint256 _value)

Triggered when an _address approves _proxy to direct debit from their account only once for a maximum of _value

@simondlr
Copy link

Would this allow proportional cashing of the cheque (such as what @vbuterin described)? ie, if a cheque is created, then you can cash the same one twice, as long as it still fits into the allotted value. So it should perhaps then more read:

function cashCheque(address _from, address _to, uint256 _value)

?

@frozeman
Copy link
Author

true

@tgerring
Copy link

A UI preview of this proposal is available at https://tgerring.github.io/abi2html-js/?SIGNATURE_GIST=090ae32041bcfe120824. You can ignore the "Could not connect to Ethereum client" message, as ABI-to-UI does not require a node.

@vbuterin
Copy link

Yeah, createCheque and cashCheque as above, plus transferCheque(address _from, address _to, uint256 _value) sounds good. In that case, we should probably remove the _to argument from cashCheque; generally, you can only cash cheques from your own bank account.

We probably also want getChequeValue(address _from, address _for). We then have a choice of whether we want to keep the value argument in cashCheque rather than simply only allowing cashing in 100% of whatever is in there. If we want to fully follow the cheque analogy, this triad seems most intuitive to me:

  • function createCheque(address _for, uint256 _maxValue)
  • function cashCheque(address _from)
  • function getChequeValue(address _from, address _for)

Question: does running createCheque twice add the value of the two cheques together? Are there legitimate use cases for creating a cheque multiple times and then cashing either once or multiple times?

@nmushegian
Copy link

All the functions that return uint should return (uint, bool) instead. You can easily make up scenarios where a 0 return value is ambiguous and significant. Is there any other simpler pattern for handling this?

@niran
Copy link

niran commented Nov 18, 2015

I think the value parameter is useful in cashCheque. It absolves callers from having to verify that the amount they needed was provided, and from having to refund amounts greater than what was needed. cashCheque would only succeed if the provided value was remaining in the cheque.

@niran
Copy link

niran commented Nov 18, 2015

Also, I think using createCheque(2**100) for the approve use case is going to lead to less clear code. It gets better if you make the magic number a constant, like createCheque(UNLIMITED_CHEQUE_VALUE), but lots of people won't do that. I think it's worth having a createBlankCheque or something for the approve scenario. Most tokens will use the TokenLib to handle all of the cheque logic, so it doesn't really make things worse for token authors.

@ethers
Copy link

ethers commented Nov 19, 2015

per obscuren's suggestion on Gitter, created this issue for further discussion
ethereum/EIPs#19

@caktux
Copy link

caktux commented Nov 19, 2015

I also think there is a problem with the terminology of cheques since they imply one-offs. Cheques are also unique, and here cheques wouldn't return unique IDs or anything; those are merely approval methods for transfers using internal bookkeeping. I think the current approve/transfer terminology is accurate and simple enough, instead of ending up with a mix of transfer and cashCheque. Would we change unapprove to tearCheque? There's also that ambiguity of cheques adding up, where approvals more clearly override a previous one.

In the use case described by Vitalik of contracts charging fees in subcurrencies, it could easily cost more to have to call approveOnce each time (if we replace the current approve method with it) than the actual fee in subcurrency. For that reason I think we should keep both approve and approveOnce, but we could add the _maxValue argument to the former, that way subscriptions or fees could be taken in multiple calls but only up to a certain amount. Another reason to keep the approval terminology, as I think it's much simpler to describe approve and approveOnce than some createMultiCheque and createCheque. Regarding isApprovedFor, it would have to return the approved amount if we do add _maxValue, just as isApprovedOnceFor does.

@frozeman I'd also like to discuss the addition of decimals, token name and symbol sooner than later. It could really simplify the task of getting a token's basic information into wallets and other dApps, and I think it does belong in a token's contract before a registry.

@frozeman
Copy link
Author

Its pretty hard to keep up with the agreement. I will move this discussion into an ERC in the comments and we can continue there. The advantage is that when we quote each other we get notified via email etc.

Cheque is a very british/american thing, so an european is not so familiar with the details about cheques. Though i thought it sounded a bit more clear than approve.

Please continue here: --------->>>>>>>>>>> ethereum/EIPs#20

@DrZainAzm
Copy link

Investor Protection Laws and Regulations, Securities Arbitration and Mediation, Financial Industry Regulatory Authority - Dispute Resolution, Claims and Fraud Awards 2020. Brief description of the provisions, Fraud Alert: USD $4,290,926.01 the amount of illegal migration in securities fraud practitioners. Refinish a resources for victims of Securities Law Violations and Personal Data Privacy Policy Acts 1974, facilitating quick responses to congressional requests for information and amendment of Securities Acts 1933-Federal Securities Law, Statute Compilations via the Office of the U.S. House of Representatives.

The defendants are found liable and to be responsible, the Attorney At Law must be committed to ensuring a fair and open process for making awards that those assets be distributed to harmed investors and ensure statutory requirements have been met and exceeded expectations of resources for victims of securities law violations acts 1933, Federal Securities Law –SEC.Gov, United States and six counts of aggravated identity-theft of crypto currency funds.

Attorney At Law should review each application to make sure that the information presented is reasonable, understandable, measurable, and achievable, as well as consistent and beyond the expectations of asking for a source of refinement for statutory formula awards requirement.

Six counts of aggravated identity-theft, six counts of filing false documentation for Ethereum-Blockchain Smart Contract account addresses and one count each of sign we are being hacked, e-mail's does not be delivered into the malicious alien receiver’s mail box, so that’s a bounces-back to sender transponder, mail flow settings a penetration detector’s devices and supported by trigger breakers to remove documentary evidence and resulted Non Delivery Report (NDR) fraud, access device fraud, and access to a protected computer in furtherance of fraud:

1). https://bloxy.info/address/0xed5a231ecc0fa775980ad7b86e49872feacd4c8f
Transaction Hash for smart contract account address transition; manually create and illegally edit "Date & Time-Stamp” for ‘BUY /SELL’ tokens fraud:
** (https://etherscan.io/vmtrace?txhash=0x99167c2758e51d5539c3a23d54ff40a74da9ccac3ca2c01ec36f807a8c130a69&type=parity) **

2). https://bloxy.info/address/0xD0AabcfDDBC5b17E403fF016375e27Dc2a8E3C18
Transaction Hash for smart contract account address transition; manually create and illegally edit "Date & Time-Stamp" for ‘BUY/SELL’ tokens fraud:
** (https://etherscan.io/vmtrace?txhash=0x367873973d95dc5a6926a7ce60125a2e767a8c3ffad2ed77f3d46850d17292f0&type=parity) **

3). https://bloxy.info/address/0x2a350c8429ff66b9446fcd12e148cd09438a1f00
Transaction Hash for smart contract account address transition; manually create and illegally edit "Date & Time-Stamp" for ‘BUY/SELL’ tokens fraud:
** (https://etherscan.io/vmtrace?txhash=0x4a638464a7f32c7038a42805534c0e1655e5b041da74a1e00c3c5f15e7866fe7&type=parity) **

4). https://bloxy.info/address/0xcfaf80b93b2c5a6adccceb382d022fcf2d5b2d24
Transaction Hash for smart contract account address transition; manually create and illegally edit "Date & Time-Stamp" for ‘BUY/SELL’ tokens fraud:
** (https://etherscan.io/vmtrace?txhash=0xbb9f1349181e650fda15811f136878a8c1116e96ea7455734b24763c700c5a2d&type=parity) **

5). https://bloxy.info/address/0x2ff2b86c156583b1135c584fd940a1996fa4230b
Transaction Hash for smart contract account address transition; manually create and illegally edit "Date & Time-Stamp" for ‘BUY/SELL’ tokens fraud:
** (https://etherscan.io/vmtrace?txhash=0xec1d5fceeec6e4eb79b831d1859f5b2a944548e0f872e9022c17194d020814e8&type=parity) **

6). https://etherscan.io/address/0x0000000000000000000000000000000000000000
** (Illegally migrating to the Ethereum Blockchain NEW registration account address documentation fraud.) **

Balance Ethereum Tokens: 8,400.238857870150803727
Ethereum Tokens Value: USD $4,290,926.01

That has not been adequately addressed, piracy and/or other 'red' flags related to all record found in the Parity VM Trace Transaction: "Type of Documentation Documentation - manually create fraud and illegally edit "Date & Time-Stamp" for 'BUY/SELL' token fraud and committed to a securities law violations Acts 1933, Federal Securities Laws -SEC.gov, United States.

We founded in the Parity VM Trace Transaction Fraud:
https://etherscan.io/vmtrace?txhash=0x99167c2758e51d5539c3a23d54ff40a74da9ccac3ca2c01ec36f807a8c130a69&type=parity

A total of 1 record found: "Type of Document - manually create and illegally edit "Date & Time-Stamp" is rapidly committed to security law violations act 1933.

Time-stamp: 698 days 10 hours ago manually edit in back-dated year of (2018-12-20 time-stamp 07:00:46 AM +UTC) fraud.

Truly we won the Super Jackpot Prizes in the year of (2019-02-20) - Lucky Bucks Token (LBT) 1,336,820,269 attribute value in USD $4,290,926.01

Date and time-stamp designed to be unlawful contained in the internet coordination Acts 2003 Geneva Declaration and
Data Protection Act 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment