The explorer is out of sync. The last synced block is 524 hours ago. Current block height: explorer: 2206528 / node: 2541536 / ref: 2492275

Program coffer_v001.aleo

Program ID
coffer_v001.aleo
Owner signature
sign14g0y88fvjtsrqcznustyjvrg53fa80d44x7tyfy84l2vmrgkqgqhf6a2342866ycvzgrnxjw2kr2yuthkg6v43mh70ayhtew6swkvqgvsqt8vlnqhwhfhz6k8lydp3m3tczq34g7aargtflukm8zm8ytq8qsu0etry0zvcnl22hfa2f2682zqccyf25c6yusgcrxyx5cvumscjcc75y
Times called
5
Similar programs
Imports
-
Mappings
wallet_exists (field -> boolean)
wallet_balances (field -> u128)
transfers (field -> TransferStatus)
registered_tokens (u64 -> TokenInfo)
Structs
WalletInfo
WalletBalanceKey
TransferStatus
TokenInfo
Records
WalletHolder
PendingTransfer
SignedTransfer
Token
Functions
-
Transitions
create_wallet3(address, address, address, u8, field) -> (WalletHolder, WalletHolder, WalletHolder) finalize(field)
create_transfer3(WalletHolder, u64, u128, address, field, field) -> (WalletHolder, PendingTransfer, PendingTransfer, PendingTransfer) finalize(field)
confirm_transfer(PendingTransfer) -> SignedTransfer finalize(field)
reject_transfer(PendingTransfer) -> SignedTransfer finalize(field)
execute_confirmed_transfer(SignedTransfer) -> (SignedTransfer, Token) finalize(field, u8, field, u128, field)
deposit(Token, u128, field) -> Token finalize(field, field, u128)
create_token(u64, u8, u128) -> () finalize(TokenInfo)
mint_private(address, u64, u128) -> Token finalize(u64)
Program Source Code (Aleo Instruction) Upload Leo source

program coffer_v001.aleo;

struct WalletInfo:
    wallet_id as field;
    holder1 as address;
    holder2 as address;
    holder3 as address;
    holder4 as address;
    holder5 as address;
    holder6 as address;
    holder7 as address;
    holder8 as address;
    holder9 as address;
    holder_count as u8;
    threshold as u8;

record WalletHolder:
    owner as address.private;
    owner_id as u8.private;
    wallet as WalletInfo.private;

record PendingTransfer:
    owner as address.private;
    transfer_id as field.private;
    creator as address.private;
    wallet as WalletInfo.private;
    token_id as u64.private;
    amount as u128.private;
    to_address as address.private;
    to_wallet_id as field.private;

record SignedTransfer:
    owner as address.private;
    transfer_id as field.private;
    creator as address.private;
    wallet as WalletInfo.private;
    token_id as u64.private;
    amount as u128.private;
    to_address as address.private;
    to_wallet_id as field.private;
    confirmed as boolean.private;

struct WalletBalanceKey:
    wallet_id as field;
    token_id as u64;

struct TransferStatus:
    confirmation_count as u8;
    rejection_count as u8;
    status as u8;

record Token:
    owner as address.private;
    amount as u128.private;
    token_id as u64.private;

struct TokenInfo:
    token_id as u64;
    max_supply as u128;
    decimals as u8;

mapping wallet_exists:
    key as field.public;
    value as boolean.public;

mapping wallet_balances:
    key as field.public;
    value as u128.public;

mapping transfers:
    key as field.public;
    value as TransferStatus.public;

mapping registered_tokens:
    key as u64.public;
    value as TokenInfo.public;

function create_wallet3:
    input r0 as address.private;
    input r1 as address.private;
    input r2 as address.private;
    input r3 as u8.private;
    input r4 as field.private;
    gt r3 0u8 into r5;
    lte r3 3u8 into r6;
    and r5 r6 into r7;
    assert.eq r7 true;
    is.neq r0 r1 into r8;
    assert.eq r8 true;
    cast r4 r0 r1 r2 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc 3u8 r3 into r9 as WalletInfo;
    cast r0 1u8 r9 into r10 as WalletHolder.record;
    cast r0 2u8 r9 into r11 as WalletHolder.record;
    cast r0 3u8 r9 into r12 as WalletHolder.record;
    async create_wallet3 r4 into r13;
    output r10 as WalletHolder.record;
    output r11 as WalletHolder.record;
    output r12 as WalletHolder.record;
    output r13 as coffer_v001.aleo/create_wallet3.future;
