Skip to content

Conversation

piobab
Copy link
Collaborator

@piobab piobab commented Jul 25, 2023

Split execute to smaller rust files (make more consistent with newer Rover codebase and to be able to add unit test close to tested execute msg).

This PR only rearrange - no changes to original codebase. Refactor will come in smaller PR indepently.

@piobab piobab requested review from brimigs, grod220 and larry0x July 25, 2023 15:50
Copy link
Contributor

@grod220 grod220 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yesssss

@larry0x
Copy link
Contributor

larry0x commented Jul 25, 2023

I suggest we make an src/execute folder:

.
└── src/
    ├── execute/
    │   ├── asset.rs
    │   ├── borrow.rs
    │   ├── collateral.rs
    │   ├── config.rs
    │   ├── deposit.rs
    │   ├── instantiate.rs
    │   ├── mod.rs
    │   ├── repay.rs
    │   ├── uncollateralized_loan.rs
    │   └── withdraw.rs
    ├── contract.rs
    ├── lib.rs
    ├── query.rs
    └── state.rs

and in execute/mod.rs we do:

mod asset;
mod borrow;
mod collateral;
mod config;
mod deposit;
mod instantiate;
mod repay;
mod uncollateralized_loan;
mod withdraw;

pub use {
    asset::*, borrow::*, collateral::*, config::*, deposit::*,
    instantiate::*, repay::*, uncollateralized_loan::*, withdraw::*,
};

This way, in contract.rs we can still use execute::deposit, etc.

I believe this is also how it's organized in Rover repo.

@piobab
Copy link
Collaborator Author

piobab commented Jul 25, 2023

I suggest we make an src/execute folder:

.
└── src/
    ├── execute/
    │   ├── asset.rs
    │   ├── borrow.rs
    │   ├── collateral.rs
    │   ├── config.rs
    │   ├── deposit.rs
    │   ├── instantiate.rs
    │   ├── mod.rs
    │   ├── repay.rs
    │   ├── uncollateralized_loan.rs
    │   └── withdraw.rs
    ├── contract.rs
    ├── lib.rs
    ├── query.rs
    └── state.rs

and in execute/mod.rs we do:

mod asset;
mod borrow;
mod collateral;
mod config;
mod deposit;
mod instantiate;
mod repay;
mod uncollateralized_loan;
mod withdraw;

pub use {
    asset::*, borrow::*, collateral::*, config::*, deposit::*,
    instantiate::*, repay::*, uncollateralized_loan::*, withdraw::*,
};

This way, in contract.rs we can still use execute::deposit, etc.

I believe this is also how it's organized in Rover repo.

nice! Rover has in the same directory. I think for now better to keep it similar so it doesn't influence others to different way of doing something (we can then rearrange everything in one go).

@piobab piobab merged commit cf28835 into develop Jul 25, 2023
@piobab piobab deleted the split-execute branch July 25, 2023 18:21
brimigs pushed a commit that referenced this pull request Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants