Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

(Feature) Spending Limit#1351

Closed
fernandomg wants to merge 185 commits intodevelopmentfrom
feature/#413-SpendingLimit-in-app
Closed

(Feature) Spending Limit#1351
fernandomg wants to merge 185 commits intodevelopmentfrom
feature/#413-SpendingLimit-in-app

Conversation

@fernandomg
Copy link
Contributor

@fernandomg fernandomg commented Sep 11, 2020

This PR closes #413, by:

  • supporting Spending Limits module as a Safe's feature
  • Allowing to add/edit/remove a beneficiary
  • Identifying and listing Spending Limit transactions in the transactions table

NOTE:
Before merging this feature, we need to remove the hardcoded address in constants.ts file and set the global variable REACT_APP_SPENDING_LIMIT_MODULE_ADDRESS to the audited module address.


How to test

  • "Allowances" was replaced by "Spending Limit"
  • Consider that feature mockups were made way before the new Safe's designs, so there will be differences.

This is an ordered list of the feature's sub-tasks.
Implementation details are in the PRs description.

task issue PR important feedback
Spending Limit Settings tab #689 #1151 #1151 (comment)
#1151 (comment)
New Spending Limit #690 #1218
Remove Spending Limit #692 #1261
List of Spending Limit #1039 #1261 #1261 (comment)
#1261 (comment)
Send funds #693 #1276 #1276 (comment)
#1276 (comment)
Transaction list #691 #1271 #1271 (comment)


What this feature adds to the safe:

Spending Limit as a Setting option

image

New Spending Limit

setup review listing beneficiaries
image image image

Identify Spending Limit Transactions

first ever spending limit new beneficiary already known beneficiary
image image image
Action 1: Enable Module
Action 2: Add Beneficiary
Action 3: Set the Spending Limit
Action 1: Add Beneficiary
Action 2: Set the Spending Limit
Set the Spending Limit

Use the Spending Limit allowance

send transaction details
image image

- marked `isValid` as optional, with default `true` value
- marked `initialValue` as optional
- migrated to hooks for material-ui styles
- migrated to hooks for material-ui styles
- make `label` parametrized and optional, with default value
- make `setIsValidAddress` optional
- migrated to hooks for material-ui styles
…w-SpendingLimit

# Conflicts:
#	src/routes/safe/components/Apps/index.tsx
Also:
- fixed styles
- handled form state while going back and forth between create and review
- had to change `Review` Button as submitting wasn't triggered on the first click.
- also refactored `ScanQRWrapper` so it uses the specified icon
…w-SpendingLimit

# Conflicts:
#	package.json
#	src/routes/safe/components/Apps/index.tsx
#	yarn.lock
- if the module is not enabled it will be enabled on the first tx
- beneficiary is added to the delegate list in the contract
- allowance is set

Still several things to address, like informing the user about an existing allowance, code cleanup
- create
- verify existent and inform the user
@fernandomg
Copy link
Contributor Author

Upgraded the AllowanceModule address.

Added support to deleteAllowance method.

And also, identified the Delete Spending Limit tx in the following way:

deleted spending limit

@ghost
Copy link

ghost commented Oct 28, 2020

Travis automatic deployment:
https://pr1351--safereact.review.gnosisdev.com/app

1 similar comment
@ghost
Copy link

ghost commented Oct 28, 2020

Travis automatic deployment:
https://pr1351--safereact.review.gnosisdev.com/app

- this commit attempts to organize a bit the SpendingLimit code
- most of the logic was moved to `src/logic/safe/utils/spendingLimits`
@ghost
Copy link

ghost commented Oct 29, 2020

Travis automatic deployment:
https://pr1351--safereact.review.gnosisdev.com/rinkeby/app

@ghost
Copy link

ghost commented Oct 30, 2020

Travis automatic deployment:
https://pr1351--safereact.review.gnosisdev.com/rinkeby/app

@github-actions
Copy link

github-actions bot commented Nov 2, 2020

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 12 0
Ignored 5 N/A
  • Result: ✅ success

  • Annotations: 12 total


[warning] @typescript-eslint/explicit-module-boundary-types

Require explicit return and argument types on exported functions' and classes' public class methods


[warning] @typescript-eslint/no-non-null-assertion

Disallows non-null assertions using the ! postfix operator


Report generated by eslint-plus-action

@ghost
Copy link

ghost commented Nov 2, 2020

Travis automatic deployment:
https://pr1351--safereact.review.gnosisdev.com/rinkeby/app

# Conflicts:
#	src/logic/contracts/methodIds.ts
#	src/logic/safe/store/actions/createTransaction.ts
#	src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.tsx
#	src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.tsx
@ghost
Copy link

ghost commented Nov 9, 2020

Travis automatic deployment:
https://pr1351--safereact.review.gnosisdev.com/volta/app

@ghost
Copy link

ghost commented Nov 9, 2020

Travis automatic deployment:
https://pr1351--safereact.review.gnosisdev.com/rinkeby/app

1 similar comment
@ghost
Copy link

ghost commented Nov 9, 2020

Travis automatic deployment:
https://pr1351--safereact.review.gnosisdev.com/rinkeby/app

@ghost
Copy link

ghost commented Nov 9, 2020

Travis automatic deployment:
https://pr1351--safereact.review.gnosisdev.com/volta/app

…on`X' before initialization`

by reorganizing selectors
this is a WIP. Typings missing and some refactor around spending limit values usage.
# Conflicts:
#	src/logic/safe/store/models/types/transactions.d.ts
#	src/logic/safe/store/selectors/index.ts
#	src/routes/safe/components/Balances/SendModal/screens/AddressBookInput/index.tsx
#	src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/SendCustomTx/index.tsx
#	src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.tsx
#	src/routes/safe/components/Settings/ManageOwners/AddOwnerModal/screens/OwnerForm/index.tsx
#	src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.tsx
#	src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/OwnerForm/index.tsx
#	src/routes/safe/components/Transactions/TxsTable/ExpandedTx/TxDescription/TransferDescription.tsx
#	src/routes/safe/components/Transactions/TxsTable/ExpandedTx/TxDescription/index.tsx
#	src/routes/safe/components/Transactions/TxsTable/ExpandedTx/TxDescription/utils.ts
#	src/routes/safe/components/Transactions/TxsTable/columns.tsx
@github-actions
Copy link

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 30 0
Ignored 6 N/A
  • Result: ✅ success

  • Annotations: 30 total


[warning] @typescript-eslint/explicit-module-boundary-types

Require explicit return and argument types on exported functions' and classes' public class methods


[warning] @typescript-eslint/no-non-null-assertion

Disallows non-null assertions using the ! postfix operator


Report generated by eslint-plus-action

@fernandomg fernandomg closed this Nov 20, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 20, 2020
@fernandomg fernandomg deleted the feature/#413-SpendingLimit-in-app branch November 30, 2020 13:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spending Limits

4 participants