Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat add new asserts to set reason #268

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion contracts/src/fund.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,16 @@ pub mod Fund {
fn get_name(self: @ContractState) -> ByteArray {
return self.name.read();
}
// Added a new assert to the set_reason method
EmmanuelAR marked this conversation as resolved.
Show resolved Hide resolved
fn set_reason(ref self: ContractState, reason: ByteArray) {
let caller = get_caller_address();
assert!(self.owner.read() == caller, "You are not the owner");
let valid_address_1 = contract_address_const::<FundManagerConstants::VALID_ADDRESS_1>();
EmmanuelAR marked this conversation as resolved.
Show resolved Hide resolved
let valid_address_2 = contract_address_const::<FundManagerConstants::VALID_ADDRESS_2>();
assert!(
valid_address_1 == caller || valid_address_2 == caller,
"You are not an Admin."
);
self.reason.write(reason);
}
fn get_reason(self: @ContractState) -> ByteArray {
Expand Down Expand Up @@ -287,4 +294,4 @@ pub mod Fund {
}
}
}
}
}