diff --git a/src/flare_ai_kit/abis/cyclo.json b/src/flare_ai_kit/abis/cyclo.json new file mode 100644 index 00000000..247d8cd1 --- /dev/null +++ b/src/flare_ai_kit/abis/cyclo.json @@ -0,0 +1,1095 @@ +[ + { + "inputs": [ + { + "components": [ + { + "internalType": "contract ICloneableFactoryV2", + "name": "factory", + "type": "address" + }, + { + "internalType": "contract IReceiptV2", + "name": "receiptImplementation", + "type": "address" + } + ], + "internalType": "struct ReceiptVaultConstructionConfig", + "name": "config", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InitializeSignatureFn", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "InvalidId", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "minShareRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shareRatio", + "type": "uint256" + } + ], + "name": "MinShareRatio", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "expectedManager", + "type": "address" + }, + { + "internalType": "address", + "name": "actualManager", + "type": "address" + } + ], + "name": "WrongManager", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAssetsAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroOwner", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroReceiver", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroSharesAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "receiptInformation", + "type": "bytes" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "components": [ + { + "internalType": "contract IPriceOracleV2", + "name": "priceOracle", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "receipt", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + } + ], + "internalType": "struct VaultConfig", + "name": "vaultConfig", + "type": "tuple" + } + ], + "internalType": "struct ReceiptVaultConfig", + "name": "receiptVaultConfig", + "type": "tuple" + } + ], + "indexed": false, + "internalType": "struct ERC20PriceOracleReceiptVaultConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "ERC20PriceOracleReceiptVaultInitialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "vaultInformation", + "type": "bytes" + } + ], + "name": "ReceiptVaultInformation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "Snapshot", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "receiptInformation", + "type": "bytes" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "asset", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "authorizeReceiptTransfer2", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "snapshotId", + "type": "uint256" + } + ], + "name": "balanceOfAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "convertToAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "convertToShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "depositMinShareRatio", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "receiptInformation", + "type": "bytes" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "initialize", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "maxRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "maxWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintMinShareRatio", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "receiptInformation", + "type": "bytes" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minShareRatio", + "type": "uint256" + } + ], + "name": "previewDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minShareRatio", + "type": "uint256" + } + ], + "name": "previewMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "previewRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "previewWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "priceOracle", + "outputs": [ + { + "internalType": "contract IPriceOracleV2", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "vaultInformation", + "type": "bytes" + } + ], + "name": "receiptVaultInformation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "receiptInformation", + "type": "bytes" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "snapshotId", + "type": "uint256" + } + ], + "name": "totalSupplyAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "receiptInformation", + "type": "bytes" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/src/flare_ai_kit/abis/kineticComptroller.json b/src/flare_ai_kit/abis/kineticComptroller.json new file mode 100644 index 00000000..bd119ec4 --- /dev/null +++ b/src/flare_ai_kit/abis/kineticComptroller.json @@ -0,0 +1,2061 @@ +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "action", + "type": "string" + }, + { + "indexed": false, + "internalType": "bool", + "name": "pauseState", + "type": "bool" + } + ], + "name": "ActionPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "action", + "type": "string" + }, + { + "indexed": false, + "internalType": "bool", + "name": "pauseState", + "type": "bool" + } + ], + "name": "ActionPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "rewardToken", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBorrowRewardSpeed", + "type": "uint256" + } + ], + "name": "BorrowRewardSpeedUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint8", + "name": "tokenType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowIndex", + "type": "uint256" + } + ], + "name": "DistributedBorrowerReward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint8", + "name": "tokenType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "supplier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "supplyIndex", + "type": "uint256" + } + ], + "name": "DistributedSupplierReward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "info", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "detail", + "type": "uint256" + } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "MarketEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "MarketExited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + } + ], + "name": "MarketListed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBorrowCap", + "type": "uint256" + } + ], + "name": "NewBorrowCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldBorrowCapGuardian", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newBorrowCapGuardian", + "type": "address" + } + ], + "name": "NewBorrowCapGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldCloseFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCloseFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldCollateralFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCollateralFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldLiquidationIncentiveMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "NewLiquidationIncentive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldLiquidatorsWhitelistVerifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newLiquidatorsWhitelistVerifier", + "type": "address" + } + ], + "name": "NewLiquidatorsWhitelistVerifier", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPauseGuardian", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPauseGuardian", + "type": "address" + } + ], + "name": "NewPauseGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract PriceOracle", + "name": "oldPriceOracle", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract PriceOracle", + "name": "newPriceOracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "rewardAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint8", + "name": "rewardIndex", + "type": "uint8" + } + ], + "name": "NewRewardType", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "rewardType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardTokenGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "rewardToken", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSupplyRewardSpeed", + "type": "uint256" + } + ], + "name": "SupplyRewardSpeedUpdated", + "type": "event" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract Unitroller", + "name": "unitroller", + "type": "address" + } + ], + "name": "_become", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "_borrowGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint8", + "name": "rewardType", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "_grantRewardTokens", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "_mintGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newBorrowCapGuardian", + "type": "address" + } + ], + "name": "_setBorrowCapGuardian", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "_setBorrowPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "_setCloseFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "_setCollateralFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "_setLiquidationIncentive", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract CToken[]", + "name": "cTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newBorrowCaps", + "type": "uint256[]" + } + ], + "name": "_setMarketBorrowCaps", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "_setMintPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newPauseGuardian", + "type": "address" + } + ], + "name": "_setPauseGuardian", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract PriceOracle", + "name": "newOracle", + "type": "address" + } + ], + "name": "_setPriceOracle", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint8", + "name": "rewardType", + "type": "uint8" + }, + { + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "supplyRewardSpeed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRewardSpeed", + "type": "uint256" + } + ], + "name": "_setRewardSpeed", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "_setSeizePaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "_setTransferPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + } + ], + "name": "_supportMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "accountAssets", + "outputs": [ + { + "internalType": "contract CToken", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "allMarkets", + "outputs": [ + { + "internalType": "contract CToken", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "cToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowCapGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "borrowCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "borrowGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "borrowRewardSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract CToken", + "name": "cToken", + "type": "address" + } + ], + "name": "checkMembership", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint8", + "name": "rewardType", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "holder", + "type": "address" + } + ], + "name": "claimReward", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint8", + "name": "rewardType", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "holder", + "type": "address" + }, + { + "internalType": "contract CToken[]", + "name": "cTokens", + "type": "address[]" + } + ], + "name": "claimReward", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint8", + "name": "rewardType", + "type": "uint8" + }, + { + "internalType": "address payable[]", + "name": "holders", + "type": "address[]" + }, + { + "internalType": "contract CToken[]", + "name": "cTokens", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "borrowers", + "type": "bool" + }, + { + "internalType": "bool", + "name": "suppliers", + "type": "bool" + } + ], + "name": "claimReward", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "cTokens", + "type": "address[]" + } + ], + "name": "enterMarkets", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "cTokenAddress", + "type": "address" + } + ], + "name": "exitMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAllMarkets", + "outputs": [ + { + "internalType": "contract CToken[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAllRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAssetsIn", + "outputs": [ + { + "internalType": "contract CToken[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getBlockTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "cTokenModify", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "getHypotheticalAccountLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "initialIndexConstant", + "outputs": [ + { + "internalType": "uint224", + "name": "", + "type": "uint224" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isComptroller", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "cTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "cTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "liquidateBorrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "cTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "cTokenCollateral", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + } + ], + "name": "liquidateCalculateSeizeTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "liquidationIncentiveMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "liquidatorsWhitelistVerifier", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "markets", + "outputs": [ + { + "internalType": "bool", + "name": "isListed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "collateralFactorMantissa", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "cToken", + "type": "address" + }, + { + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mintGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract PriceOracle", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pauseGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingComptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "protocolTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "cToken", + "type": "address" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeemAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "cToken", + "type": "address" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeemVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "cToken", + "type": "address" + }, + { + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardAccrued", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardBorrowState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "timestamp", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardBorrowerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "rewardNativeToken", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardSupplierIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardSupplyState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "timestamp", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "cTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "cTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seizeAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "seizeGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newProtocolTokenAddress", + "type": "address" + } + ], + "name": "setProtocolTokenAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "rewardAddress", + "type": "address" + } + ], + "name": "setRewardType", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newLiquidatorsWhitelistVerifier", + "type": "address" + } + ], + "name": "setliquidatorsWhitelistAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyRewardSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "cToken", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "transferTokens", + "type": "uint256" + } + ], + "name": "transferAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "transferGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/src/flare_ai_kit/abis/kineticSflr.json b/src/flare_ai_kit/abis/kineticSflr.json new file mode 100644 index 00000000..36afad25 --- /dev/null +++ b/src/flare_ai_kit/abis/kineticSflr.json @@ -0,0 +1,1534 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "cashPrior", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "interestAccumulated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "info", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "detail", + "type": "uint256" + } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "cTokenCollateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "NewImplementation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPendingAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldProtocolSeizeShareMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newProtocolSeizeShareMantissa", + "type": "uint256" + } + ], + "name": "NewProtocolSeizeShare", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReserveFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "benefactor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + } + ], + "name": "_addReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "_reduceReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "_setComptroller", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "_setInterestRateModel", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "_setPendingAdmin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newProtocolSeizeShareMantissa", + "type": "uint256" + } + ], + "name": "_setProtocolSeizeShare", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "_setReserveFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOfUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountSnapshot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [ + { + "internalType": "contract InterestRateModel", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isCToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "contract CTokenInterface", + "name": "cTokenCollateral", + "type": "address" + } + ], + "name": "liquidateBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "protocolSeizeShareMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrowBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract EIP20NonStandardInterface", + "name": "token", + "type": "address" + } + ], + "name": "sweepToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/src/flare_ai_kit/abis/sceptre.json b/src/flare_ai_kit/abis/sceptre.json new file mode 100644 index 00000000..1034bca9 --- /dev/null +++ b/src/flare_ai_kit/abis/sceptre.json @@ -0,0 +1,116 @@ +[ + { + "inputs": [ + { + "internalType": "bytes21", + "name": "_feedId", + "type": "bytes21" + }, + { + "internalType": "bytes21", + "name": "_referenceFeedId", + "type": "bytes21" + }, + { + "internalType": "contract IFlareContractRegistry", + "name": "_flareContractRegistry", + "type": "address" + }, + { + "internalType": "contract ISFlr", + "name": "_sFlr", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "calculateFee", + "outputs": [ + { + "internalType": "uint256", + "name": "_fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feedId", + "outputs": [ + { + "internalType": "bytes21", + "name": "", + "type": "bytes21" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "flareContractRegistry", + "outputs": [ + { + "internalType": "contract IFlareContractRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCurrentFeed", + "outputs": [ + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "int8", + "name": "_decimals", + "type": "int8" + }, + { + "internalType": "uint64", + "name": "_timestamp", + "type": "uint64" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "referenceFeedId", + "outputs": [ + { + "internalType": "bytes21", + "name": "", + "type": "bytes21" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sFlr", + "outputs": [ + { + "internalType": "contract ISFlr", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/src/flare_ai_kit/abis/sceptreWflr.json b/src/flare_ai_kit/abis/sceptreWflr.json new file mode 100644 index 00000000..0656b2be --- /dev/null +++ b/src/flare_ai_kit/abis/sceptreWflr.json @@ -0,0 +1,1348 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_governance", + "type": "address" + }, + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "CreatedTotalSupplyCache", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "allowedAfterTimestamp", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "encodedCall", + "type": "bytes" + } + ], + "name": "GovernanceCallTimelocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "initialGovernance", + "type": "address" + } + ], + "name": "GovernanceInitialised", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "governanceSettings", + "type": "address" + } + ], + "name": "GovernedProductionModeEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "TimelockedGovernanceCallCanceled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "TimelockedGovernanceCallExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_contractType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_oldContractAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_newContractAddress", + "type": "address" + } + ], + "name": "VotePowerContractChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_count", + "type": "uint256" + } + ], + "name": "balanceHistoryCleanup", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "balanceOfAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_delegatees", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "_bips", + "type": "uint256[]" + } + ], + "name": "batchDelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_owners", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "batchVotePowerOfAt", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "cancelGovernanceCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "cleanerContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "cleanupBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "cleanupBlockNumberManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_bips", + "type": "uint256" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "delegateExplicit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "delegatesOf", + "outputs": [ + { + "internalType": "address[]", + "name": "_delegateAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "_bips", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_count", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_delegationMode", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "delegatesOfAt", + "outputs": [ + { + "internalType": "address[]", + "name": "_delegateAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "_bips", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_count", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_delegationMode", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_who", + "type": "address" + } + ], + "name": "delegationModeOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "depositTo", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "executeGovernanceCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governance", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governanceSettings", + "outputs": [ + { + "internalType": "contract IGovernanceSettings", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governanceVotePower", + "outputs": [ + { + "internalType": "contract IGovernanceVotePower", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initialGovernance", + "type": "address" + } + ], + "name": "initialise", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "productionMode", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "readVotePowerContract", + "outputs": [ + { + "internalType": "contract IVPContractEvents", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_who", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "revokeDelegationAt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_cleanerContract", + "type": "address" + } + ], + "name": "setCleanerContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "setCleanupBlockNumber", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_cleanupBlockNumberManager", + "type": "address" + } + ], + "name": "setCleanupBlockNumberManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IIGovernanceVotePower", + "name": "_governanceVotePower", + "type": "address" + } + ], + "name": "setGovernanceVotePower", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IIVPContract", + "name": "_vpContract", + "type": "address" + } + ], + "name": "setReadVpContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IIVPContract", + "name": "_vpContract", + "type": "address" + } + ], + "name": "setWriteVpContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "switchToProductionMode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "name": "timelockedCalls", + "outputs": [ + { + "internalType": "uint256", + "name": "allowedAfterTimestamp", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "encodedCall", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "totalSupplyAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "totalSupplyCacheCleanup", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_count", + "type": "uint256" + } + ], + "name": "totalSupplyHistoryCleanup", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalVotePower", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "totalVotePowerAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "totalVotePowerAtCached", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "undelegateAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_delegateAddresses", + "type": "address[]" + } + ], + "name": "undelegateAllExplicit", + "outputs": [ + { + "internalType": "uint256", + "name": "_remainingDelegation", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "undelegatedVotePowerOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "undelegatedVotePowerOfAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "votePowerFromTo", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "votePowerFromToAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "votePowerOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "votePowerOfAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "votePowerOfAtCached", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "votePowerOfAtIgnoringRevocation", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vpContractInitialized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "writeVotePowerContract", + "outputs": [ + { + "internalType": "contract IVPContractEvents", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/src/flare_ai_kit/ecosystem/applications/cyclo.py b/src/flare_ai_kit/ecosystem/applications/cyclo.py new file mode 100644 index 00000000..8e4e933b --- /dev/null +++ b/src/flare_ai_kit/ecosystem/applications/cyclo.py @@ -0,0 +1,160 @@ +from eth_typing import ChecksumAddress +from web3 import AsyncHTTPProvider, AsyncWeb3 +from web3.middleware import ( + ExtraDataToPOAMiddleware, # pyright: ignore[reportUnknownVariableType] +) + +from flare_ai_kit.common.utils import load_abi +from flare_ai_kit.config import AppSettings +from flare_ai_kit.ecosystem.settings import Contracts + + +class CycloClient: + """ + Client for interacting with the Cyclo protocol. + """ + + def __init__(self): + self.settings = AppSettings().ecosystem + self.client = AsyncWeb3( + AsyncHTTPProvider(str(self.settings.web3_provider_url)), + ) + self.client.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0) # pyright: ignore[reportUnknownArgumentType] + self.contracts = Contracts() + self.address = self.settings.account_address + self.private_key = self.settings.account_private_key + self.contract_address = self.contracts.flare.cyclo_cysflr + self.abi = load_abi("cyclo") + self.contract = self.client.eth.contract( + address=self.contract_address, + abi=self.abi, + ) + + def describe_cyclo_services(self) -> str: + return """ + Cyclo is a decentralized protocol on the Flare Network, + enabling users to create and manage synthetic assets. + It allows for the creation of synthetic assets that track the value of real-world assets, + providing a bridge between traditional finance and decentralized finance (DeFi). + Cyclo leverages the Flare Time Series Oracle (FTSOv2) for accurate price feeds, + ensuring that synthetic assets are always pegged to their underlying assets. + """ + + async def convert_to_shares(self, assets: int, id: int) -> int: + return await self.contract.functions.convertToShares(assets, id).call() + + async def convert_to_assets(self, shares: int, id: int) -> int: + return await self.contract.functions.convertToAssets(shares, id).call() + + async def deposit( + self, + amount: int, + receiver: ChecksumAddress, + min_share_ratio: int, + receipt_data: bytes, + ): + """ + Deposit assets into the Cyclo protocol. + """ + if self.address is None: + raise ValueError("Account address is not set") + nonce = await self.client.eth.get_transaction_count(self.address) + tx = await self.contract.functions.deposit( + amount, receiver, min_share_ratio, receipt_data + ).build_transaction( + { + "from": self.address, + "nonce": nonce, + "gas": 3000000, + "gasPrice": self.client.to_wei(50, "gwei"), + } + ) + if self.private_key is None: + raise ValueError("Private key is not set") + signed = self.client.eth.account.sign_transaction( + tx, self.private_key.get_secret_value() + ) + return await self.client.eth.send_raw_transaction(signed.raw_transaction) + + async def mint( + self, + shares: int, + receiver: ChecksumAddress, + min_share_ratio: int, + receipt_data: bytes, + ): + if self.address is None: + raise ValueError("Account address is not set") + nonce = await self.client.eth.get_transaction_count(self.address) + tx = await self.contract.functions.mint( + shares, receiver, min_share_ratio, receipt_data + ).build_transaction( + { + "from": self.address, + "nonce": nonce, + "gas": 3000000, + "gasPrice": self.client.to_wei(50, "gwei"), + } + ) + if self.private_key is None: + raise ValueError("Private key is not set") + signed = self.client.eth.account.sign_transaction( + tx, self.private_key.get_secret_value() + ) + return await self.client.eth.send_raw_transaction(signed.raw_transaction) + + async def withdraw( + self, + assets: int, + receiver: ChecksumAddress, + owner: ChecksumAddress, + id: int, + receipt_data: bytes, + ): + if self.address is None: + raise ValueError("Account address is not set") + nonce = await self.client.eth.get_transaction_count(self.address) + tx = await self.contract.functions.withdraw( + assets, receiver, owner, id, receipt_data + ).build_transaction( + { + "from": self.address, + "nonce": nonce, + "gas": 3000000, + "gasPrice": self.client.to_wei(50, "gwei"), + } + ) + if self.private_key is None: + raise ValueError("Private key is not set") + signed = self.client.eth.account.sign_transaction( + tx, self.private_key.get_secret_value() + ) + return await self.client.eth.send_raw_transaction(signed.raw_transaction) + + async def redeem( + self, + shares: int, + receiver: ChecksumAddress, + owner: ChecksumAddress, + id: int, + receipt_data: bytes, + ): + if self.address is None: + raise ValueError("Account address is not set") + nonce = await self.client.eth.get_transaction_count(self.address) + tx = await self.contract.functions.redeem( + shares, receiver, owner, id, receipt_data + ).build_transaction( + { + "from": self.address, + "nonce": nonce, + "gas": 3000000, + "gasPrice": self.client.to_wei(50, "gwei"), + } + ) + if self.private_key is None: + raise ValueError("Private key is not set") + signed = self.client.eth.account.sign_transaction( + tx, self.private_key.get_secret_value() + ) + return await self.client.eth.send_raw_transaction(signed.raw_transaction) diff --git a/src/flare_ai_kit/ecosystem/applications/kinetic.py b/src/flare_ai_kit/ecosystem/applications/kinetic.py new file mode 100644 index 00000000..3e703c0a --- /dev/null +++ b/src/flare_ai_kit/ecosystem/applications/kinetic.py @@ -0,0 +1,143 @@ +from eth_typing import ChecksumAddress +from web3 import AsyncHTTPProvider, AsyncWeb3 + +from flare_ai_kit.common.utils import load_abi +from flare_ai_kit.config import AppSettings +from flare_ai_kit.ecosystem.settings import Contracts + + +class KineticClient: + def __init__(self): + self.settings = AppSettings().ecosystem + self.client = AsyncWeb3( + AsyncHTTPProvider(str(self.settings.web3_provider_url)), + ) + self.contracts = Contracts() + self.contract_address = self.contracts.flare.kinetic_comptroller + self.ksflr_address = self.contracts.flare.kinetic_ksflr + self.abi = load_abi("kineticComptroller") + self.sflr_abi = load_abi("kineticSflr") + self.contract = self.client.eth.contract( + address=self.contract_address, + abi=self.abi, + ) + self.sflr_contract = self.client.eth.contract( + address=self.ksflr_address, + abi=self.sflr_abi, + ) + + async def describe_kinetic_services(self) -> str: + return """ + Kinetic is a leading lending protocol on the Flare Network, + reshaping decentralized finance (DeFi) with cutting-edge technology + and strategic partnerships. + Kinetic makes lending and borrowing digital assets like BTC, DOGE, + and XRP simple and secure. + Leveraging the Flare Time Series Oracle (FTSOv2) and FAssets, + we enable users to unlock the value of non-native assets + within a decentralized, trustless framework. + FTSOv2 provides reliable, decentralized price feeds, while + FAssets expand the range of assets available for lending and borrowing. + """ + + async def get_kinetic_contract_address(self) -> ChecksumAddress | None: + """ + Get the Kinetic contract address for the current network. + """ + return self.contract_address + + async def get_assets_in(self, user: ChecksumAddress) -> list[str]: + """ + Returns a list of markets the user has entered. + """ + try: + return await self.contract.functions.getAssetsIn(user).call() + except Exception as e: + raise RuntimeError(f"Failed to fetch assets in: {e}") + + async def get_account_liquidity(self, user: ChecksumAddress) -> dict[str, int]: + """ + Returns the account's liquidity and shortfall values. + """ + try: + ( + err, + liquidity, + shortfall, + ) = await self.contract.functions.getAccountLiquidity(user).call() + return {"error_code": err, "liquidity": liquidity, "shortfall": shortfall} + except Exception as e: + raise RuntimeError(f"Failed to fetch account liquidity: {e}") + + async def check_membership( + self, user: ChecksumAddress, ctoken_address: ChecksumAddress + ) -> bool: + """ + Checks whether a user has entered a specific market. + """ + try: + return await self.contract.functions.checkMembership( + user, ctoken_address + ).call() + except Exception as e: + raise RuntimeError(f"Failed to check membership: {e}") + + async def deposit(self, amount: int): + """ + Deposits KSFLR tokens to the Kinetic protocol. + """ + if self.settings.account_address is None: + raise ValueError("Address is not set") + try: + tx = await self.sflr_contract.functions.mint(amount).build_transaction( + { + "gas": 200000, + "gasPrice": await self.client.eth.gas_price, + "nonce": await self.client.eth.get_transaction_count( + self.settings.account_address + ), + } + ) + if self.settings.account_private_key is None: + raise ValueError("Private key is not set") + signed_tx = self.client.eth.account.sign_transaction( + tx, private_key=self.settings.account_private_key.get_secret_value() + ) + tx_hash = await self.client.eth.send_raw_transaction( + signed_tx.raw_transaction + ) + receipt = await self.client.eth.wait_for_transaction_receipt(tx_hash) + return receipt + except Exception as e: + raise RuntimeError(f"Failed to deposit KSFLR: {e}") + + async def withdraw(self, amount: int): + """ + Withdraws KSFLR tokens from the Kinetic protocol. + """ + if self.settings.account_address is None: + raise ValueError("Address is not set") + try: + tx = await self.sflr_contract.functions.redeemUnderlying( + amount + ).build_transaction( + { + "gas": 200000, + "gasPrice": await self.client.eth.gas_price, + "nonce": await self.client.eth.get_transaction_count( + self.settings.account_address + ), + } + ) + if self.settings.account_private_key is None: + raise ValueError("Private key is not set") + signed_tx = self.client.eth.account.sign_transaction( + tx, private_key=self.settings.account_private_key.get_secret_value() + ) + tx_hash = await self.client.eth.send_raw_transaction( + signed_tx.raw_transaction + ) + receipt = await self.client.eth.wait_for_transaction_receipt(tx_hash) + return receipt + except Exception as e: + raise RuntimeError(f"Failed to withdraw KSFLR: {e}") diff --git a/src/flare_ai_kit/ecosystem/applications/open_ocean.py b/src/flare_ai_kit/ecosystem/applications/open_ocean.py new file mode 100644 index 00000000..e9a78c78 --- /dev/null +++ b/src/flare_ai_kit/ecosystem/applications/open_ocean.py @@ -0,0 +1,108 @@ +import httpx +import structlog + +from flare_ai_kit.config import AppSettings +from flare_ai_kit.ecosystem.applications.open_ocean_models import * + +logger = structlog.get_logger(__name__) + + +class OpenOceanConnector: + """ + Connector class to interface with OpenOcean v4 API for DEX aggregation. + """ + + BASE_URL = "https://open-api.openocean.finance/v4" + + def __init__(self): + self.settings = AppSettings().ecosystem + self.client = httpx.AsyncClient(timeout=self.settings.web3_provider_timeout) + + async def describe_openocean_services(self) -> str: + return """ + OpenOcean is a leading DEX aggregator that sources liquidity across multiple decentralized exchanges (DEXes) on various EVM-compatible chains. It allows you to: + - Get the best swap quote across supported DEXes + - Estimate trade output and slippage + - Prepare swap transactions with calldata + - Fetch token and DEX metadata + - Decode input data and track transactions + """ + + async def swap(self, params: OpenOceanQuoteRequest) -> SwapQuoteResponse: + """ + Swap method to get a quote for swapping tokens on OpenOcean. + """ + logger.info("Requesting OpenOcean quote", params=params.model_dump()) + try: + url = f"{self.BASE_URL}/{params.chain}/quote" + query = { + "inTokenAddress": params.in_token_address, + "outTokenAddress": params.out_token_address, + "amountDecimals": params.amount_decimals, + "slippage": params.slippage, + } + + if params.gas_price_decimals: + query["gasPriceDecimals"] = params.gas_price_decimals + if params.enabled_dex_ids: + query["enabledDexIds"] = params.enabled_dex_ids + if params.disabled_dex_ids: + query["disabledDexIds"] = params.disabled_dex_ids + if params.account: + query["account"] = params.account + + response = await self.client.get(url, params=query) + response.raise_for_status() + data = response.json() + + if data.get("code") != 200: + raise RuntimeError(f"OpenOcean API error: {data}") + return data["data"] + except Exception as e: + logger.exception("Failed OpenOcean quote fetch", error=str(e)) + raise + + async def get_token_list(self, chain: str) -> TokenListResponse: + """ + Get list of available tokens on a given chain. + """ + logger.info("Fetching OpenOcean token list", chain=chain) + url = f"{self.BASE_URL}/{chain}/tokenList" + try: + response = await self.client.get(url) + response.raise_for_status() + return response.json().get("data", []) + except Exception as e: + logger.exception("Failed fetching token list", error=str(e)) + raise + + async def get_dex_list(self, chain: str) -> DexListResponse: + """ + Get list of supported DEXes on a given chain. + """ + logger.info("Fetching OpenOcean DEX list", chain=chain) + url = f"{self.BASE_URL}/{chain}/dexList" + try: + response = await self.client.get(url) + response.raise_for_status() + return response.json().get("data", []) + except Exception as e: + logger.exception("Failed fetching DEX list", error=str(e)) + raise + + async def get_transaction(self, hash: str, chain: str) -> TransactionResponse: + """ + Get transaction data by hash for a given chain. + """ + logger.info("Fetching OpenOcean transaction", hash=hash, chain=chain) + url = f"{self.BASE_URL}/{chain}/getTransaction" + try: + response = await self.client.get(url, params={"hash": hash}) + response.raise_for_status() + return response.json().get("data", {}) + except Exception as e: + logger.exception("Failed fetching transaction", error=str(e)) + raise + + async def close(self): + await self.client.aclose() diff --git a/src/flare_ai_kit/ecosystem/applications/open_ocean_models.py b/src/flare_ai_kit/ecosystem/applications/open_ocean_models.py new file mode 100644 index 00000000..cdb4b3cb --- /dev/null +++ b/src/flare_ai_kit/ecosystem/applications/open_ocean_models.py @@ -0,0 +1,75 @@ +from pydantic import BaseModel, Field + + +class OpenOceanQuoteRequest(BaseModel): + BASE_URL: str = "https://openocean.finance/api/v4" + chain: str = Field( + default="flare", description="Target chain (e.g., 'flare', 'bsc')" + ) + in_token_address: str + out_token_address: str + amount_decimals: str = Field( + ..., description="Amount with decimals (e.g., 5000000000000000000)" + ) + gas_price_decimals: str | None = None + slippage: str = Field( + default="1", description="Slippage as percentage string (e.g., '1')" + ) + enabled_dex_ids: str | None = None + disabled_dex_ids: str | None = None + account: str | None = None + + +class TokenInfo(BaseModel): + address: str + decimals: int + symbol: str + name: str + usd: str | None = None + volume: float | None = None + + +class DexInfo(BaseModel): + id: str + name: str + url: str | None = None + logo: str | None = None + liquidity: str | None = None + + +class SwapQuoteResponse(BaseModel): + in_token: TokenInfo = Field(alias="inToken") + out_token: TokenInfo = Field(alias="outToken") + in_amount: str + out_amount: str + min_out_amount: str + estimated_gas: str + gas_price: str | None = None + gas_token_price: str | None = None + slippage: str | None = None + path: list[str] | None = None + dex_ids: list[str] | None = Field(default=None, alias="dexIds") + + +class TokenListResponse(BaseModel): + tokens: list[TokenInfo] + + +class DexListResponse(BaseModel): + dexes: list[DexInfo] + + +class TransactionInfo(BaseModel): + hash: str + from_address: str = Field(alias="from") + to_address: str = Field(alias="to") + value: str + gas_price: str + gas_used: str | None = None + status: int | None = None + block_number: str | None = None + timestamp: str | None = None + + +class TransactionResponse(BaseModel): + data: TransactionInfo diff --git a/src/flare_ai_kit/ecosystem/applications/sceptre.py b/src/flare_ai_kit/ecosystem/applications/sceptre.py new file mode 100644 index 00000000..6b7ba127 --- /dev/null +++ b/src/flare_ai_kit/ecosystem/applications/sceptre.py @@ -0,0 +1,176 @@ +from eth_typing import ChecksumAddress +from web3 import AsyncHTTPProvider, AsyncWeb3 +from web3.types import TxParams, Wei + +from flare_ai_kit.common.utils import load_abi +from flare_ai_kit.config import AppSettings +from flare_ai_kit.ecosystem.settings import Contracts + + +class SceptreClient: + def __init__(self): + self.settings = AppSettings().ecosystem + self.client = AsyncWeb3( + AsyncHTTPProvider(str(self.settings.web3_provider_url)), + ) + self.contracts = Contracts() + + async def describe_sceptre_services(self) -> str: + return """ + Sceptre is bringing a safe, efficient and well-integrated + liquid staking experience to the users and ecosystem partners + on the Flare network. + """ + + async def get_sceptre_contract_address(self) -> ChecksumAddress | None: + """ + Get the Sceptre contract address for the current network. + """ + return self.contracts.flare.sceptre_contract_address + + async def get_current_feed(self): + """ + Calls the `getCurrentFeed()` method on the contract. + """ + contract_address = await self.get_sceptre_contract_address() + if not contract_address: + raise ValueError( + "Sceptre contract address is not set for the current network." + ) + + abi = load_abi("sceptre") + contract = self.client.eth.contract( + address=contract_address, + abi=abi, + ) + try: + tx_params: TxParams = {"value": Wei(0)} + value, decimals, timestamp = await contract.functions.getCurrentFeed().call( + tx_params + ) + return { + "value": value, + "decimals": decimals, + "timestamp": timestamp, + } + except Exception as e: + raise RuntimeError(f"Failed to fetch current feed from Sceptre: {e}") + + async def get_feed_id(self) -> str: + """ + Calls the `getFeedId()` method on the contract. + """ + contract_address = await self.get_sceptre_contract_address() + if not contract_address: + raise ValueError( + "Sceptre contract address is not set for the current network." + ) + + abi = load_abi("sceptre") + contract = self.client.eth.contract( + address=contract_address, + abi=abi, + ) + try: + feed_id = await contract.functions.feedId().call() + return feed_id.decode("utf-8").split("\x00")[0] + except Exception as e: + raise RuntimeError(f"Failed to fetch feed ID from Sceptre: {e}") + + async def calculateFee(self) -> int: + """ + Calls the `calculateFee()` method on the contract. + """ + contract_address = await self.get_sceptre_contract_address() + if not contract_address: + raise ValueError( + "Sceptre contract address is not set for the current network." + ) + + abi = load_abi("sceptre") + contract = self.client.eth.contract( + address=contract_address, + abi=abi, + ) + try: + fee = await contract.functions.calculateFee().call() + return fee + except Exception as e: + raise RuntimeError(f"Failed to calculate fee from Sceptre: {e}") + + async def deposit(self, amount: int, to: ChecksumAddress) -> str: + """ + Calls the `depositTo()` method on the contract. + """ + amount = Wei(amount) + contract_address = await self.get_sceptre_contract_address() + if not contract_address: + raise ValueError( + "Sceptre contract address is not set for the current network." + ) + + abi = load_abi("sceptreWflr") + contract = self.client.eth.contract( + address=contract_address, + abi=abi, + ) + if self.settings.account_address is None: + raise ValueError("Address is not set") + try: + param: TxParams = { + "from": self.settings.account_address, + "value": amount, + "gas": 300000, + "gasPrice": self.client.to_wei(50, "gwei"), + "nonce": await self.client.eth.get_transaction_count( + self.settings.account_address + ), + } + tx = await contract.functions.depositTo(to).build_transaction(param) + if self.settings.account_private_key is None: + raise ValueError("Private key is not set") + signed = self.client.eth.account.sign_transaction( + tx, self.settings.account_private_key.get_secret_value() + ) + tx_hash = await self.client.eth.send_raw_transaction(signed.raw_transaction) + return tx_hash.hex() + except Exception as e: + raise RuntimeError(f"Failed to deposit to Sceptre: {e}") + + async def withdraw(self, amount: int) -> str: + """ + Calls the `withdraw()` method on the contract. + """ + contract_address = await self.get_sceptre_contract_address() + if not contract_address: + raise ValueError( + "Sceptre contract address is not set for the current network." + ) + + abi = load_abi("sceptreWflr") + contract = self.client.eth.contract( + address=contract_address, + abi=abi, + ) + if self.settings.account_address is None: + raise ValueError("Address is not set") + try: + tx = await contract.functions.withdraw(amount).build_transaction( + { + "from": self.settings.account_address, + "gas": 300000, + "gasPrice": self.client.to_wei(50, "gwei"), + "nonce": await self.client.eth.get_transaction_count( + self.settings.account_address + ), + } + ) + if self.settings.account_private_key is None: + raise ValueError("Private key is not set") + signed = self.client.eth.account.sign_transaction( + tx, self.settings.account_private_key.get_secret_value() + ) + tx_hash = await self.client.eth.send_raw_transaction(signed.raw_transaction) + return tx_hash.hex() + except Exception as e: + raise RuntimeError(f"Failed to withdraw from Sceptre: {e}") diff --git a/src/flare_ai_kit/ecosystem/applications/sparkdex.py b/src/flare_ai_kit/ecosystem/applications/sparkdex.py new file mode 100644 index 00000000..2face83f --- /dev/null +++ b/src/flare_ai_kit/ecosystem/applications/sparkdex.py @@ -0,0 +1,90 @@ +import httpx +from eth_typing import ChecksumAddress +from web3 import AsyncHTTPProvider, AsyncWeb3 +from web3.middleware import ( + ExtraDataToPOAMiddleware, # pyright: ignore[reportUnknownVariableType] +) + +from flare_ai_kit.common.utils import load_abi +from flare_ai_kit.config import AppSettings +from flare_ai_kit.ecosystem.settings import Contracts + + +class SparkDEXClient: + def __init__(self): + self.settings = AppSettings().ecosystem + self.client = AsyncWeb3( + AsyncHTTPProvider(str(self.settings.web3_provider_url)), + ) + self.client.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0) # pyright: ignore[reportUnknownArgumentType] + self.contracts = Contracts() + self.address = self.settings.account_address + self.private_key = self.settings.account_private_key + self.contract_address = self.contracts.flare.sparkdex_universal_router + self.abi = load_abi("SparkDEXRouter") + self.contract = self.client.eth.contract( + address=self.contract_address, + abi=self.abi, + ) + + async def describe_sparkDEX_services(self) -> str: + return """ + SparkDEX is a decentralized exchange (DEX) on the Flare Network, + enabling fast and secure token swaps with low fees. + """ + + async def quote(self, amount_a: int, reserve_a: int, reserve_b: int) -> int: + """ + Get a quote for swapping amount_a of token A to token B based on reserves. + """ + return await self.contract.functions.quote( + amount_a, reserve_a, reserve_b + ).call() + + async def swap( + self, + amountIn: int, + amountOutMin: int, + path: list[ChecksumAddress], + to: ChecksumAddress, + deadline: int, + ) -> str: + """ + Execute a token swap on SparkDEX. + """ + gas_price = self.client.to_wei(50, "gwei") + if self.address is None: + raise ValueError("Account address is not set") + try: + tx = await self.contract.functions.swapExactTokensForTokens( + amountIn, amountOutMin, path, to, deadline + ).build_transaction( + { + "from": self.address, + "gas": 3000000, + "gasPrice": gas_price, + "nonce": await self.client.eth.get_transaction_count(self.address), + } + ) + if self.private_key is None: + raise ValueError("Private key is not set") + private_key = self.private_key.get_secret_value() + signed = self.client.eth.account.sign_transaction(tx, private_key) + tx_hash = await self.client.eth.send_raw_transaction(signed.raw_transaction) + return tx_hash.hex() + + except Exception as e: + print(f"Error during swap: {e}") + raise RuntimeError("Swap transaction failed") from e + + async def get_prices(self, token: str = "SPRK") -> int | str | None: + url = f"https://api.sparkdex.ai/price/latest?symbols={token}" + async with httpx.AsyncClient() as client: + try: + response = await client.get(url) + response.raise_for_status() # Raise an exception for HTTP errors + return response.json().get(f"{token}") + except httpx.HTTPStatusError as e: + print(f"HTTP error occurred: {e}") + except Exception as e: + print(f"An error occurred: {e}") diff --git a/src/flare_ai_kit/ecosystem/applications/stargate.py b/src/flare_ai_kit/ecosystem/applications/stargate.py new file mode 100644 index 00000000..c682c966 --- /dev/null +++ b/src/flare_ai_kit/ecosystem/applications/stargate.py @@ -0,0 +1,45 @@ +import httpx + +from flare_ai_kit.ecosystem.applications.stargate_models import * + + +class StargateClient: + def __init__(self): + self.base_url = "https://stargate.finance/api/v1" + + async def describe_stargate_services(self) -> str: + return """ + Stargate is a composable cross-chain liquidity transport protocol enabling seamless asset transfers between blockchains. + It allows users to: + - Swap tokens across different chains + - Provide liquidity to cross-chain pools + - Earn yield on cross-chain assets + - Access a wide range of assets and chains through a single interface + """ + + async def quote( + self, + src_token: str, + dst_token: str, + src_chain_key: str, + dst_chain_key: str, + src_address: str, + dst_address: str, + src_amount: int, + dst_amount_min: int, + ) -> StargateQuoteResponse: + params = { + "srcToken": src_token, + "dstToken": dst_token, + "srcChainKey": src_chain_key, + "dstChainKey": dst_chain_key, + "srcAddress": src_address, + "dstAddress": dst_address, + "srcAmount": str(src_amount), + "dstAmountMin": str(dst_amount_min), + } + + async with httpx.AsyncClient() as client: + response = await client.get(f"{self.base_url}/quotes", params=params) + response.raise_for_status() + return StargateQuoteResponse(**response.json()) diff --git a/src/flare_ai_kit/ecosystem/applications/stargate_models.py b/src/flare_ai_kit/ecosystem/applications/stargate_models.py new file mode 100644 index 00000000..7f50ca25 --- /dev/null +++ b/src/flare_ai_kit/ecosystem/applications/stargate_models.py @@ -0,0 +1,53 @@ +# flare_ai_kit/ecosystem/applications/stargate_models.py +from pydantic import BaseModel + + +class StargateQuoteFee(BaseModel): + token: str + chainKey: str + amount: str + type: str + + +class StargateQuoteDuration(BaseModel): + estimated: float + + +class StargateQuoteTransaction(BaseModel): + data: str + to: str + value: str + from_: str # renamed because `from` is a reserved keyword + + class Config: + fields = {"from_": "from"} + + +class StargateQuoteStep(BaseModel): + type: str + sender: str + chainKey: str + transaction: StargateQuoteTransaction + + +class StargateQuote(BaseModel): + route: str + error: str | None + srcAmount: str + dstAmount: str + srcAmountMax: str + dstAmountMin: str + srcToken: str + dstToken: str + srcAddress: str + dstAddress: str + srcChainKey: str + dstChainKey: str + dstNativeAmount: str + duration: StargateQuoteDuration + fees: list[StargateQuoteFee] + steps: list[StargateQuoteStep] + + +class StargateQuoteResponse(BaseModel): + quotes: list[StargateQuote] diff --git a/src/flare_ai_kit/ecosystem/settings.py b/src/flare_ai_kit/ecosystem/settings.py index f2fcfd15..0df71da5 100644 --- a/src/flare_ai_kit/ecosystem/settings.py +++ b/src/flare_ai_kit/ecosystem/settings.py @@ -21,6 +21,9 @@ class ContractAddresses(BaseModel): sparkdex_swap_router: ChecksumAddress | None = None kinetic_comptroller: ChecksumAddress | None = None kinetic_ksflr: ChecksumAddress | None = None + sceptre_contract_address: ChecksumAddress | None = None + cyclo_cysflr: ChecksumAddress | None = None + cyclo_receipts_cysflr: ChecksumAddress | None = None class Contracts(BaseModel): @@ -40,6 +43,15 @@ class Contracts(BaseModel): kinetic_ksflr=cast( "ChecksumAddress", "0x291487beC339c2fE5D83DD45F0a15EFC9Ac45656" ), + cyclo_cysflr=cast( + "ChecksumAddress", "0x19831cfB53A0dbeAD9866C43557C1D48DfF76567" + ), + sceptre_contract_address=cast( + "ChecksumAddress", "0xD1002F3820ad32145b868aD889eC7753E3944c8D" + ), + cyclo_receipts_cysflr=cast( + "ChecksumAddress", "0xd387FC43E19a63036d8FCeD559E81f5dDeF7ef09" + ), ) coston2: ContractAddresses = ContractAddresses()