diff --git a/depositor/depositor.did b/depositor/depositor.did new file mode 100644 index 0000000..633521a --- /dev/null +++ b/depositor/depositor.did @@ -0,0 +1,5 @@ +type Account = record { owner : principal; subaccount : opt vec nat8 }; +type DepositArg = record { to : Account; memo : opt vec nat8; cycles : nat }; +type DepositResult = record { balance : nat; txid : nat }; +type InitArg = record { ledger_id : principal }; +service : (InitArg) -> { deposit : (DepositArg) -> (DepositResult) } \ No newline at end of file diff --git a/depositor/src/main.rs b/depositor/src/main.rs index 366c008..bbda182 100644 --- a/depositor/src/main.rs +++ b/depositor/src/main.rs @@ -19,6 +19,7 @@ fn with_config(f: impl FnOnce(&Config) -> R) -> R { fn main() {} #[init] +#[candid_method(init)] fn init(arg: InitArg) { CONFIG.with(|cell| { *cell.borrow_mut() = Config { diff --git a/dfx.json b/dfx.json index 99196e9..2d19935 100644 --- a/dfx.json +++ b/dfx.json @@ -6,6 +6,13 @@ "package": "cycles-ledger", "optimize": "cycles", "gzip": true + }, + "cycles-depositor": { + "type": "rust", + "candid": "./depositor/depositor.did", + "package": "depositor", + "optimize": "cycles", + "gzip": true } } }