File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7979 - run : anchor test
8080 - run : cargo fmt -- --check
8181 - 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 22members = [
33 " programs/*"
44]
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> {
4141 constraint = {
4242 params. dca_cycles > 0 &&
4343 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 ( )
4545 }
4646 ) ]
4747 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 {
5858 }
5959
6060 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" ) ;
6265 }
6366
6467 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 {
3535 }
3636
3737 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" ) ;
3939 }
4040
4141 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" ) ;
4343 }
4444
4545 pub fn update_twap (
You can’t perform that action at this time.
0 commit comments