Skip to content

Latest commit

 

History

History
34 lines (21 loc) · 1 KB

10-unused-arguments.md

File metadata and controls

34 lines (21 loc) · 1 KB

Unused Arguments

Description

If you know that a parameter passed to a function will not be used, remove it. This will optimize the contract's code and reduce gas.

Exploit Scenario

(define-read-only (tally-votes (member principal))
	(fold tally (var-get members) u0)
)

The vulnerable code example can be found here.

Remediation

(define-read-only (tally-votes)
	(fold tally (var-get members) u0)
)

The remediated code example can be found here.