File tree 5 files changed +48
-4
lines changed
5 files changed +48
-4
lines changed Original file line number Diff line number Diff line change 79
79
- run : anchor test
80
80
- run : cargo fmt -- --check
81
81
- run : yarn run prettier --c ./
82
+
83
+ audit :
84
+ runs-on : ubuntu-latest
85
+ needs : [build-cli-deps]
86
+ steps :
87
+ - id : cache-cli-deps
88
+ uses : actions/cache@v2
89
+ with :
90
+ key : $${{ env.cli-id }}
91
+ path : |
92
+ ~/.local/share/solana
93
+ ~/.cargo
94
+ ~/.rustup
95
+ ~/.cargo/bin/anchor
96
+
97
+ - run : echo "PATH=$HOME/.local/share/solana/install/active_release/bin:$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV
98
+
99
+ - uses : actions/setup-node@v2
100
+ with :
101
+ node-version : ' 16'
102
+
103
+ - name : Check-out the repository
104
+ uses : actions/checkout@v2
105
+
106
+ - name : Soteria Audit
107
+ continue-on-error : false
108
+ uses : silas-x/soteria-action@main
109
+ with :
110
+ solana-version : " 1.10.5"
111
+ run-mode : " -analyzeAll"
112
+ cargo-com : " ."
113
+ program-path : " programs/dca-vault"
Original file line number Diff line number Diff line change 2
2
members = [
3
3
" programs/*"
4
4
]
5
+
6
+ [profile .dev ]
7
+ overflow-checks = true
8
+ [profile .release ]
9
+ overflow-checks = true
10
+ [profile .test ]
11
+ overflow-checks = true
12
+ [profile .bench ]
13
+ overflow-checks = true
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ pub struct Deposit<'info> {
41
41
constraint = {
42
42
params. dca_cycles > 0 &&
43
43
vault_period_end. period_id > 0 &&
44
- vault_period_end. period_id == vault. last_dca_period + params. dca_cycles
44
+ vault_period_end. period_id == vault. last_dca_period. checked_add ( params. dca_cycles) . unwrap ( )
45
45
}
46
46
) ]
47
47
pub vault_period_end : Box < Account < ' info , VaultPeriod > > ,
Original file line number Diff line number Diff line change @@ -58,7 +58,10 @@ impl<'info> Vault {
58
58
}
59
59
60
60
pub fn increase_drip_amount ( & mut self , extra_drip : u64 ) {
61
- self . drip_amount += extra_drip;
61
+ self . drip_amount = self
62
+ . drip_amount
63
+ . checked_add ( extra_drip)
64
+ . expect ( "overflow drip amount" ) ;
62
65
}
63
66
64
67
pub fn decrease_drip_amount ( & mut self , position_drip : u64 ) {
Original file line number Diff line number Diff line change @@ -35,11 +35,11 @@ impl VaultPeriod {
35
35
}
36
36
37
37
pub fn increase_drip_amount_to_reduce ( & mut self , extra_drip : u64 ) {
38
- self . dar += extra_drip;
38
+ self . dar = self . dar . checked_add ( extra_drip) . expect ( "dar overflow" ) ;
39
39
}
40
40
41
41
pub fn decrease_drip_amount_to_reduce ( & mut self , position_drip : u64 ) {
42
- self . dar = self . dar . checked_sub ( position_drip) . unwrap ( ) ;
42
+ self . dar = self . dar . checked_sub ( position_drip) . expect ( "dar underflow" ) ;
43
43
}
44
44
45
45
pub fn update_twap (
You can’t perform that action at this time.
0 commit comments