Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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: 0 additions & 9 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
scarb 2.8.2
starknet-foundry









8 changes: 4 additions & 4 deletions src/escrow/escrow_contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ mod EscrowContract {
Event::EscrowRefunded(
EscrowRefunded {
escrow_id, depositor, amount, timestamp: get_block_timestamp(),
}
)
},
),
);
}

Expand Down Expand Up @@ -301,14 +301,14 @@ mod EscrowContract {
isCompleted: false,
isApprovedDepositor: false,
isApprovedBeneficiary: false,
isPaid: false
isPaid: false,
};

self.milestones.write(milestone_id, milestone)
}

fn request_milestone_payment(
ref self: ContractState, id: u64, token_address: ContractAddress
ref self: ContractState, id: u64, token_address: ContractAddress,
) -> bool {
let mut milestone: Milestone = self.milestones.read(id);

Expand Down
18 changes: 2 additions & 16 deletions src/escrow/escrow_factory.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,7 @@ pub use starknet::{
ContractAddress, class_hash::ClassHash, syscalls::deploy_syscall, SyscallResultTrait,
};
use escrownet_contract::interface::iescrow::{IEscrowDispatcher, IEscrowDispatcherTrait};

#[starknet::interface]
pub trait IEscrowFactory<TContractState> {
fn deploy_escrow(
ref self: TContractState,
beneficiary: ContractAddress,
depositor: ContractAddress,
arbiter: ContractAddress,
salt: felt252,
milestone_description: ByteArray,
milestone_amount: u256,
milestone_dueDate: u256,
) -> ContractAddress;

fn get_escrow_contracts(self: @TContractState) -> Array<ContractAddress>;
}
use escrownet_contract::interface::iescrowfactory::{IEscrowFactory};

#[starknet::component]
pub mod EscrowFactory {
Expand All @@ -29,6 +14,7 @@ pub mod EscrowFactory {
ContractAddress, class_hash::ClassHash, syscalls::deploy_syscall, SyscallResultTrait,
storage::{Map},
};

use core::traits::{TryInto, Into};

const ESCROW_CONTRACT_CLASS_HASH: felt252 =
Expand Down
2 changes: 1 addition & 1 deletion src/escrownet/escrownet.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub mod Escrownet {
#[event]
#[derive(Drop, starknet::Event)]
enum Event {
EscrowFactoryEvent: EscrowFactory::Event
EscrowFactoryEvent: EscrowFactory::Event,
}

#[storage]
Expand Down
1 change: 1 addition & 0 deletions src/interface.cairo
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod iescrow;
pub mod ierc20;
pub mod iescrowfactory;
6 changes: 2 additions & 4 deletions src/interface/iescrow.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ pub trait IEscrow<TContractState> {
provider_address: ContractAddress,
amount: u256,
);
fn add_milestone(
ref self: TContractState, description: ByteArray, amount: u256, dueDate: u256,
);
fn add_milestone(ref self: TContractState, description: ByteArray, amount: u256, dueDate: u256);
fn request_milestone_payment(
ref self: TContractState, id: u64, token_address: ContractAddress
ref self: TContractState, id: u64, token_address: ContractAddress,
) -> bool;
fn get_escrow_details(ref self: TContractState, escrow_id: u64) -> Escrow;
fn get_depositor(self: @TContractState) -> ContractAddress;
Expand Down
17 changes: 17 additions & 0 deletions src/interface/iescrowfactory.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use starknet::ContractAddress;

#[starknet::interface]
pub trait IEscrowFactory<TContractState> {
fn deploy_escrow(
ref self: TContractState,
beneficiary: ContractAddress,
depositor: ContractAddress,
arbiter: ContractAddress,
salt: felt252,
milestone_description: ByteArray,
milestone_amount: u256,
milestone_dueDate: u256,
) -> ContractAddress;

fn get_escrow_contracts(self: @TContractState) -> Array<ContractAddress>;
}