feat(vault): add user vault factory, non-custodial deposit/withdraw and session key UI

This commit is contained in:
Bot
2026-08-31 01:41:57 +08:00
parent 7e554402b2
commit 4890329f99
6 changed files with 607 additions and 9 deletions
@@ -0,0 +1,294 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Deposited",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "target",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "Executed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "sessionKey",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "expiry",
"type": "uint256"
}
],
"name": "SessionAuthorized",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "sessionKey",
"type": "address"
}
],
"name": "SessionRevoked",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Withdrawn",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approveToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "sessionKey",
"type": "address"
},
{
"internalType": "uint256",
"name": "duration",
"type": "uint256"
}
],
"name": "authorizeSession",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "execute",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "factory",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "isRelayer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "sessionKey",
"type": "address"
}
],
"name": "revokeSession",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "sessionExpiry",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
@@ -0,0 +1,103 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "vault",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "vaultIndex",
"type": "uint256"
}
],
"name": "VaultCreated",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "allVaults",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "getOrCreateVault",
"outputs": [
{
"internalType": "address",
"name": "vault",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "getVault",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "predictVaultAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}
]
+5 -1
View File
@@ -1,12 +1,16 @@
import WTFControllerV2Abi from './abis/WTFControllerV2.json';
import MockERC20Abi from './abis/MockERC20.json';
import WTFMarketV2Abi from './abis/WTFMarketV2.json';
import WTFVaultFactoryAbi from './abis/WTFVaultFactory.json';
import WTFUserVaultAbi from './abis/WTFUserVault.json';
import robinhoodTestnetDeployment from './robinhoodTestnet.json';
export const ABIS = {
WTFControllerV2: WTFControllerV2Abi,
MockERC20: MockERC20Abi,
WTFMarketV2: WTFMarketV2Abi
WTFMarketV2: WTFMarketV2Abi,
WTFVaultFactory: WTFVaultFactoryAbi,
WTFUserVault: WTFUserVaultAbi
};
export const DEPLOYMENTS = {
+2 -1
View File
@@ -7,7 +7,8 @@
"collateral": "0xe776e957953EA69b7Eaa9d7d4098aBC076bDD5E7",
"powerLDACurve": "0xF0E189974c413506098AFB6Bc6Bf4C6715fBf7B1",
"controllerImplementation": "0x2Aeca49669e9E4E6CdCe46A1bc9bf136765A4f75",
"controllerProxy": "0xc0E24E152771C588B21AEB654b30B1cBAf381c1a"
"controllerProxy": "0xc0E24E152771C588B21AEB654b30B1cBAf381c1a",
"vaultFactory": "0x89401e07296267c01017cA150D5Ec8883a78e0B2"
},
"governance": {
"admin": "0x6cddF384792C77219fc25C454Cfe264757842830",