Last active
January 17, 2025 11:27
-
-
Save shuangjj/ae816cacffce3a27e256de7c21312c50 to your computer and use it in GitHub Desktop.
Hi,
I found that this definition could miss functions in a specific format.
I have a demo that could be used to test it:
enum PARAMETER { VESTING, PAYOUT, FEE, DEBT }
function setBondTerms ( PARAMETER _parameter, uint _input ) external onlyPolicy() {
if ( _parameter == PARAMETER.VESTING ) { // 0
require( _input >= 10000, "Vesting must be longer than 36 hours" );
terms.vestingTerm = _input;
} else if ( _parameter == PARAMETER.PAYOUT ) { // 1
require( _input <= 1000, "Payout cannot be above 1 percent" );
terms.maxPayout = _input;
} else if ( _parameter == PARAMETER.FEE ) { // 2
require( _input <= 10000, "DAO fee cannot exceed payout" );
terms.fee = _input;
} else if ( _parameter == PARAMETER.DEBT ) { // 3
terms.maxDebt = _input;
}
}
function setAdjustment (
bool _addition,
uint _increment,
uint _target,
uint _buffer
) external onlyPolicy() {
require( _increment <= terms.controlVariable.mul( 25 ).div( 1000 ), "Increment too large" );
adjustment = Adjust({
add: _addition,
rate: _increment,
target: _target,
buffer: _buffer,
lastBlock: block.number
});
}
function setStaking( address _staking, bool _helper ) external onlyPolicy() {
require( _staking != address(0) );
if ( _helper ) {
useHelper = true;
stakingHelper = _staking;
} else {
useHelper = false;
staking = _staking;
}
}
Two of the function cannot be identified correctly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
This works great but also picks up function and event keywords from comments.
Updating to these should fix it: