question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flip the contract function calls

See original GitHub issue
  • Version: 4

What was wrong?

The order of calls (contract.call().doSomething()) could be more intuitive.

How can it be fixed?

Basic Approach

web3.js seems to have a solid solution: contract.functions.method().call()

Plus:

  • ..method().transact()
  • ..method().estimateGas()
  • etc

This API can coexist alongside the old way of calling contract methods.

API Naming

functions is a little long, here are some other options:

  • contract.api.doSomething().call()
  • contract.public.doSomething().call()
  • contract.build.doSomething().call()
  • contract.make.doSomething().call()
  • contract.prep.doSomething().call()
  • contract.useabi.doSomething().call()
  • contract.go.doSomething().call()
  • contract.methods.doSomething().call() Added

Also, think about how the name will sound when used with other execution options, like transact, estimateGas, and buildTransaction

Requirements

  • add new API
  • document new API in docs/
  • add deprecation warning to old call/transact/etc methods
  • Bonus: Update ConciseContract to use the new Contract API under the hood (with no change to the external API)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:37 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
dylanjwcommented, Nov 24, 2017

Is anyone working on this? If not, I would like to give it a try.

1reaction
gitcoinbotcommented, Nov 15, 2017

This issue now has a funding of 0.335 ETH (110.39 USDT) attached to it. To view or claim this funding, click here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to call a payable function with no parameters?
For example, in web3.js to call the function you would simply do this and the transaction would go through: await contract.methods.
Read more >
Flipping a Coin in Ethereum
In this post, I'll describe how two parties can bet on a coin flip in an Ethereum smart contract by using a simple...
Read more >
Calling Parent Functions | Solidity 0.8 - YouTube
Two ways to call parent functions #Solidity #SmartContract #Ethereum #スマートコントラクトRemixhttps://remix.ethereum.
Read more >
How to use low level call for contract function ... - Kush's blog
delegatecall is used to call a function of contract B from contract A with contract A's storage, balance and address supplied to the...
Read more >
Ethernaut Lvl 3 Coin Flip Walkthrough: how to abuse ...
3. Call your hackFlip() function 10 times. The original contract's consecutiveWins counter should steadily increase, as you are only making ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found