diff --git a/src/contracts/abis/BlocklistVaultDiffAbi.json b/src/contracts/abis/BlocklistVaultDiffAbi.json index 74dfac40..b0d66f3a 100644 --- a/src/contracts/abis/BlocklistVaultDiffAbi.json +++ b/src/contracts/abis/BlocklistVaultDiffAbi.json @@ -1,4 +1,17 @@ [ + { + "inputs": [ + { + "internalType": "address", + "name": "_blocklistManager", + "type": "address" + } + ], + "name": "setBlocklistManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/src/contracts/abis/PrivateVaultDiffAbi.json b/src/contracts/abis/PrivateVaultDiffAbi.json index ccaa55b4..f0aa2397 100644 --- a/src/contracts/abis/PrivateVaultDiffAbi.json +++ b/src/contracts/abis/PrivateVaultDiffAbi.json @@ -1,4 +1,17 @@ [ + { + "inputs": [ + { + "internalType": "address", + "name": "_whitelister", + "type": "address" + } + ], + "name": "setWhitelister", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/src/contracts/abis/VaultAbi.json b/src/contracts/abis/VaultAbi.json index 837c4eb5..f5e6ba88 100644 --- a/src/contracts/abis/VaultAbi.json +++ b/src/contracts/abis/VaultAbi.json @@ -1 +1,457 @@ -[ { "inputs": [ { "internalType": "address", "name": "user", "type": "address" } ], "name": "osTokenPositions", "outputs": [ { "internalType": "uint128", "name": "shares", "type": "uint128" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint128", "name": "osTokenShares", "type": "uint128" } ], "name": "burnOsToken", "outputs": [ { "internalType": "uint256", "name": "assets", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "receiver", "type": "address" }, { "internalType": "uint256", "name": "osTokenShares", "type": "uint256" }, { "internalType": "address", "name": "referrer", "type": "address" } ], "name": "mintOsToken", "outputs": [ { "internalType": "uint256", "name": "assets", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "shares", "type": "uint256" } ], "name": "convertToAssets", "outputs": [ { "internalType": "uint256", "name": "assets", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "positionTicket", "type": "uint256" } ], "name": "getExitQueueIndex", "outputs": [ { "internalType": "int256", "name": "", "type": "int256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "receiver", "type": "address" }, { "internalType": "uint256", "name": "positionTicket", "type": "uint256" }, { "internalType": "uint256", "name": "timestamp", "type": "uint256" }, { "internalType": "uint256", "name": "exitQueueIndex", "type": "uint256" } ], "name": "calculateExitedAssets", "outputs": [ { "internalType": "uint256", "name": "leftShares", "type": "uint256" }, { "internalType": "uint256", "name": "claimedShares", "type": "uint256" }, { "internalType": "uint256", "name": "claimedAssets", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "positionTicket", "type": "uint256" }, { "internalType": "uint256", "name": "timestamp", "type": "uint256" }, { "internalType": "uint256", "name": "exitQueueIndex", "type": "uint256" } ], "name": "claimExitedAssets", "outputs": [ { "internalType": "uint256", "name": "newPositionTicket", "type": "uint256" }, { "internalType": "uint256", "name": "claimedShares", "type": "uint256" }, { "internalType": "uint256", "name": "claimedAssets", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "receiver", "type": "address" }, { "internalType": "address", "name": "referrer", "type": "address" }, { "components": [ { "internalType": "bytes32", "name": "rewardsRoot", "type": "bytes32" }, { "internalType": "int160", "name": "reward", "type": "int160" }, { "internalType": "uint160", "name": "unlockedMevReward", "type": "uint160" }, { "internalType": "bytes32[]", "name": "proof", "type": "bytes32[]" } ], "internalType": "struct IKeeperRewards.HarvestParams", "name": "harvestParams", "type": "tuple" } ], "name": "updateStateAndDeposit", "outputs": [ { "internalType": "uint256", "name": "shares", "type": "uint256" } ], "stateMutability": "payable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "receiver", "type": "address" }, { "internalType": "address", "name": "referrer", "type": "address" } ], "name": "deposit", "outputs": [ { "internalType": "uint256", "name": "shares", "type": "uint256" } ], "stateMutability": "payable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "assets", "type": "uint256" } ], "name": "convertToShares", "outputs": [ { "internalType": "uint256", "name": "shares", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "shares", "type": "uint256" }, { "internalType": "address", "name": "receiver", "type": "address" } ], "name": "enterExitQueue", "outputs": [ { "internalType": "uint256", "name": "positionTicket", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "shares", "type": "uint256" }, { "internalType": "address", "name": "receiver", "type": "address" } ], "name": "redeem", "outputs": [ { "internalType": "uint256", "name": "assets", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_validatorsRoot", "type": "bytes32" } ], "name": "setValidatorsRoot", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes[]", "name": "data", "type": "bytes[]" } ], "name": "multicall", "outputs": [ { "internalType": "bytes[]", "name": "results", "type": "bytes[]" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" } ], "name": "getShares", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "bytes32", "name": "rewardsRoot", "type": "bytes32" }, { "internalType": "int160", "name": "reward", "type": "int160" }, { "internalType": "uint160", "name": "unlockedMevReward", "type": "uint160" }, { "internalType": "bytes32[]", "name": "proof", "type": "bytes32[]" } ], "internalType": "struct IKeeperRewards.HarvestParams", "name": "harvestParams", "type": "tuple" } ], "name": "updateState", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ] +[ + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "osTokenPositions", + "outputs": [ + { + "internalType": "uint128", + "name": "shares", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "osTokenShares", + "type": "uint128" + } + ], + "name": "burnOsToken", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "osTokenShares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "mintOsToken", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "convertToAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "positionTicket", + "type": "uint256" + } + ], + "name": "getExitQueueIndex", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "positionTicket", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exitQueueIndex", + "type": "uint256" + } + ], + "name": "calculateExitedAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "leftShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimedShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimedAssets", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "positionTicket", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exitQueueIndex", + "type": "uint256" + } + ], + "name": "claimExitedAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "newPositionTicket", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimedShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimedAssets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardsRoot", + "type": "bytes32" + }, + { + "internalType": "int160", + "name": "reward", + "type": "int160" + }, + { + "internalType": "uint160", + "name": "unlockedMevReward", + "type": "uint160" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + } + ], + "internalType": "struct IKeeperRewards.HarvestParams", + "name": "harvestParams", + "type": "tuple" + } + ], + "name": "updateStateAndDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "convertToShares", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "enterExitQueue", + "outputs": [ + { + "internalType": "uint256", + "name": "positionTicket", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_validatorsRoot", + "type": "bytes32" + } + ], + "name": "setValidatorsRoot", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardsRoot", + "type": "bytes32" + }, + { + "internalType": "int160", + "name": "reward", + "type": "int160" + }, + { + "internalType": "uint160", + "name": "unlockedMevReward", + "type": "uint160" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + } + ], + "internalType": "struct IKeeperRewards.HarvestParams", + "name": "harvestParams", + "type": "tuple" + } + ], + "name": "updateState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "metadataIpfsHash", + "type": "string" + } + ], + "name": "setMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeRecipient", + "type": "address" + } + ], + "name": "setFeeRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keysManager", + "type": "address" + } + ], + "name": "setKeysManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/src/contracts/createContracts.ts b/src/contracts/createContracts.ts index 8809cf16..e92d5fef 100644 --- a/src/contracts/createContracts.ts +++ b/src/contracts/createContracts.ts @@ -23,100 +23,77 @@ import { UniswapPositionManagerAbi, } from './abis' -import type { - UniswapPositionManagerAbi as UniswapPositionManagerType, - RewardSplitterFactoryAbi as RewardSplitterFactoryType, - VestingEscrowFactoryAbi as VestingEscrowFactoryType, - MintTokenControllerAbi as MintTokenControllerType, - BlocklistVaultDiffAbi as BlocklistVaultDiffType, - PrivateVaultDiffAbi as PrivateVaultDiffType, - MintTokenConfigAbi as MintTokenConfigType, - VaultsRegistryAbi as VaultsRegistryType, - RewardSplitterAbi as RewardSplitterType, - V2RewardTokenAbi as V2RewardTokenType, - VestingEscrowAbi as VestingEscrowType, - VaultFactoryAbi as VaultFactoryType, - PriceOracleAbi as PriceOracleType, - UniswapPoolAbi as UniswapPoolType, - MulticallAbi as MulticallType, - MintTokenAbi as MintTokenType, - UsdRateAbi as UsdRateType, - VaultAbi as VaultAbiType, - KeeperAbi as KeeperType, - Erc20Abi as Erc20Type, -} from './types' - import multicall from './multicall' import createContract from './createContract' -const getSwiseToken = (provider: Provider, config: StakeWise.Config) => createContract( +const getSwiseToken = (provider: Provider, config: StakeWise.Config) => createContract( config.addresses.tokens.swise, Erc20Abi, provider ) -const getMulticall = (provider: Provider, config: StakeWise.Config) => createContract( +const getMulticall = (provider: Provider, config: StakeWise.Config) => createContract( config.addresses.base.multicall, MulticallAbi, provider ) -const getVaultFactory = (provider: Provider, address: string) => createContract( +const getVaultFactory = (provider: Provider, address: string) => createContract( address, VaultFactoryAbi, provider ) -const getVaultsRegistry = (provider: Provider, config: StakeWise.Config) => createContract( +const getVaultsRegistry = (provider: Provider, config: StakeWise.Config) => createContract( config.addresses.base.vaultsRegistry, VaultsRegistryAbi, provider ) -const getRewardSplitterFactory = (provider: Provider, config: StakeWise.Config) => createContract( +const getRewardSplitterFactory = (provider: Provider, config: StakeWise.Config) => createContract( config.addresses.base.rewardSplitterFactory, RewardSplitterFactoryAbi, provider ) -const getKeeper = (provider: Provider, config: StakeWise.Config) => createContract( +const getKeeper = (provider: Provider, config: StakeWise.Config) => createContract( config.addresses.base.keeper, KeeperAbi, provider ) -const getMintToken = (provider: Provider, config: StakeWise.Config) => createContract( +const getMintToken = (provider: Provider, config: StakeWise.Config) => createContract( config.addresses.tokens.mintToken, MintTokenAbi, provider ) -const getMintTokenConfig = (provider: Provider, config: StakeWise.Config) => createContract( +const getMintTokenConfig = (provider: Provider, config: StakeWise.Config) => createContract( config.addresses.base.mintTokenConfig, MintTokenConfigAbi, provider ) -const getMintTokenController = (provider: Provider, config: StakeWise.Config) => createContract( +const getMintTokenController = (provider: Provider, config: StakeWise.Config) => createContract( config.addresses.base.mintTokenController, MintTokenControllerAbi, provider ) -const getPriceOracle = (provider: Provider, config: StakeWise.Config) => createContract( +const getPriceOracle = (provider: Provider, config: StakeWise.Config) => createContract( config.addresses.base.priceOracle, PriceOracleAbi, provider ) -const getV2RewardToken = (provider: Provider, config: StakeWise.Config) => createContract( +const getV2RewardToken = (provider: Provider, config: StakeWise.Config) => createContract( config.addresses.tokens.v2RewardToken, V2RewardTokenAbi, provider ) -const getUniswapPositionManager = (provider: Provider, config: StakeWise.Config) => createContract( +const getUniswapPositionManager = (provider: Provider, config: StakeWise.Config) => createContract( config.addresses.uniswap.positionManager, UniswapPositionManagerAbi, provider @@ -135,16 +112,16 @@ export const createContracts = (input: CreateContractsInput) => { return { helpers: { multicallContract, - createMulticall: multicall(multicallContract as MulticallType), - createErc20: (address: string) => createContract(address, Erc20Abi, provider), - createVault: (address: string) => createContract(address, VaultAbi, provider), - createUniswapPool: (address: string) => createContract(address, UniswapPoolAbi, provider), - createPrivateVault: (address: string) => createContract(address, PrivateVaultAbi, provider), - createBlocklistVault: (address: string) => createContract(address, BlocklistVaultAbi, provider), - createRewardSplitter: (address: string) => createContract(address, RewardSplitterAbi, provider), - createVestingEscrowDirect: (address: string) => createContract(address, VestingEscrowAbi, provider), - createUsdRate: (address: string, _provider?: Provider) => createContract(address, UsdRateAbi, _provider || provider), - createVestingEscrowFactory: (address: string) => createContract(address, VestingEscrowFactoryAbi, provider), + createMulticall: multicall(multicallContract as StakeWise.ABI.Multicall), + createErc20: (address: string) => createContract(address, Erc20Abi, provider), + createVault: (address: string) => createContract(address, VaultAbi, provider), + createUniswapPool: (address: string) => createContract(address, UniswapPoolAbi, provider), + createPrivateVault: (address: string) => createContract(address, PrivateVaultAbi, provider), + createBlocklistVault: (address: string) => createContract(address, BlocklistVaultAbi, provider), + createRewardSplitter: (address: string) => createContract(address, RewardSplitterAbi, provider), + createVestingEscrowDirect: (address: string) => createContract(address, VestingEscrowAbi, provider), + createUsdRate: (address: string, _provider?: Provider) => createContract(address, UsdRateAbi, _provider || provider), + createVestingEscrowFactory: (address: string) => createContract(address, VestingEscrowFactoryAbi, provider), }, base: { keeper: getKeeper(provider, config), diff --git a/src/types/global.ts b/src/types/global.ts index 61262ec4..fb1322d1 100644 --- a/src/types/global.ts +++ b/src/types/global.ts @@ -21,6 +21,7 @@ import type { MintTokenConfigAbi, PrivateVaultDiffAbi, BlocklistVaultDiffAbi, + MintTokenControllerAbi, VestingEscrowFactoryAbi, RewardSplitterFactoryAbi, UniswapPositionManagerAbi, @@ -78,6 +79,7 @@ declare global { type RewardSplitter = RewardSplitterAbi type VaultsRegistry = VaultsRegistryAbi type MintTokenConfig = MintTokenConfigAbi + type MintTokenController = MintTokenControllerAbi type VestingEscrowFactory = VestingEscrowFactoryAbi type RewardSplitterFactory = RewardSplitterFactoryAbi type UniswapPositionManager = UniswapPositionManagerAbi