celo-org / developer-tooling

🛠️ SDKs and CLI for interacting with Celo
Apache License 2.0
10 stars 6 forks source link

Support arbitrary token approvals (including from from Ledger device) #166

Open arthurgousset opened 8 months ago

arthurgousset commented 8 months ago

Component

@celo/celocli

Describe the feature you would like

Support arbitrary token approvals of the form token:approve --spender <EOA> --from <Ledger> --value <n> (this exact syntax is not verified, it's pseudocode).

Additional context

To make governance proposals, users have to make a 10,000 CELO deposit. To make this safer, we are making it possible to use a multisig with the celocli governance:propose command here:

While this multisigs are supported yet, some users are resorting to making the required deposit from EOAs created on a Ledger device. For example:

[I] use a personal ledger for a proposal, with a 10K celo deposit. cLabs owns the Celo, and I want to approve a cLabs address to be able to take the balance of my account at any moment. I need to call GoldToken.approve(cLabs address, maxInt)

Problem is, it is on a ledger with Celo derivation path, so I can’t use celoscan for this. Is there any tooling that would allow me to do this easily without me having to write a script?

Source: Slack

arthurgousset commented 8 months ago

Attempted solution with Celo Terminal + Celoscan that didn't work:

I think you can use Celo Terminal with WalletConnect Celoscan has WalletConnect support don’t use the Ledger option in the modal instead copy the URI and paste it in Celo terminal image

image

arthurgousset commented 8 months ago

Attempted solution with Foundry CLI:

I haven't tried this before, but maybe you could use Foundry cast call with the --ledger option. Ref: https://book.getfoundry.sh/reference/cast/cast-call image

Cast very likely won't work with the Celo Ledger app, but I'll try

Why do you need to use a Celo derived address and Celo Ledger app? Is that a requirement or preference?

it needs to be Celo derived because I’ll use that address with the cli to make a proposal

Unfortunately, Celo CLI + ledger only work with the Celo Ledger app, and not with the Ethereum ledger app.

Probably for another day, but I'm curious what it would take to make all governance and proposal related calls via Foundry. I expect there are quite a few of convenience functions that help under the hood in the Celo CLI, but curious if it's possible. My thinking is that we'd inherit all the lovely support, maintenance, and design work available via Foundry's CLI.

arthurgousset commented 8 months ago

The current work-around is to use a script that @martinvol wrote. When you have a moment, could you share some context on how you proposed CR11 in CGP 159 with your set up?

aaronmgdr commented 8 months ago

before we build this we def should think more about the siganture of the command.

aaronmgdr commented 8 months ago

while the original reason for this request was related to governance proposals the feature itself is very agnostic and general.

Once --muiltisig is supported for propose is this still needed for that specific use case

Is this the kind of general use feature we want to support?