Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide uint256 param to GenericScheme GenericCall #620

Closed
dkent600 opened this issue Apr 5, 2019 · 9 comments
Closed

provide uint256 param to GenericScheme GenericCall #620

dkent600 opened this issue Apr 5, 2019 · 9 comments

Comments

@dkent600
Copy link
Contributor

dkent600 commented Apr 5, 2019

Feature request: GenericScheme allows us to create proposals that result, upon execute, in calling a function on another contract. The function is defined by the contract address and the ABI-encoded definition of the function.

A given instance of GenericScheme is configured, when deployed, with a single contract address on which to invoke functions. From that contract, each GenericScheme proposal may specify a function (ABI) that will be invoked upon GenericScheme.execute. Each proposal may also specify an ETH amount to transfer to the contract when the funciton is invoked.

However, when creating proposals, it is not possible to specify parameters that may be passed to the contract function. Just a single uint256 parameter could provide the contract with context that informs the contract function about what to do when it is invoked.

Without such contextual information, a given contract function knows not why it is being invoked, beyond the single dimension of having been invoked.

A use-case I have in mind is a contract function to which we may pass a proposalId that is provided to the GenericScheme proposal upon creation of the GenericScheme proposal. This proposalId param would identify proposals on other schemes in the DAO, for example, ContributionReward. Perhaps the invoked contract would use that proposalId to implement multi-target rewards, reward escrows, or deal with proposals that have been voted to be malicious.

Or course, the uint256 param needn't identify a proposalId, but could be an address or anything else that would fit within that size.

@dkent600 dkent600 changed the title provide proposalId in GenerScheme GenericCall provide uint256 param to GenericScheme GenericCall Apr 5, 2019
@dkent600
Copy link
Contributor Author

dkent600 commented Apr 5, 2019

The param would be automatically supportable by dApp GUIs such as Alchemy, without requiring any custom code.

@orenyodfat
Copy link
Contributor

if the invoked contract would like to get some additional param it should define that on its function params. what we are missing here ?

@dkent600
Copy link
Contributor Author

dkent600 commented Apr 6, 2019

if the invoked contract would like to get some additional param it should define that on its function params. what we are missing here ?

The idea is that GenericScheme would pass the value of the additional uint256 param to the invoked contract function. This value would vary from GenericScheme proposal to proposal -- it is passed to GenericScheme when each proposal is created.

@orenyodfat
Copy link
Contributor

orenyodfat commented Apr 6, 2019 via email

@dkent600
Copy link
Contributor Author

dkent600 commented Apr 6, 2019

If the invoked contract needs some additional param it should
define it in its function abi params

How do you propose that the contract receive the param value? I am not aware that an ABI can specify parameter values. Am I wrong?

@orenyodfat
Copy link
Contributor

orenyodfat commented Apr 6, 2019 via email

@dkent600
Copy link
Contributor Author

dkent600 commented Apr 6, 2019

  1. I am trying to design a GenesisScheme that can be registered with the DAO and used in Alchemy without having to write any custom code in Alchemy.

  2. I am trying to avoid the user having to construct and submit an ABI

Asking the user to supply an ABI is very unfriendly. Asking the dApp, such as Alchemy, to hardcode arbitrary ABIs requires writing custom code for every GenericScheme.

I am asking to support just one additional parameter. I know it doesn't cover all cases, but it covers a lot of cases (I described three above). It is a lot better than the alternatives.

@A-Zak
Copy link

A-Zak commented Apr 7, 2019

It sounds to me like the beginning of generic scheme templates, with this being the first template - single Parma function...

@dkent600 - is that close enough, or am I missing anything? :)

@dkent600
Copy link
Contributor Author

dkent600 commented Apr 7, 2019

@A-Zak

The idea I proposed in this ticket is not viable. I didn't realize that one can supply param values in an ABI.

I woke up this morning with an idea for how to do this. Will close this ticket and describe the idea here.

@dkent600 dkent600 closed this as completed Apr 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants