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

Add Safe modules configuration #112

Merged
merged 15 commits into from
Oct 1, 2020
Merged

Add Safe modules configuration #112

merged 15 commits into from
Oct 1, 2020

Conversation

germartinez
Copy link
Member

Check #89

The following methods won't be added for now until the new CPKFactory contract is available:

  • transfer ETH out of the GnosisSafeProxy: cpk.transfer(destination, amountInWei)
  • send ETH along with execTransactions: cpk.execTransactions(txs, {value})

Copy link
Contributor

@cag cag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be necessary, considering execTransactions already makes this possible?

src/CPK.ts Outdated
}
const modules = await this.#contract.call('getModules', [])
const selectedModules = modules.filter(
(mod: Address) => mod.toLowerCase() === moduleAddress.toLocaleLowerCase()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An address is a string, so just toLowerCase() should be fine? I don't think there's a difference though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! It was the VSCode autocomplete. Thank you!

src/CPK.ts Outdated
const sendOptions = normalizeGasLimit({ ...options, from: ownerAccount })
const txResult = await this.#contract.send('enableModule', [moduleAddress], {
...sendOptions,
from: ownerAccount
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think enableModule follows the rule for SelfAuthorized:

require(msg.sender == address(this), "Method can only be called from this contract");

So essentially you would use execTransaction to call it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm updating this and pushing the tests :)

@germartinez germartinez changed the base branch from txhash-safeapp to development September 30, 2020 18:31
@germartinez germartinez changed the title New CPK methods Add Safe modules configuration Sep 30, 2020
@germartinez germartinez force-pushed the cpk-methods branch 2 times, most recently from 1a2ef4c to 363b040 Compare September 30, 2020 22:41
@germartinez germartinez requested a review from rmeissner October 1, 2020 10:21
return await this.#contract.call('getModules', [])
}

async isModuleEnabled(moduleAddress: Address): Promise<boolean> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.2.0 has a contract method for this ;)

@germartinez germartinez merged commit 46a1895 into development Oct 1, 2020
@germartinez germartinez deleted the cpk-methods branch October 1, 2020 10:34
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

Successfully merging this pull request may close these issues.

3 participants