diff --git a/idl/hexboosting.json b/idl/hexboosting.json index fcc439a..9e5e690 100644 --- a/idl/hexboosting.json +++ b/idl/hexboosting.json @@ -1,182 +1,341 @@ { - "version": "0.2.0", - "name": "hexboosting", + "address": "hexbnKYoA2GercNNhHUCCfrTRWrHjT6ujKPXTa5NPqJ", + "metadata": { + "name": "hexboosting", + "version": "0.2.3", + "spec": "0.1.0", + "description": "Created with Anchor" + }, "instructions": [ { - "name": "boostV0", + "name": "boost_v0", + "discriminator": [ + 146, + 246, + 159, + 51, + 180, + 35, + 181, + 68 + ], "accounts": [ { "name": "payer", - "isMut": true, - "isSigner": true + "writable": true, + "signer": true }, { - "name": "boostConfig", - "isMut": false, - "isSigner": false, - "relations": [ - "dc_mint" - ] + "name": "boost_config" }, { - "name": "carrier", - "isMut": false, - "isSigner": false, - "relations": [ - "hexboost_authority" - ] + "name": "carrier" }, { - "name": "hexboostAuthority", - "isMut": false, - "isSigner": true + "name": "hexboost_authority", + "signer": true, + "relations": [ + "carrier" + ] }, { - "name": "dataCredits", - "isMut": false, - "isSigner": false, + "name": "data_credits", "pda": { "seeds": [ { "kind": "const", - "type": "string", - "value": "dc" + "value": [ + 100, + 99 + ] }, { "kind": "account", - "type": "publicKey", - "account": "Mint", "path": "dc_mint" } ], - "programId": { + "program": { "kind": "account", - "type": "publicKey", "path": "data_credits_program" } - }, - "relations": [ - "dc_mint" - ] + } }, { - "name": "dcMint", - "isMut": true, - "isSigner": false + "name": "dc_mint", + "writable": true, + "relations": [ + "boost_config", + "data_credits" + ] }, { - "name": "paymentAccount", - "isMut": true, - "isSigner": false + "name": "payment_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "payer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dc_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } }, { - "name": "boostedHex", - "isMut": true, - "isSigner": false + "name": "boosted_hex", + "writable": true }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + "name": "system_program", + "address": "11111111111111111111111111111111" }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" }, { - "name": "associatedTokenProgram", - "isMut": false, - "isSigner": false + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" }, { - "name": "dataCreditsProgram", - "isMut": false, - "isSigner": false + "name": "data_credits_program", + "address": "credMBJhYFzfn7NxBMdU4aUqFggAjgztaCcv2Fo6fPT" } ], "args": [ { "name": "args", "type": { - "defined": "BoostArgsV0" + "defined": { + "name": "BoostArgsV0" + } } } ] }, { - "name": "initializeBoostConfigV0", + "name": "close_boost_v0", + "discriminator": [ + 121, + 128, + 3, + 8, + 105, + 222, + 31, + 96 + ], "accounts": [ { - "name": "payer", - "isMut": true, - "isSigner": true + "name": "rent_reclaim_authority", + "signer": true, + "relations": [ + "boost_config" + ] }, { - "name": "subDao", - "isMut": false, - "isSigner": false, + "name": "boost_config", "relations": [ - "authority", - "dao" + "boosted_hex" + ] + }, + { + "name": "boosted_hex", + "writable": true + } + ], + "args": [] + }, + { + "name": "close_boost_v1", + "discriminator": [ + 220, + 150, + 178, + 170, + 197, + 150, + 217, + 101 + ], + "accounts": [ + { + "name": "rent_reclaim_authority", + "signer": true, + "relations": [ + "boost_config" + ] + }, + { + "name": "boost_config", + "relations": [ + "boosted_hex" ] }, + { + "name": "boosted_hex", + "writable": true + } + ], + "args": [] + }, + { + "name": "initialize_boost_config_v0", + "discriminator": [ + 91, + 33, + 41, + 209, + 43, + 27, + 177, + 92 + ], + "accounts": [ + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "sub_dao" + }, { "name": "authority", - "isMut": false, - "isSigner": true + "signer": true, + "relations": [ + "sub_dao" + ] }, { - "name": "rentReclaimAuthority", - "isMut": false, - "isSigner": false + "name": "rent_reclaim_authority" }, { - "name": "startAuthority", - "isMut": false, - "isSigner": false + "name": "start_authority" }, { - "name": "priceOracle", - "isMut": false, - "isSigner": false + "name": "price_oracle" }, { - "name": "dcMint", - "isMut": false, - "isSigner": false + "name": "dc_mint", + "relations": [ + "dao" + ] }, { - "name": "boostConfig", - "isMut": true, - "isSigner": false, + "name": "boost_config", + "writable": true, "pda": { "seeds": [ { "kind": "const", - "type": "string", - "value": "boost_config" + "value": [ + 98, + 111, + 111, + 115, + 116, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] }, { "kind": "account", - "type": "publicKey", - "account": "Mint", "path": "dc_mint" } ] } }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + "name": "system_program", + "address": "11111111111111111111111111111111" }, { "name": "dao", - "isMut": false, - "isSigner": false, "relations": [ - "dc_mint" + "sub_dao" ] } ], @@ -184,168 +343,362 @@ { "name": "args", "type": { - "defined": "InitializeBoostConfigArgsV0" + "defined": { + "name": "InitializeBoostConfigArgsV0" + } } } ] }, { - "name": "startBoostV0", + "name": "start_boost_v0", + "discriminator": [ + 184, + 86, + 83, + 12, + 221, + 251, + 157, + 111 + ], "accounts": [ { - "name": "startAuthority", - "isMut": false, - "isSigner": true - }, - { - "name": "boostConfig", - "isMut": false, - "isSigner": false, + "name": "start_authority", + "signer": true, "relations": [ - "start_authority" + "boost_config" ] }, { - "name": "boostedHex", - "isMut": true, - "isSigner": false, + "name": "boost_config", "relations": [ - "boost_config" + "boosted_hex" ] + }, + { + "name": "boosted_hex", + "writable": true } ], "args": [ { "name": "args", "type": { - "defined": "StartBoostArgsV0" + "defined": { + "name": "StartBoostArgsV0" + } } } ] }, { - "name": "startBoostV1", + "name": "start_boost_v1", + "discriminator": [ + 216, + 105, + 227, + 145, + 53, + 11, + 144, + 199 + ], "accounts": [ { - "name": "startAuthority", - "isMut": false, - "isSigner": true - }, - { - "name": "boostConfig", - "isMut": false, - "isSigner": false, + "name": "start_authority", + "signer": true, "relations": [ - "start_authority" + "boost_config" ] }, { - "name": "boostedHex", - "isMut": true, - "isSigner": false, + "name": "boost_config", "relations": [ - "boost_config" + "boosted_hex" ] + }, + { + "name": "boosted_hex", + "writable": true } ], "args": [ { "name": "args", "type": { - "defined": "StartBoostArgsV0" + "defined": { + "name": "StartBoostArgsV0" + } } } ] }, { - "name": "closeBoostV0", - "accounts": [ - { - "name": "rentReclaimAuthority", - "isMut": false, - "isSigner": true - }, - { - "name": "boostConfig", - "isMut": false, - "isSigner": false, - "relations": [ - "rent_reclaim_authority" - ] - }, - { - "name": "boostedHex", - "isMut": true, - "isSigner": false, - "relations": [ - "boost_config" - ] - } + "name": "update_boost_config_v0", + "discriminator": [ + 86, + 246, + 58, + 96, + 39, + 14, + 113, + 90 ], - "args": [] - }, - { - "name": "updateBoostConfigV0", "accounts": [ { - "name": "subDao", - "isMut": false, - "isSigner": false, + "name": "sub_dao", "relations": [ - "authority" + "boost_config" ] }, { "name": "authority", - "isMut": false, - "isSigner": true - }, - { - "name": "boostConfig", - "isMut": true, - "isSigner": false, + "signer": true, "relations": [ "sub_dao" ] + }, + { + "name": "boost_config", + "writable": true } ], "args": [ { "name": "args", "type": { - "defined": "UpdateBoostConfigArgsV0" + "defined": { + "name": "UpdateBoostConfigArgsV0" + } } } ] } ], "accounts": [ + { + "name": "BoostConfigV0", + "discriminator": [ + 156, + 47, + 176, + 79, + 140, + 160, + 214, + 183 + ] + }, + { + "name": "BoostedHexV0", + "discriminator": [ + 133, + 159, + 70, + 91, + 177, + 69, + 162, + 77 + ] + }, + { + "name": "BoostedHexV1", + "discriminator": [ + 167, + 134, + 141, + 5, + 178, + 238, + 194, + 189 + ] + }, + { + "name": "CarrierV0", + "discriminator": [ + 145, + 30, + 146, + 217, + 129, + 70, + 200, + 132 + ] + }, + { + "name": "DaoV0", + "discriminator": [ + 101, + 75, + 232, + 141, + 239, + 45, + 29, + 205 + ] + }, + { + "name": "DataCreditsV0", + "discriminator": [ + 171, + 162, + 190, + 96, + 54, + 214, + 214, + 162 + ] + }, + { + "name": "SubDaoV0", + "discriminator": [ + 19, + 5, + 31, + 112, + 144, + 214, + 82, + 128 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "BelowMinimumBoost", + "msg": "Must boost for the minimum boosting duration" + }, + { + "code": 6001, + "name": "NoOraclePrice", + "msg": "No mobile oracle price" + }, + { + "code": 6002, + "name": "MaxBoostExceeded", + "msg": "Hex is already boosted the maximum amount of 256x" + }, + { + "code": 6003, + "name": "InvalidVersion", + "msg": "Hexboost version has changed since this instruction was formed, transaction rejected for safety" + }, + { + "code": 6004, + "name": "PythError", + "msg": "Error from pyth" + }, + { + "code": 6005, + "name": "PythPriceNotFound", + "msg": "No pyth price found" + }, + { + "code": 6006, + "name": "ArithmeticError", + "msg": "Error in arithmetic" + }, + { + "code": 6007, + "name": "BoostPeriodOver", + "msg": "Cannot boost a period that is in progress or over" + }, + { + "code": 6008, + "name": "NoEmptyPeriods", + "msg": "Cannot leave a gap in boost periods" + }, + { + "code": 6009, + "name": "PythPriceFeedStale", + "msg": "Pyth price is stale" + } + ], + "types": [ + { + "name": "BoostAmountV0", + "type": { + "kind": "struct", + "fields": [ + { + "name": "period", + "type": "u16" + }, + { + "name": "amount", + "type": "u8" + } + ] + } + }, + { + "name": "BoostArgsV0", + "type": { + "kind": "struct", + "fields": [ + { + "name": "location", + "type": "u64" + }, + { + "name": "version", + "type": "u32" + }, + { + "name": "amounts", + "type": { + "vec": { + "defined": { + "name": "BoostAmountV0" + } + } + } + }, + { + "name": "device_type", + "type": { + "defined": { + "name": "DeviceTypeV0" + } + } + } + ] + } + }, { "name": "BoostConfigV0", "type": { "kind": "struct", "fields": [ { - "name": "priceOracle", - "type": "publicKey" + "name": "price_oracle", + "type": "pubkey" }, { - "name": "paymentMint", - "type": "publicKey" + "name": "payment_mint", + "type": "pubkey" }, { - "name": "subDao", - "type": "publicKey" + "name": "sub_dao", + "type": "pubkey" }, { - "name": "rentReclaimAuthority", + "name": "rent_reclaim_authority", "docs": [ "Authority to reclaim rent from hexes no longer boosted" ], - "type": "publicKey" + "type": "pubkey" }, { - "name": "boostPrice", + "name": "boost_price", "docs": [ "The price in the oracle (usd) to burn boost", "For simplicity, this should have the same number of decimals as the price oracle" @@ -353,33 +706,33 @@ "type": "u64" }, { - "name": "periodLength", + "name": "period_length", "docs": [ "The length of a period (defined as a month in the HIP)" ], "type": "u32" }, { - "name": "minimumPeriods", + "name": "minimum_periods", "docs": [ "The minimum of periods to boost" ], "type": "u16" }, { - "name": "bumpSeed", + "name": "bump_seed", "type": "u8" }, { - "name": "startAuthority", + "name": "start_authority", "docs": [ "Authority to start the hex" ], - "type": "publicKey" + "type": "pubkey" }, { - "name": "dcMint", - "type": "publicKey" + "name": "dc_mint", + "type": "pubkey" } ] } @@ -390,15 +743,15 @@ "kind": "struct", "fields": [ { - "name": "boostConfig", - "type": "publicKey" + "name": "boost_config", + "type": "pubkey" }, { "name": "location", "type": "u64" }, { - "name": "startTs", + "name": "start_ts", "type": "i64" }, { @@ -411,11 +764,11 @@ } }, { - "name": "bumpSeed", + "name": "bump_seed", "type": "u8" }, { - "name": "boostsByPeriod", + "name": "boosts_by_period", "docs": [ "Each entry represents the boost multiplier for a given period" ], @@ -434,14 +787,16 @@ "kind": "struct", "fields": [ { - "name": "deviceType", + "name": "device_type", "type": { - "defined": "DeviceTypeV0" + "defined": { + "name": "DeviceTypeV0" + } } }, { - "name": "boostConfig", - "type": "publicKey" + "name": "boost_config", + "type": "pubkey" }, { "name": "version", @@ -452,15 +807,15 @@ "type": "u64" }, { - "name": "startTs", + "name": "start_ts", "type": "i64" }, { - "name": "bumpSeed", + "name": "bump_seed", "type": "u8" }, { - "name": "boostsByPeriod", + "name": "boosts_by_period", "docs": [ "Each entry represents the boost multiplier for a given period" ], @@ -468,51 +823,220 @@ } ] } - } - ], - "types": [ + }, { - "name": "BoostArgsV0", + "name": "CarrierV0", "type": { "kind": "struct", "fields": [ { - "name": "location", + "name": "sub_dao", + "type": "pubkey" + }, + { + "name": "update_authority", + "type": "pubkey" + }, + { + "name": "issuing_authority", + "type": "pubkey" + }, + { + "name": "collection", + "type": "pubkey" + }, + { + "name": "escrow", + "type": "pubkey" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "merkle_tree", + "type": "pubkey" + }, + { + "name": "approved", + "type": "bool" + }, + { + "name": "collection_bump_seed", + "type": "u8" + }, + { + "name": "bump_seed", + "type": "u8" + }, + { + "name": "hexboost_authority", + "type": "pubkey" + }, + { + "name": "incentive_escrow_fund_bps", + "type": "u16" + } + ] + } + }, + { + "name": "DaoV0", + "type": { + "kind": "struct", + "fields": [ + { + "name": "hnt_mint", + "type": "pubkey" + }, + { + "name": "dc_mint", + "type": "pubkey" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "registrar", + "type": "pubkey" + }, + { + "name": "hst_pool", + "type": "pubkey" + }, + { + "name": "net_emissions_cap", "type": "u64" }, { - "name": "version", + "name": "num_sub_daos", "type": "u32" }, { - "name": "amounts", + "name": "emission_schedule", "type": { "vec": { - "defined": "BoostAmountV0" + "defined": { + "name": "EmissionScheduleItem" + } } } }, { - "name": "deviceType", + "name": "hst_emission_schedule", "type": { - "defined": "DeviceTypeV0" + "vec": { + "defined": { + "name": "PercentItem" + } + } + } + }, + { + "name": "bump_seed", + "type": "u8" + }, + { + "name": "rewards_escrow", + "type": "pubkey" + }, + { + "name": "delegator_pool", + "type": "pubkey" + }, + { + "name": "delegator_rewards_percent", + "type": "u64" + }, + { + "name": "proposal_namespace", + "type": "pubkey" + }, + { + "name": "recent_proposals", + "type": { + "array": [ + { + "defined": { + "name": "RecentProposal" + } + }, + 4 + ] } } ] } }, { - "name": "BoostAmountV0", + "name": "DataCreditsV0", "type": { "kind": "struct", "fields": [ { - "name": "period", - "type": "u16" + "name": "dc_mint", + "type": "pubkey" }, { - "name": "amount", + "name": "hnt_mint", + "type": "pubkey" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "hnt_price_oracle", + "type": "pubkey" + }, + { + "name": "data_credits_bump", "type": "u8" + }, + { + "name": "account_payer", + "type": "pubkey" + }, + { + "name": "account_payer_bump", + "type": "u8" + } + ] + } + }, + { + "name": "DeviceTypeV0", + "type": { + "kind": "enum", + "variants": [ + { + "name": "CbrsIndoor" + }, + { + "name": "CbrsOutdoor" + }, + { + "name": "WifiIndoor" + }, + { + "name": "WifiOutdoor" + } + ] + } + }, + { + "name": "EmissionScheduleItem", + "type": { + "kind": "struct", + "fields": [ + { + "name": "start_unix_time", + "type": "i64" + }, + { + "name": "emissions_per_epoch", + "type": "u64" } ] } @@ -523,21 +1047,21 @@ "kind": "struct", "fields": [ { - "name": "boostPrice", + "name": "boost_price", "docs": [ "The price in the oracle (usd) to burn boost" ], "type": "u64" }, { - "name": "periodLength", + "name": "period_length", "docs": [ "The length of a period (defined as a month in the HIP)" ], "type": "u32" }, { - "name": "minimumPeriods", + "name": "minimum_periods", "docs": [ "The minimum of periods to boost" ], @@ -546,133 +1070,186 @@ ] } }, + { + "name": "PercentItem", + "type": { + "kind": "struct", + "fields": [ + { + "name": "start_unix_time", + "type": "i64" + }, + { + "name": "percent", + "type": "u8" + } + ] + } + }, + { + "name": "RecentProposal", + "type": { + "kind": "struct", + "fields": [ + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "ts", + "type": "i64" + } + ] + } + }, { "name": "StartBoostArgsV0", "type": { "kind": "struct", "fields": [ { - "name": "startTs", + "name": "start_ts", "type": "i64" } ] } }, { - "name": "UpdateBoostConfigArgsV0", + "name": "SubDaoV0", "type": { "kind": "struct", "fields": [ { - "name": "startAuthority", - "type": { - "option": "publicKey" - } + "name": "dao", + "type": "pubkey" }, { - "name": "rentReclaimAuthority", - "type": { - "option": "publicKey" - } + "name": "dnt_mint", + "type": "pubkey" }, { - "name": "boostPrice", - "type": { - "option": "u64" - } + "name": "treasury", + "type": "pubkey" }, { - "name": "minimumPeriods", - "type": { - "option": "u16" - } + "name": "rewards_escrow", + "type": "pubkey" }, { - "name": "priceOracle", - "type": { - "option": "publicKey" - } + "name": "delegator_pool", + "docs": [ + "DEPRECATED: use dao.delegator_pool instead. But some people still need to claim old DNT rewards" + ], + "type": "pubkey" + }, + { + "name": "vehnt_delegated", + "type": "u128" + }, + { + "name": "vehnt_last_calculated_ts", + "type": "i64" + }, + { + "name": "vehnt_fall_rate", + "type": "u128" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "_deprecated_active_device_aggregator", + "type": "pubkey" }, { - "name": "dcMint", + "name": "dc_burn_authority", + "type": "pubkey" + }, + { + "name": "onboarding_dc_fee", + "type": "u64" + }, + { + "name": "emission_schedule", "type": { - "option": "publicKey" + "vec": { + "defined": { + "name": "EmissionScheduleItem" + } + } } + }, + { + "name": "bump_seed", + "type": "u8" + }, + { + "name": "registrar", + "type": "pubkey" + }, + { + "name": "_deprecated_delegator_rewards_percent", + "type": "u64" + }, + { + "name": "onboarding_data_only_dc_fee", + "type": "u64" + }, + { + "name": "dc_onboarding_fees_paid", + "type": "u64" + }, + { + "name": "active_device_authority", + "type": "pubkey" } ] } }, { - "name": "DeviceTypeV0", + "name": "UpdateBoostConfigArgsV0", "type": { - "kind": "enum", - "variants": [ + "kind": "struct", + "fields": [ { - "name": "CbrsIndoor" + "name": "start_authority", + "type": { + "option": "pubkey" + } }, { - "name": "CbrsOutdoor" + "name": "rent_reclaim_authority", + "type": { + "option": "pubkey" + } }, { - "name": "WifiIndoor" + "name": "boost_price", + "type": { + "option": "u64" + } }, { - "name": "WifiOutdoor" + "name": "minimum_periods", + "type": { + "option": "u16" + } + }, + { + "name": "price_oracle", + "type": { + "option": "pubkey" + } + }, + { + "name": "dc_mint", + "type": { + "option": "pubkey" + } } ] } } - ], - "errors": [ - { - "code": 6000, - "name": "BelowMinimumBoost", - "msg": "Must boost for the minimum boosting duration" - }, - { - "code": 6001, - "name": "NoOraclePrice", - "msg": "No mobile oracle price" - }, - { - "code": 6002, - "name": "MaxBoostExceeded", - "msg": "Hex is already boosted the maximum amount of 256x" - }, - { - "code": 6003, - "name": "InvalidVersion", - "msg": "Hexboost version has changed since this instruction was formed, transaction rejected for safety" - }, - { - "code": 6004, - "name": "PythError", - "msg": "Error from pyth" - }, - { - "code": 6005, - "name": "PythPriceNotFound", - "msg": "No pyth price found" - }, - { - "code": 6006, - "name": "ArithmeticError", - "msg": "Error in arithmetic" - }, - { - "code": 6007, - "name": "BoostPeriodOver", - "msg": "Cannot boost a period that is in progress or over" - }, - { - "code": 6008, - "name": "NoEmptyPeriods", - "msg": "Cannot leave a gap in boost periods" - }, - { - "code": 6009, - "name": "PythPriceFeedStale", - "msg": "Pyth price is stale" - } ] } \ No newline at end of file diff --git a/programs/hexboosting/Cargo.toml b/programs/hexboosting/Cargo.toml index ade154f..a32180e 100644 --- a/programs/hexboosting/Cargo.toml +++ b/programs/hexboosting/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hexboosting" -version = "0.2.0" +version = "0.2.4" edition = "2021" authors = ["Louis Thiery "] license = "Apache-2.0"