finalize create_wallet3:
    input r0 as field.public;
    get.or_use wallet_exists[r0] false into r1;
    not r1 into r2;
    assert.eq r2 true;
    set true into wallet_exists[r0];

function create_transfer3:
    input r0 as WalletHolder.record;
    input r1 as u64.private;
    input r2 as u128.private;
    input r3 as address.private;
    input r4 as field.private;
    input r5 as field.private;
    is.eq r0.wallet.holder_count 3u8 into r6;
    assert.eq r6 true;
    is.eq r3 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r7;
    is.eq r4 0field into r8;
    or r7 r8 into r9;
    assert.eq r9 true;
    cast r0.wallet.holder1 r5 r0.owner r0.wallet r1 r2 r3 r4 into r10 as PendingTransfer.record;
    cast r0.wallet.holder2 r5 r0.owner r0.wallet r1 r2 r3 r4 into r11 as PendingTransfer.record;
    cast r0.wallet.holder3 r5 r0.owner r0.wallet r1 r2 r3 r4 into r12 as PendingTransfer.record;
    async create_transfer3 r5 into r13;
    output r0 as WalletHolder.record;
    output r10 as PendingTransfer.record;
    output r11 as PendingTransfer.record;
    output r12 as PendingTransfer.record;
    output r13 as coffer_v001.aleo/create_transfer3.future;
finalize create_transfer3:
    input r0 as field.public;
    contains transfers[r0] into r1;
    not r1 into r2;
    assert.eq r2 true;
    cast 1u8 0u8 0u8 into r3 as TransferStatus;
    set r3 into transfers[r0];

function confirm_transfer:
    input r0 as PendingTransfer.record;
    cast r0.owner r0.transfer_id r0.creator r0.wallet r0.token_id r0.amount r0.to_address r0.to_wallet_id true into r1 as SignedTransfer.record;
    async confirm_transfer r0.transfer_id into r2;
    output r1 as SignedTransfer.record;
    output r2 as coffer_v001.aleo/confirm_transfer.future;
finalize confirm_transfer:
    input r0 as field.public;
    get transfers[r0] into r1;
    add r1.confirmation_count 1u8 into r2;
    cast r2 r1.rejection_count r1.status into r3 as TransferStatus;
    set r3 into transfers[r0];

function reject_transfer:
    input r0 as PendingTransfer.record;
    cast r0.owner r0.transfer_id r0.creator r0.wallet r0.token_id r0.amount r0.to_address r0.to_wallet_id false into r1 as SignedTransfer.record;
    async reject_transfer r0.transfer_id into r2;
    output r1 as SignedTransfer.record;
    output r2 as coffer_v001.aleo/reject_transfer.future;
finalize reject_transfer:
    input r0 as field.public;
    get transfers[r0] into r1;
    add r1.rejection_count 1u8 into r2;
    cast r1.confirmation_count r2 r1.status into r3 as TransferStatus;
    set r3 into transfers[r0];

function execute_confirmed_transfer:
    input r0 as SignedTransfer.record;
    is.eq r0.to_wallet_id 0field into r1;
    is.eq r0.to_address aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r2;
    or r1 r2 into r3;
    assert.eq r3 true;
    is.eq r0.to_wallet_id 0field into r4;
    ternary r4 r0.amount 0u128 into r5;
    cast r0.to_address r5 r0.token_id into r6 as Token.record;
    is.eq r0.to_wallet_id 0field into r7;
    cast r0.to_wallet_id r6.token_id into r8 as WalletBalanceKey;
    hash.bhp256 r8 into r9 as field;
    ternary r7 0field r9 into r10;
    cast r0.wallet.wallet_id r6.token_id into r11 as WalletBalanceKey;
    hash.bhp256 r11 into r12 as field;
    async execute_confirmed_transfer r0.transfer_id r0.wallet.threshold r12 r0.amount r10 into r13;
    output r0 as SignedTransfer.record;
    output r6 as Token.record;
    output r13 as coffer_v001.aleo/execute_confirmed_transfer.future;
