seedelf_core/
constants.rs

1use hex_literal::hex;
2
3/// The current variant of Seedelf
4pub const VARIANT: u64 = 1;
5
6pub struct Contract {
7    pub wallet_contract_hash: [u8; 28],
8    pub seedelf_policy_id: &'static str,
9    pub wallet_contract_size: u64,
10    pub seedelf_contract_size: u64,
11}
12
13pub struct Reference {
14    pub wallet_reference_utxo: [u8; 32],
15    pub seedelf_reference_utxo: [u8; 32],
16}
17
18pub struct Config {
19    pub contract: Contract,
20    pub reference: Reference,
21}
22
23/// We can store all variants of the contracts inside this function then call it whenever we need it.
24pub fn get_config(variant: u64, network: bool) -> Option<Config> {
25    match variant {
26        1 => {
27            let reference: Reference = if network {
28                Reference {
29                    wallet_reference_utxo: hex!(
30                        "96fbddac63c55284fbbaa3c216ef1c0f460019e8643a889a189d5b5f7ddd71d6"
31                    ),
32                    seedelf_reference_utxo: hex!(
33                        "f620a4e949bfbefbf2892d39d0777439f3acfbf850eae9b007c6558ba8ef4db4"
34                    ),
35                }
36            } else {
37                Reference {
38                    wallet_reference_utxo: hex!(
39                        "51f12c1a5c2b0558a284628d81b06dee50b27693242fe35618c5f921730c0527"
40                    ),
41                    seedelf_reference_utxo: hex!(
42                        "f3955f42f660fae8b3e4dcf664011876cf769d87aa8450dc73171b4f6b5f520b"
43                    ),
44                }
45            };
46            let contract: Contract = Contract {
47                wallet_contract_hash: hex!(
48                    "94bca9c099e84ffd90d150316bb44c31a78702239076a0a80ea4a469"
49                ),
50                seedelf_policy_id: "84967d911e1a10d5b4a38441879f374a07f340945bcf9e7697485255",
51                wallet_contract_size: 629,
52                seedelf_contract_size: 519,
53            };
54            Some(Config {
55                contract,
56                reference,
57            })
58        }
59        _ => None, // unsupported variant
60    }
61}
62
63// support the [LOGIC] stakepool
64pub const PREPROD_STAKE_HASH: [u8; 28] =
65    hex!("86c769419aaa673c963da04e4b5bae448d490e2ceac902cb82e4da76");
66pub const MAINNET_STAKE_HASH: [u8; 28] =
67    hex!("fcfc7701b1df42061202efa9c96968a481bbd6a0676efb7afa87ebf1");
68
69// collateral info for giveme.my
70pub const COLLATERAL_HASH: [u8; 28] =
71    hex!("7c24c22d1dc252d31f6022ff22ccc838c2ab83a461172d7c2dae61f4");
72pub const COLLATERAL_PUBLIC_KEY: [u8; 32] =
73    hex!("fa2025e788fae01ce10deffff386f992f62a311758819e4e3792887396c171ba");
74
75pub const PREPROD_COLLATERAL_UTXO: [u8; 32] =
76    hex!("1d388e615da2dca607e28f704130d04e39da6f251d551d66d054b75607e0393f");
77pub const MAINNET_COLLATERAL_UTXO: [u8; 32] =
78    hex!("e62351eacbdd001aee77a91805840d2b81f77feebbf2439fb01b79e76c42c839");
79
80// ADA Handle Policy Ids
81pub const ADA_HANDLE_POLICY_ID: &str = "f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a";
82
83// these maximums are estimated
84pub const MAXIMUM_WALLET_UTXOS: u64 = 20;
85pub const MAXIMUM_TOKENS_PER_UTXO: u64 = 20;
86
87// protocol parameters
88pub const OVERHEAD_COST: u64 = 160;
89pub const UTXO_COST_PER_BYTE: u64 = 4_310;
90
91pub const MEM_COST_NUMERATOR: u64 = 577;
92pub const MEM_COST_DENOMINATOR: u64 = 10_000;
93pub const CPU_COST_NUMERATOR: u64 = 721;
94pub const CPU_COST_DENOMINATOR: u64 = 10_000_000;
95
96pub fn plutus_v3_cost_model() -> Vec<i64> {
97    vec![
98        100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000,
99        100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100,
100        94375, 32, 132994, 32, 61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848,
101        123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 1, 1000, 42921, 4, 2, 24548, 29498, 38, 1,
102        898148, 27279, 1, 51775, 558, 1, 39184, 1000, 60594, 1, 141895, 32, 83150, 32, 15299, 32,
103        76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1, 43285, 552, 1, 44749, 541, 1,
104        33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848, 123203, 7305, -900,
105        1716, 549, 57, 85848, 0, 1, 90434, 519, 0, 1, 74433, 32, 85848, 123203, 7305, -900, 1716,
106        549, 57, 85848, 0, 1, 1, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 955506,
107        213312, 0, 2, 270652, 22588, 4, 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420,
108        1, 1, 81663, 32, 59498, 32, 20142, 32, 24588, 32, 20744, 32, 25933, 32, 24623, 32,
109        43053543, 10, 53384111, 14333, 10, 43574283, 26308, 10, 16000, 100, 16000, 100, 962335, 18,
110        2780678, 6, 442008, 1, 52538055, 3756, 18, 267929, 18, 76433006, 8868, 18, 52948122, 18,
111        1995836, 36, 3227919, 12, 901022, 1, 166917843, 4307, 36, 284546, 36, 158221314, 26549, 36,
112        74698472, 36, 333849714, 1, 254006273, 72, 2174038, 72, 2261318, 64571, 4, 207616, 8310, 4,
113        1293828, 28716, 63, 0, 1, 1006041, 43623, 251, 0, 1, 100181, 726, 719, 0, 1, 100181, 726,
114        719, 0, 1, 100181, 726, 719, 0, 1, 107878, 680, 0, 1, 95336, 1, 281145, 18848, 0, 1,
115        180194, 159, 1, 1, 158519, 8942, 0, 1, 159378, 8813, 0, 1, 107490, 3298, 1, 106057, 655, 1,
116        1964219, 24520, 3,
117    ]
118}