Skip to content

Commit 8a66a12

Browse files
authored
Merge pull request #51 from OWK50GA/feat/implement-creator-payout
Feat: Implement Creator Payout Workflow
2 parents 49d30ed + c13dacc commit 8a66a12

6 files changed

Lines changed: 1225 additions & 16 deletions

File tree

.tool-versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
scarb 2.11.4
2-
starknet-foundry 0.43.1
1+
scarb 2.11.2
2+
sstarknet-foundry 0.40.0

src/base/types.cairo

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,63 @@ pub struct Purchase {
148148
pub timeout_expiry: u64,
149149
}
150150

151+
#[derive(Copy, Serde, Drop, PartialEq, Debug, starknet::Store)]
152+
pub enum PayoutStatus {
153+
#[default]
154+
PENDING,
155+
PAID,
156+
CANCELLED,
157+
}
158+
159+
#[derive(Copy, Drop, Serde, starknet::Store, PartialEq, Debug)]
160+
pub struct Payout {
161+
pub id: u64,
162+
pub purchase_id: u256,
163+
pub recipient: ContractAddress,
164+
pub amount: u256,
165+
pub timestamp: u64,
166+
pub status: PayoutStatus,
167+
}
168+
169+
#[derive(Copy, Drop, Serde, Default, PartialEq, starknet::Store)]
170+
pub struct PayoutSchedule {
171+
pub interval: u64, //interval between payouts, same type as block_timestamp
172+
pub start_time: u64,
173+
pub last_execution: u64,
174+
// pub schedule_id: u256,
175+
}
176+
177+
#[allow(starknet::store_no_default_variant)]
178+
#[derive(Copy, Drop, Serde, starknet::Store, PartialEq)]
179+
pub enum RefundRequestReason {
180+
CONTENT_NOT_RECEIVED,
181+
DUPLICATE_PURCHASE,
182+
UNABLE_TO_ACCESS,
183+
MISREPRESENTED_CONTENT,
184+
OTHER: felt252,
185+
}
186+
187+
#[derive(Copy, Drop, Serde, starknet::Store, PartialEq)]
188+
pub enum RefundStatus {
189+
#[default]
190+
PENDING,
191+
TIMED_OUT,
192+
DECLINED,
193+
APPROVED,
194+
PAID,
195+
}
196+
197+
#[derive(Copy, Drop, Serde, starknet::Store, PartialEq)]
198+
pub struct Refund {
199+
pub refund_id: u64,
200+
pub purchase_id: u256,
201+
pub reason: RefundRequestReason,
202+
pub user: ContractAddress,
203+
pub status: RefundStatus,
204+
pub request_timestamp: u64,
205+
pub refund_amount: Option<u256>,
206+
}
207+
151208

152209
#[derive(Drop, Serde, starknet::Store, Debug)]
153210
pub enum ReceiptStatus {

0 commit comments

Comments
 (0)