finalize execute_confirmed_transfer:
    input r0 as field.public;
    input r1 as u8.public;
    input r2 as field.public;
    input r3 as u128.public;
    input r4 as field.public;
    get transfers[r0] into r5;
    is.eq r5.status 0u8 into r6;
    assert.eq r6 true;
    gte r5.confirmation_count r1 into r7;
    assert.eq r7 true;
    get wallet_balances[r2] into r8;
    sub r8 r3 into r9;
    set r9 into wallet_balances[r2];
    is.eq r4 0field into r10;
    get.or_use wallet_balances[r4] 0u128 into r11;
    add r11 r3 into r12;
    set r12 into wallet_balances[r4];
    cast r5.confirmation_count r5.rejection_count 1u8 into r13 as TransferStatus;
    set r13 into transfers[r0];

function deposit:
    input r0 as Token.record;
    input r1 as u128.private;
    input r2 as field.private;
    sub r0.amount r1 into r3;
    cast r0.owner r3 r0.token_id into r4 as Token.record;
    hash.bhp256 r2 into r5 as field;
    cast r2 r0.token_id into r6 as WalletBalanceKey;
    hash.bhp256 r6 into r7 as field;
    async deposit r5 r7 r1 into r8;
    output r4 as Token.record;
    output r8 as coffer_v001.aleo/deposit.future;
finalize deposit:
    input r0 as field.public;
    input r1 as field.public;
    input r2 as u128.public;
    contains wallet_exists[r0] into r3;
    assert.eq r3 true;
    get.or_use wallet_balances[r1] 0u128 into r4;
    add r4 r2 into r5;
    set r5 into wallet_balances[r1];

function create_token:
    input r0 as u64.private;
    input r1 as u8.private;
    input r2 as u128.private;
    cast r0 r2 r1 into r3 as TokenInfo;
    async create_token r3 into r4;
    output r4 as coffer_v001.aleo/create_token.future;
finalize create_token:
    input r0 as TokenInfo.public;
    contains registered_tokens[r0.token_id] into r1;
    not r1 into r2;
    assert.eq r2 true;
    set r0 into registered_tokens[r0.token_id];

function mint_private:
    input r0 as address.private;
    input r1 as u64.private;
    input r2 as u128.private;
    pow 10u128 6u8 into r3;
    mul 1000u128 r3 into r4;
    lte r2 r4 into r5;
    assert.eq r5 true;
    cast r0 r2 r1 into r6 as Token.record;
    async mint_private r1 into r7;
    output r6 as Token.record;
    output r7 as coffer_v001.aleo/mint_private.future;
finalize mint_private:
    input r0 as u64.public;
    get registered_tokens[r0] into r1;

Block heightTimestampTransition IDFunction callState
99,9512023-10-28 10:34:01au17p07n5ec23528kmpks05zm0zhghk6m7du60tr5xy6qe4zw5s5y8sxua0e8depositRejected
99,1792023-10-28 09:31:33au1u4zrrc34pdsavltha4re7x2faz0z3rmu8d87dpynq7lrn7h4xsrq79g03pcreate_wallet3Accepted
98,8132023-10-28 09:02:15au1m6suwnxjfxt9dkl2h4058pk4a582x7n0ffjnmtserxufhm8w0vxq4j28femint_privateAccepted
98,7682023-10-28 08:59:03au1mnyjm46w8z5krft9vezygcs5p8mcnyaq537ngapg60wjg96zw5qs3sq7s4create_tokenAccepted
86,8002023-10-27 17:03:03au1acpffg256kregyec9lax6arerywm3cz8ypm4w5xrukfeejce3vxsdathfncreate_wallet3Accepted








Not implemented