Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const DisputeSlashModal = ({
</Text>
<Text variant="body3">
{disputeBond > BigInt(0)
? `${formatEthAmount(disputeBond)} ETH (refunded if dispute upheld)`
? `${formatEthAmount(disputeBond)} ETH (claimable via claimDisputeBond if dispute upheld)`
: 'No bond required'}
</Text>
{isAlreadyDisputed && hasKnownDisputer ? (
Expand Down
91 changes: 86 additions & 5 deletions apps/tangle-dapp/src/abi/validatorPodManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export const VALIDATOR_POD_MANAGER_ABI = [
type: 'function',
},
// Shares
// NOTE: tnt-core v0.15.0 refactored VPM to a share-pool model. The legacy
// `podOwnerShares` view is removed — readers must use `getShares` (int256,
// can be negative pre-rebase) or `getSharesUint` (uint256, clamped to 0).
{
inputs: [{ internalType: 'address', name: 'owner', type: 'address' }],
name: 'getShares',
Expand All @@ -38,18 +41,41 @@ export const VALIDATOR_POD_MANAGER_ABI = [
},
{
inputs: [{ internalType: 'address', name: 'owner', type: 'address' }],
name: 'podOwnerShares',
outputs: [{ internalType: 'int256', name: '', type: 'int256' }],
name: 'getSharesUint',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'totalShares',
outputs: [{ internalType: 'int256', name: '', type: 'int256' }],
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
// Beacon-chain accounting (replaces removed recordBeaconChainEthBalanceUpdate).
{
inputs: [
{ internalType: 'address', name: 'podOwner', type: 'address' },
{ internalType: 'uint256', name: 'assets', type: 'uint256' },
],
name: 'recordBeaconChainDeposit',
outputs: [
{ internalType: 'uint256', name: 'mintedShares', type: 'uint256' },
],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'podOwner', type: 'address' },
{ internalType: 'int256', name: 'assetsDelta', type: 'int256' },
],
name: 'recordBeaconChainRebase',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
// Operator Management
{
inputs: [],
Expand Down Expand Up @@ -306,14 +332,57 @@ export const VALIDATOR_POD_MANAGER_ABI = [
},
{
indexed: false,
internalType: 'int256',
internalType: 'uint256',
name: 'newShares',
type: 'int256',
type: 'uint256',
},
{
indexed: false,
internalType: 'uint256',
name: 'totalAssets',
type: 'uint256',
},
{
indexed: false,
internalType: 'uint256',
name: 'totalSharesPool',
type: 'uint256',
},
],
name: 'SharesUpdated',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'owner',
type: 'address',
},
{
indexed: false,
internalType: 'int256',
name: 'assetsDelta',
type: 'int256',
},
{
indexed: false,
internalType: 'uint256',
name: 'newTotalAssets',
type: 'uint256',
},
{
indexed: false,
internalType: 'uint256',
name: 'totalSharesPool',
type: 'uint256',
},
],
name: 'BeaconRebase',
type: 'event',
},
{
anonymous: false,
inputs: [
Expand Down Expand Up @@ -411,6 +480,12 @@ export const VALIDATOR_POD_MANAGER_ABI = [
name: 'shares',
type: 'uint256',
},
{
indexed: false,
internalType: 'uint256',
name: 'assets',
type: 'uint256',
},
],
name: 'WithdrawalQueued',
type: 'event',
Expand All @@ -436,6 +511,12 @@ export const VALIDATOR_POD_MANAGER_ABI = [
name: 'shares',
type: 'uint256',
},
{
indexed: false,
internalType: 'uint256',
name: 'assets',
type: 'uint256',
},
],
name: 'WithdrawalCompleted',
type: 'event',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,19 @@ export const useGetPod = (ownerAddress: Address | undefined) => {
};
};

// Hook to get owner's shares
// Hook to get owner's shares.
// tnt-core v0.15.0: legacy `podOwnerShares` was removed during the share-pool
// refactor. `getShares` returns int256 (can be negative if a beacon rebase
// pushed the owner under their previous share count); UI keeps the bigint
// shape and downstream renderers already clamp at zero where needed.
export const usePodOwnerShares = (ownerAddress: Address | undefined) => {
const chainId = useChainId();
const contractAddress = getValidatorPodManagerAddress(chainId);

const { data, isLoading, error, refetch } = useReadContract({
address: contractAddress ?? undefined,
abi: VALIDATOR_POD_MANAGER_ABI,
functionName: 'podOwnerShares',
functionName: 'getShares',
args: ownerAddress ? [ownerAddress] : undefined,
query: {
enabled: !!ownerAddress && !!contractAddress,
Expand Down
62 changes: 62 additions & 0 deletions libs/tangle-shared-ui/src/abi/multiAssetDelegation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,52 @@ const ABI = [
],
stateMutability: 'view',
},
{
type: 'function',
name: 'getCumStakeSeconds',
inputs: [
{
name: 'operator',
type: 'address',
internalType: 'address',
},
{
name: 'asset',
type: 'tuple',
internalType: 'struct Types.Asset',
components: [
{
name: 'kind',
type: 'uint8',
internalType: 'enum Types.AssetKind',
},
{
name: 'token',
type: 'address',
internalType: 'address',
},
],
},
],
outputs: [
{
name: 'cum',
type: 'uint256',
internalType: 'uint256',
},
{
name: 'lastUpdate',
type: 'uint64',
internalType: 'uint64',
},
{
name: 'currentStake',
type: 'uint256',
internalType: 'uint256',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'getDelegation',
Expand Down Expand Up @@ -2849,6 +2895,22 @@ const ABI = [
],
anonymous: false,
},
{
type: 'error',
name: 'AdapterChangeWhileDepositsExist',
inputs: [
{
name: 'token',
type: 'address',
internalType: 'address',
},
{
name: 'currentDeposits',
type: 'uint256',
internalType: 'uint256',
},
],
},
] as const;

export default ABI;
36 changes: 36 additions & 0 deletions libs/tangle-shared-ui/src/abi/tangle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,13 @@ const ABI = [
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
name: 'claimDisputeBond',
inputs: [],
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
name: 'claimRewards',
Expand Down Expand Up @@ -2325,6 +2332,16 @@ const ABI = [
type: 'uint256',
internalType: 'uint256',
},
{
name: '__reservedAggregateCursor',
type: 'uint256',
internalType: 'uint256',
},
{
name: 'subscriptionBaselineStake',
type: 'uint256',
internalType: 'uint256',
},
],
},
],
Expand Down Expand Up @@ -3149,6 +3166,25 @@ const ABI = [
],
stateMutability: 'view',
},
{
type: 'function',
name: 'pendingDisputeBondRefund',
inputs: [
{
name: 'disputer',
type: 'address',
internalType: 'address',
},
],
outputs: [
{
name: '',
type: 'uint256',
internalType: 'uint256',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'pendingRewards',
Expand Down
6 changes: 6 additions & 0 deletions libs/tangle-shared-ui/src/data/graphql/useSlashing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,12 @@ export const useExecuteSlashBatchTx = () => {

/**
* Hook to cancel a slash proposal.
*
* NOTE (tnt-core v0.14.0): `cancelSlash` no longer auto-refunds the disputer's
* bond. After cancellation, the disputer must call `claimDisputeBond()` and
* may inspect their pending balance with `pendingDisputeBondRefund(address)`.
* TODO(v0.15.0): wire up a `useClaimDisputeBondTx` + dedicated UI affordance
* on the disputer-facing slash detail view (and surface the pending balance).
*/
export const useCancelSlashTx = () => {
const chainId = useChainId();
Expand Down
Loading