mirror of
https://github.com/FlipsideCrypto/solana-models.git
synced 2026-02-06 11:47:08 +00:00
Marinade native stakers remap withdraw authority (#746)
* (wip) map withdraw authority using recursion * WIP v2 staking upstream models * fix issue with vote accounts and formattiing * fix inner index expected values * add docs for common columns * initial schema * add native 1 acct, fix dupes, add usd * initial schema and tests * add withdraw amount, recency test * convert lamports to decimals * add flag for whether still using marinade * PR feedback * PR fix * tmp update to load next batch * revert tmp change * revert * add to scheduler
This commit is contained in:
parent
1dcd928f73
commit
c923480751
63
data/testing__staking_lp_actions_labeled_2.csv
Normal file
63
data/testing__staking_lp_actions_labeled_2.csv
Normal file
@ -0,0 +1,63 @@
|
||||
stake_account, tx_id, index, inner_index,event_type, stake_authority, withdraw_authority, stake_active, vote_account, validator_name
|
||||
HvqBJ9qJtbFWuTzMncqh7hgeUtHeh8zDsCPrrSPJbRvi,9FpdN9NoXEKvvxkHoRViFPVCEfcMXEn1ZF8NCod1rSem74rznZbTyQppftDoS1aqQnf7wxvUv1LJw2dEu93VBfA,2,,split_destination,noMa7dN4cHQLV4ZonXrC29HTKFpxrpFbDLK5Gub8W8t,noMa7dN4cHQLV4ZonXrC29HTKFpxrpFbDLK5Gub8W8t,FALSE,,
|
||||
HvqBJ9qJtbFWuTzMncqh7hgeUtHeh8zDsCPrrSPJbRvi,9FpdN9NoXEKvvxkHoRViFPVCEfcMXEn1ZF8NCod1rSem74rznZbTyQppftDoS1aqQnf7wxvUv1LJw2dEu93VBfA,3,,delegate,noMa7dN4cHQLV4ZonXrC29HTKFpxrpFbDLK5Gub8W8t,noMa7dN4cHQLV4ZonXrC29HTKFpxrpFbDLK5Gub8W8t,TRUE,HxRrsnbc6K8CdEo3LCTrSUkFaDDxv9BdJsTDzBKnUVWH,validator: 7y5vhv4fkz6r4zumh2uiwpjlwxzpl1pcv28or5nwkwrl
|
||||
HvqBJ9qJtbFWuTzMncqh7hgeUtHeh8zDsCPrrSPJbRvi,4rheUmNSJK7AmCrepFXpd9Sob5TFZQbg3TXEzBnSQnvvyVqZdJ7oFhsAEwxdoJs9T9kgFxfyKpR4gS4JzyDF75xz,0,,authorize,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,noMa7dN4cHQLV4ZonXrC29HTKFpxrpFbDLK5Gub8W8t,TRUE,HxRrsnbc6K8CdEo3LCTrSUkFaDDxv9BdJsTDzBKnUVWH,validator: 7y5vhv4fkz6r4zumh2uiwpjlwxzpl1pcv28or5nwkwrl
|
||||
HvqBJ9qJtbFWuTzMncqh7hgeUtHeh8zDsCPrrSPJbRvi,4r3c7QiYZjSSbHyrBPeUQvFiNqW38WfAkgwaESyvkSvsRS611zqAgtheAigaF3MW7LDn61WeVvesqkfSa3KFGfPz,24,0,deactivate,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,noMa7dN4cHQLV4ZonXrC29HTKFpxrpFbDLK5Gub8W8t,FALSE,HxRrsnbc6K8CdEo3LCTrSUkFaDDxv9BdJsTDzBKnUVWH,validator: 7y5vhv4fkz6r4zumh2uiwpjlwxzpl1pcv28or5nwkwrl
|
||||
HvqBJ9qJtbFWuTzMncqh7hgeUtHeh8zDsCPrrSPJbRvi,4r3c7QiYZjSSbHyrBPeUQvFiNqW38WfAkgwaESyvkSvsRS611zqAgtheAigaF3MW7LDn61WeVvesqkfSa3KFGfPz,25,0,authorize,ex9CfkBZZd6Nv9XdnoDmmB45ymbu4arXVk7g5pWnt3N,noMa7dN4cHQLV4ZonXrC29HTKFpxrpFbDLK5Gub8W8t,FALSE,HxRrsnbc6K8CdEo3LCTrSUkFaDDxv9BdJsTDzBKnUVWH,validator: 7y5vhv4fkz6r4zumh2uiwpjlwxzpl1pcv28or5nwkwrl
|
||||
HvqBJ9qJtbFWuTzMncqh7hgeUtHeh8zDsCPrrSPJbRvi,3QT1piz2zGwRvnZZkLCZ15nvpZBzmn4ckZvXrHyKk4txD76g2KRkGJxy1NDHuyPpiQkpTrfSR6mgvsrZd7Ugq4Kv,11,0,merge_source,ex9CfkBZZd6Nv9XdnoDmmB45ymbu4arXVk7g5pWnt3N,noMa7dN4cHQLV4ZonXrC29HTKFpxrpFbDLK5Gub8W8t,FALSE,HxRrsnbc6K8CdEo3LCTrSUkFaDDxv9BdJsTDzBKnUVWH,validator: 7y5vhv4fkz6r4zumh2uiwpjlwxzpl1pcv28or5nwkwrl
|
||||
DpuSzDP69Z6ymyyMydei9h5hMy5u5apb5kxj8HHF9LTH,WHHEQJ2hrUEnq429azYapvAFS3wccDd262BEVzPgp1JhFzwFBDzmW9MPfLXRLeTHpfj97nXx8k9sQTdUZ4fqJQt,0,,withdraw,7fGw3UURsxk1szQ4buxQyEkiF4P6z7vx7sN1MHEguTJg,7fGw3UURsxk1szQ4buxQyEkiF4P6z7vx7sN1MHEguTJg,FALSE,37BPVW1Ne1XHrzK15xguAS2BTdobVfThDzTE2mv8SsnJ,validator: infstones
|
||||
8dUc88Nss8uhqzzFvUQhepkwZaVrfzpoCfKjCXGkdzAG,3WnXfFQtHeRrutF8BbgpUirBRBR5CjNNqKMdSv3bomRBHDTbn5gn3WQ5GHBhgZNH6KnxCdEwu76GL33axi3vMFWJ,1,,split_source,7fGw3UURsxk1szQ4buxQyEkiF4P6z7vx7sN1MHEguTJg,7fGw3UURsxk1szQ4buxQyEkiF4P6z7vx7sN1MHEguTJg,TRUE,2tucttroqFNXsrYeMBQ8LfzKNfgwT2rHBzAF6RzbbHEp,2tucttroqFNXsrYeMBQ8LfzKNfgwT2rHBzAF6RzbbHEp
|
||||
DpuSzDP69Z6ymyyMydei9h5hMy5u5apb5kxj8HHF9LTH,3WnXfFQtHeRrutF8BbgpUirBRBR5CjNNqKMdSv3bomRBHDTbn5gn3WQ5GHBhgZNH6KnxCdEwu76GL33axi3vMFWJ,1,,split_destination,7fGw3UURsxk1szQ4buxQyEkiF4P6z7vx7sN1MHEguTJg,7fGw3UURsxk1szQ4buxQyEkiF4P6z7vx7sN1MHEguTJg,TRUE,2tucttroqFNXsrYeMBQ8LfzKNfgwT2rHBzAF6RzbbHEp,2tucttroqFNXsrYeMBQ8LfzKNfgwT2rHBzAF6RzbbHEp
|
||||
7PfDsYgVU2oi2KoZszhmLekALxDzMEqSeogE4V9HReao,3jUYmgu4ASwGTPtkpDeLgSX3wY1DTLPhXNHf6xj4wTy881keCUKz2TBMEza3THnmKRL6imFM32sp6m8g4nX8v7Jd,1,,withdraw,59L2oxymiQQ9Hvhh92nt8Y7nDYjsauFkdb3SybdnsG6h,59L2oxymiQQ9Hvhh92nt8Y7nDYjsauFkdb3SybdnsG6h,FALSE,5eGn6KxmWE4wRCzBs3MN2jNezSsXCqxt1Dn6QQVKYZNj,5eGn6KxmWE4wRCzBs3MN2jNezSsXCqxt1Dn6QQVKYZNj
|
||||
7PfDsYgVU2oi2KoZszhmLekALxDzMEqSeogE4V9HReao,51UcpfRBPjzDa8BNuWtmd5RaMWYG2GoNpsvfFE2zr1VyTxqr62vvRnuwBGUunx3D4uxCpqgGJ5E9YssMoYw3F4Wz,1,,split_destination,59L2oxymiQQ9Hvhh92nt8Y7nDYjsauFkdb3SybdnsG6h,59L2oxymiQQ9Hvhh92nt8Y7nDYjsauFkdb3SybdnsG6h,TRUE,AZoCYB4VgoM9DR9f1ZFcBn8xPSbtbqoxZnKJR7tkvEoX,validator: fbkfwadxzjahgtfitasbvbqh5968gly7dmbbjuoujeni
|
||||
AumTfTLUAMyzGZmhBHNceQK4X3BVpggs5cvYbFkkHpxi,51UcpfRBPjzDa8BNuWtmd5RaMWYG2GoNpsvfFE2zr1VyTxqr62vvRnuwBGUunx3D4uxCpqgGJ5E9YssMoYw3F4Wz,1,,split_source,59L2oxymiQQ9Hvhh92nt8Y7nDYjsauFkdb3SybdnsG6h,DNeVJE5wLSZ777Nq7xcbEPdbQH5x2juQGE7Nzu7cwY4o,TRUE,AZoCYB4VgoM9DR9f1ZFcBn8xPSbtbqoxZnKJR7tkvEoX,validator: fbkfwadxzjahgtfitasbvbqh5968gly7dmbbjuoujeni
|
||||
CB233E1CwUTq25v7ezjuFujNYbWXn37ZfEXwgvKrHKke,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,0,2,split_destination,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,FALSE,,
|
||||
CWLWLtuL7XXDeSfAYhHz2G8bQfPzz7kX2NZLRw9rZhwa,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,0,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,XZMNcDdCv7EHFcYD1EY9Kzzv1a1mHDj6eeiGKCo78rh,,,
|
||||
CB233E1CwUTq25v7ezjuFujNYbWXn37ZfEXwgvKrHKke,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,1,0,delegate,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,TRUE,81LF3sFyx9aANNhZPTyPEULKHV1mTqd3qho7ZLQghNJL,81LF3sFyx9aANNhZPTyPEULKHV1mTqd3qho7ZLQghNJL
|
||||
CWLWLtuL7XXDeSfAYhHz2G8bQfPzz7kX2NZLRw9rZhwa,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,2,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,XZMNcDdCv7EHFcYD1EY9Kzzv1a1mHDj6eeiGKCo78rh,,,
|
||||
ooVFCJoB2fXm1hhT5TbJJBGT1BHxLSgqmJchDib9pPa,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,2,2,split_destination,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,FALSE,,
|
||||
ooVFCJoB2fXm1hhT5TbJJBGT1BHxLSgqmJchDib9pPa,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,3,0,delegate,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,TRUE,BLADE1qNA1uNjRgER6DtUFf7FU3c1TWLLdpPeEcKatZ2,validator: shinobi systems
|
||||
CWLWLtuL7XXDeSfAYhHz2G8bQfPzz7kX2NZLRw9rZhwa,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,4,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,XZMNcDdCv7EHFcYD1EY9Kzzv1a1mHDj6eeiGKCo78rh,,,
|
||||
AoUUriLDWMfd6KKckS6CkuT4zYkLhe75t3He94e3FbMq,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,4,2,split_destination,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,FALSE,,
|
||||
AoUUriLDWMfd6KKckS6CkuT4zYkLhe75t3He94e3FbMq,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,5,0,delegate,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,TRUE,4xtLq63x83LQTusziYCGotU1fzwAyZLkEyvzb7Gkhuox,4xtLq63x83LQTusziYCGotU1fzwAyZLkEyvzb7Gkhuox
|
||||
G4vnaB9GgsCdXjenbzNE99p2RrJd2HqMRdDJYbeertWg,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,6,2,split_destination,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,FALSE,,
|
||||
CWLWLtuL7XXDeSfAYhHz2G8bQfPzz7kX2NZLRw9rZhwa,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,6,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,XZMNcDdCv7EHFcYD1EY9Kzzv1a1mHDj6eeiGKCo78rh,,,
|
||||
G4vnaB9GgsCdXjenbzNE99p2RrJd2HqMRdDJYbeertWg,2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7,7,0,delegate,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,TRUE,3TZAkZtKuQe1B3wffyke6WNy9Z7cLVY9xhR3qT1hVEqv,3TZAkZtKuQe1B3wffyke6WNy9Z7cLVY9xhR3qT1hVEqv
|
||||
6uL42wq6FKTQkSdDKwAnfKV6cYqipfuzpbjKRPR7KD7E,63FGsSQ843DMkdVeQauNkrij3NYSTJHUBmF3VoE8qFCnkPpivSjrBk48rFtvgzvMrzDv88YiSzXV21JBp4XK3AwW,1,,split_destination,J2i2UaDmq3qsSB1tYtaczq7rGWiW2CHrfDdVqXrKciiG,J2i2UaDmq3qsSB1tYtaczq7rGWiW2CHrfDdVqXrKciiG,FALSE,DHasctf9Gs2hRY2QzSoRiLuJnuEkRcGHSrh2JUxthxwa,validator: fne1mgytpujn7inhvgrflysxje48hzsgf9jfnkknj2bm
|
||||
A3hkT4jtdDNhzXgLjATPDjZpvyfthW59azmrf8NZsV9n,63FGsSQ843DMkdVeQauNkrij3NYSTJHUBmF3VoE8qFCnkPpivSjrBk48rFtvgzvMrzDv88YiSzXV21JBp4XK3AwW,1,,split_source,J2i2UaDmq3qsSB1tYtaczq7rGWiW2CHrfDdVqXrKciiG,EhYXq3ANp5nAerUpbSgd7VK2RRcxK1zNuSQ755G5Mtxx,,,
|
||||
6uL42wq6FKTQkSdDKwAnfKV6cYqipfuzpbjKRPR7KD7E,63FGsSQ843DMkdVeQauNkrij3NYSTJHUBmF3VoE8qFCnkPpivSjrBk48rFtvgzvMrzDv88YiSzXV21JBp4XK3AwW,2,,delegate,J2i2UaDmq3qsSB1tYtaczq7rGWiW2CHrfDdVqXrKciiG,J2i2UaDmq3qsSB1tYtaczq7rGWiW2CHrfDdVqXrKciiG,TRUE,DHasctf9Gs2hRY2QzSoRiLuJnuEkRcGHSrh2JUxthxwa,validator: fne1mgytpujn7inhvgrflysxje48hzsgf9jfnkknj2bm
|
||||
2VipqBywq7r6R2gzJHrS6JNeeXYv9SQ9vCZ98yegCP4A,3DwTtQRT8hKkcGgpT8wEuepwgRDZ8TAs1yD6kgPc6egwJZJ1H8Sw8VgXgTC3BC6NE5DpbsrMdtwcE8b81gt6oVcC,0,,merge_source,J2i2UaDmq3qsSB1tYtaczq7rGWiW2CHrfDdVqXrKciiG,J2i2UaDmq3qsSB1tYtaczq7rGWiW2CHrfDdVqXrKciiG,FALSE,2naPB8XC4FWp4er8M2nxDsphXHEyQH2CSQMFaSHxWWd8,validator: temperstake
|
||||
A3hkT4jtdDNhzXgLjATPDjZpvyfthW59azmrf8NZsV9n,3DwTtQRT8hKkcGgpT8wEuepwgRDZ8TAs1yD6kgPc6egwJZJ1H8Sw8VgXgTC3BC6NE5DpbsrMdtwcE8b81gt6oVcC,0,,merge_destination,J2i2UaDmq3qsSB1tYtaczq7rGWiW2CHrfDdVqXrKciiG,EhYXq3ANp5nAerUpbSgd7VK2RRcxK1zNuSQ755G5Mtxx,,,
|
||||
35bXuoR23q2Rwn2g6o2kUThJRokxEVsbuYCyNt4Mr43H,4827mSL6v6bvRHx2Ssfs39SdsfnJZVdDc72dQG44BRmWN4fxEVwBwX7hCNrZGpo2CRfn17iXr6TgQFJizVBF5H3H,2,10,split_destination,W1ZQRwUfSkDKy2oefRBUWph82Vr2zg9txWMA8RQazN5,W1ZQRwUfSkDKy2oefRBUWph82Vr2zg9txWMA8RQazN5,,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt
|
||||
35bXuoR23q2Rwn2g6o2kUThJRokxEVsbuYCyNt4Mr43H,4827mSL6v6bvRHx2Ssfs39SdsfnJZVdDc72dQG44BRmWN4fxEVwBwX7hCNrZGpo2CRfn17iXr6TgQFJizVBF5H3H,2,11,authorize,W1ZQRwUfSkDKy2oefRBUWph82Vr2zg9txWMA8RQazN5,6U91aKa8pmMxkJwBCfPTmUEfZi6dHe7DcFq2ALvB2tbB,,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt
|
||||
35bXuoR23q2Rwn2g6o2kUThJRokxEVsbuYCyNt4Mr43H,4827mSL6v6bvRHx2Ssfs39SdsfnJZVdDc72dQG44BRmWN4fxEVwBwX7hCNrZGpo2CRfn17iXr6TgQFJizVBF5H3H,2,12,authorize,6U91aKa8pmMxkJwBCfPTmUEfZi6dHe7DcFq2ALvB2tbB,6U91aKa8pmMxkJwBCfPTmUEfZi6dHe7DcFq2ALvB2tbB,,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt
|
||||
35bXuoR23q2Rwn2g6o2kUThJRokxEVsbuYCyNt4Mr43H,4827mSL6v6bvRHx2Ssfs39SdsfnJZVdDc72dQG44BRmWN4fxEVwBwX7hCNrZGpo2CRfn17iXr6TgQFJizVBF5H3H,2,13,authorize,CbnZJt3kzAobmKFsrVEDxa2ujUFY2N5gEtDs278i41HY,6U91aKa8pmMxkJwBCfPTmUEfZi6dHe7DcFq2ALvB2tbB,,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt
|
||||
35bXuoR23q2Rwn2g6o2kUThJRokxEVsbuYCyNt4Mr43H,4827mSL6v6bvRHx2Ssfs39SdsfnJZVdDc72dQG44BRmWN4fxEVwBwX7hCNrZGpo2CRfn17iXr6TgQFJizVBF5H3H,2,14,authorize,CbnZJt3kzAobmKFsrVEDxa2ujUFY2N5gEtDs278i41HY,CbnZJt3kzAobmKFsrVEDxa2ujUFY2N5gEtDs278i41HY,,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt
|
||||
35bXuoR23q2Rwn2g6o2kUThJRokxEVsbuYCyNt4Mr43H,4827mSL6v6bvRHx2Ssfs39SdsfnJZVdDc72dQG44BRmWN4fxEVwBwX7hCNrZGpo2CRfn17iXr6TgQFJizVBF5H3H,2,16,authorize,6WecYymEARvjG5ZyqkrVQ6YkhPfujNzWpSPwNKXHCbV2,CbnZJt3kzAobmKFsrVEDxa2ujUFY2N5gEtDs278i41HY,,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt
|
||||
35bXuoR23q2Rwn2g6o2kUThJRokxEVsbuYCyNt4Mr43H,4827mSL6v6bvRHx2Ssfs39SdsfnJZVdDc72dQG44BRmWN4fxEVwBwX7hCNrZGpo2CRfn17iXr6TgQFJizVBF5H3H,2,17,authorize,6WecYymEARvjG5ZyqkrVQ6YkhPfujNzWpSPwNKXHCbV2,6WecYymEARvjG5ZyqkrVQ6YkhPfujNzWpSPwNKXHCbV2,,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt
|
||||
35bXuoR23q2Rwn2g6o2kUThJRokxEVsbuYCyNt4Mr43H,4827mSL6v6bvRHx2Ssfs39SdsfnJZVdDc72dQG44BRmWN4fxEVwBwX7hCNrZGpo2CRfn17iXr6TgQFJizVBF5H3H,2,18,merge_source,6WecYymEARvjG5ZyqkrVQ6YkhPfujNzWpSPwNKXHCbV2,6WecYymEARvjG5ZyqkrVQ6YkhPfujNzWpSPwNKXHCbV2,FALSE,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt,4MpRU9fDDSQNNTeb4v5DPZZTKupYancGksH679AKLBnt
|
||||
5KYKmE7TCv1wt2YcrcdHinmN78D1acnfy2q6DAxSbRtM,3z6h9aooG6cPwQCAPur5HTT2vMxC3gGDzWCk3mc5AXkWRJ9yxzANXYBuYL68KwUa4zehgHFALGovGiXargMSzTEs,0,,merge_source,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,FALSE,G7akZgkcuqr7Vw1bHXqerKeawQ2Uc1WK9VaYq9APWNLE,validator: slavamo
|
||||
3kCWqSzepZ9yrRYpwexvimb3vr4uHYLbbk2E8pJyP8w5,3z6h9aooG6cPwQCAPur5HTT2vMxC3gGDzWCk3mc5AXkWRJ9yxzANXYBuYL68KwUa4zehgHFALGovGiXargMSzTEs,0,,merge_destination,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,TRUE,G7akZgkcuqr7Vw1bHXqerKeawQ2Uc1WK9VaYq9APWNLE,validator: slavamo
|
||||
3kCWqSzepZ9yrRYpwexvimb3vr4uHYLbbk2E8pJyP8w5,apikDqVczz6jwvqxABJ81YHMXRaHSj4WAGyKTUQzvnV547oKDFgCVpa87oay8FqW9FrKJtedYyqXpi6uzkZGd3H,0,,authorize,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,4ZJhPQAgUseCsWhKvJLTmmRRUV74fdoTpQLNfKoekbPY,TRUE,G7akZgkcuqr7Vw1bHXqerKeawQ2Uc1WK9VaYq9APWNLE,validator: slavamo
|
||||
5NbJa8sg4xzqZZnFkYJPP3GYvVVDKy5NxoqSLj8oFjHK,6774K5Q6nYMBiX1bjwr14ScZHwJddcEWvx9NwRspN8yqHVvRkdgGhGfhd6zDJKQQCW3PbqqkbmETsFTq6ywBr1eV,0,,merge_source,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,FALSE,DKrfD9L6s5HL4nmiz887KDBW2Ewjq3YbmMgXhNtXEUWB,DKrfD9L6s5HL4nmiz887KDBW2Ewjq3YbmMgXhNtXEUWB
|
||||
mprMBsum5VED44sf3jJkeb59JTFSo9q2cYdmCSNyMX7,6774K5Q6nYMBiX1bjwr14ScZHwJddcEWvx9NwRspN8yqHVvRkdgGhGfhd6zDJKQQCW3PbqqkbmETsFTq6ywBr1eV,0,,merge_destination,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,4ZJhPQAgUseCsWhKvJLTmmRRUV74fdoTpQLNfKoekbPY,,,
|
||||
HrkpW5egMvJWVc2gKYuay63qLJUAb1zgDeYDd3kmAAtk,3URQbmJCcSVLeLDJW9Dfkit8Y3jGxRofzk7GCXhSE7Aum1MgpcZzkSJBprX5SzGXDRaJA56ks9rFCZFZ7foNqSip,1,,split_destination,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,FALSE,zipgXB45xggsZFNddDAN3iCMbPHGWp8Kq7cxYJDUuR4,validator: bch3niwerqmrks7qhuqmw7umcyns4pd8auccrftxrome
|
||||
mprMBsum5VED44sf3jJkeb59JTFSo9q2cYdmCSNyMX7,3URQbmJCcSVLeLDJW9Dfkit8Y3jGxRofzk7GCXhSE7Aum1MgpcZzkSJBprX5SzGXDRaJA56ks9rFCZFZ7foNqSip,1,,split_source,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,4ZJhPQAgUseCsWhKvJLTmmRRUV74fdoTpQLNfKoekbPY,,,
|
||||
HrkpW5egMvJWVc2gKYuay63qLJUAb1zgDeYDd3kmAAtk,3URQbmJCcSVLeLDJW9Dfkit8Y3jGxRofzk7GCXhSE7Aum1MgpcZzkSJBprX5SzGXDRaJA56ks9rFCZFZ7foNqSip,2,,delegate,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5,TRUE,zipgXB45xggsZFNddDAN3iCMbPHGWp8Kq7cxYJDUuR4,validator: bch3niwerqmrks7qhuqmw7umcyns4pd8auccrftxrome
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,2uH1yDzNxzUbXVBE2cWeMFxLDSqeePgtnKebzUsq2hC4vQzora31kccWfCESKAWX3xK65SLTxTgSoB6YnKQxUUFD,1,,initialize,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,,,
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,2EdZ4acSqVge58NrpQyhdYsdfQ44FxzXFexGv8hdgYiHLKdEMwtH4WyjBn1bmbqo4TZ3qHiFzzRf3YHRHSKuguke,0,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,,,
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,RrnDXqk1E2kP38B2xYARywuCNc9VX837btHiMRXQoXjDSvCoBu21hhWRraCBMDhgkRutoYa2jgc3vJixmUXdEdt,0,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,,,
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,2EdZ4acSqVge58NrpQyhdYsdfQ44FxzXFexGv8hdgYiHLKdEMwtH4WyjBn1bmbqo4TZ3qHiFzzRf3YHRHSKuguke,2,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,,,
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,RrnDXqk1E2kP38B2xYARywuCNc9VX837btHiMRXQoXjDSvCoBu21hhWRraCBMDhgkRutoYa2jgc3vJixmUXdEdt,2,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,,,
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,2EdZ4acSqVge58NrpQyhdYsdfQ44FxzXFexGv8hdgYiHLKdEMwtH4WyjBn1bmbqo4TZ3qHiFzzRf3YHRHSKuguke,4,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,,,
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,RrnDXqk1E2kP38B2xYARywuCNc9VX837btHiMRXQoXjDSvCoBu21hhWRraCBMDhgkRutoYa2jgc3vJixmUXdEdt,4,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,,,
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,RrnDXqk1E2kP38B2xYARywuCNc9VX837btHiMRXQoXjDSvCoBu21hhWRraCBMDhgkRutoYa2jgc3vJixmUXdEdt,6,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,,,
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,2EdZ4acSqVge58NrpQyhdYsdfQ44FxzXFexGv8hdgYiHLKdEMwtH4WyjBn1bmbqo4TZ3qHiFzzRf3YHRHSKuguke,6,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,,,
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,kvkK9Xaiq3S1sW42H7eQNi7XPbwgvbuQGoThMGWcCBXZsYLcRhYBmzJpAmRAYMcP4BFJx2vxi5Y2CNK8Vc6qkkM,0,2,split_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,FALSE,,
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,kvkK9Xaiq3S1sW42H7eQNi7XPbwgvbuQGoThMGWcCBXZsYLcRhYBmzJpAmRAYMcP4BFJx2vxi5Y2CNK8Vc6qkkM,2,0,delegate,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,TRUE,2nvpHkLkMeaa1G2QgHMLzvoStXwBzV5LR4nyiZqNYgFA,validator: grby9f2ru7zpabtuczr1pilcbijkczpppvupmnatuxpt
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,3jSHJvj2YMLVKMQBFga6hFKnxnFYhdBkCQnXmAGd7xcgMW7aHXkFU7GAyStFFcnXywWvthqvJSSeVvWQKqMNr8xS,0,0,deactivate,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,FALSE,2nvpHkLkMeaa1G2QgHMLzvoStXwBzV5LR4nyiZqNYgFA,validator: grby9f2ru7zpabtuczr1pilcbijkczpppvupmnatuxpt
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,3jSHJvj2YMLVKMQBFga6hFKnxnFYhdBkCQnXmAGd7xcgMW7aHXkFU7GAyStFFcnXywWvthqvJSSeVvWQKqMNr8xS,1,0,authorize,ex9CfkBZZd6Nv9XdnoDmmB45ymbu4arXVk7g5pWnt3N,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,FALSE,2nvpHkLkMeaa1G2QgHMLzvoStXwBzV5LR4nyiZqNYgFA,validator: grby9f2ru7zpabtuczr1pilcbijkczpppvupmnatuxpt
|
||||
HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L,5HqAE91juH4PTg7T9EccH7dT1cAH77LRHigrVAeE1Fzw7d7euqqJQJL9xNfuxYA2JX2UX7BcMx9Z2GaQJS1Epoox,2,0,merge_source,ex9CfkBZZd6Nv9XdnoDmmB45ymbu4arXVk7g5pWnt3N,GdpYY4sTeg9pBQmAer7kQ24diVcm3T1HxDa5P4XJdZhv,FALSE,2nvpHkLkMeaa1G2QgHMLzvoStXwBzV5LR4nyiZqNYgFA,validator: grby9f2ru7zpabtuczr1pilcbijkczpppvupmnatuxpt
|
||||
H6M8LzYL6qKxqVZDQYAmCJfY6KF3MwqNVNijYmHQmLK7,RrnDXqk1E2kP38B2xYARywuCNc9VX837btHiMRXQoXjDSvCoBu21hhWRraCBMDhgkRutoYa2jgc3vJixmUXdEdt,6,2,split_destination,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,FALSE,,
|
||||
H6M8LzYL6qKxqVZDQYAmCJfY6KF3MwqNVNijYmHQmLK7,RrnDXqk1E2kP38B2xYARywuCNc9VX837btHiMRXQoXjDSvCoBu21hhWRraCBMDhgkRutoYa2jgc3vJixmUXdEdt,7,0,delegate,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,TRUE,2ayMCC4aizr8RGg5ptXYqu8uoxW1whNek1hE1zaAd58z,validator: royfuud7qd9aq34ucmcwfye8dc5yvjexz2j3mmoy5s4
|
||||
H6M8LzYL6qKxqVZDQYAmCJfY6KF3MwqNVNijYmHQmLK7,2gxtXdFEJ41mjb1LcQL5F6uN8bWLR4W9JWgmYGD2ssfQ8AydPCr5UE7TksVoSt5J3SJ17b7n8pfgfHX9UyaCWjDQ,8,0,merge_source,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq,FALSE,2ayMCC4aizr8RGg5ptXYqu8uoxW1whNek1hE1zaAd58z,validator: royfuud7qd9aq34ucmcwfye8dc5yvjexz2j3mmoy5s4
|
||||
|
5
models/descriptions/stake_account.md
Normal file
5
models/descriptions/stake_account.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs stake_account %}
|
||||
|
||||
An account address containing balances of staked SOL.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/stake_authority.md
Normal file
5
models/descriptions/stake_authority.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs stake_authority %}
|
||||
|
||||
The authority that can perform staking related actions on the stake account except for withdrawing.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/withdraw_authority.md
Normal file
5
models/descriptions/withdraw_authority.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs withdraw_authority %}
|
||||
|
||||
The authority that can withdraw SOL from the stake account.
|
||||
|
||||
{% enddocs %}
|
||||
185
models/gold/marinade/marinade__ez_native_staking_actions.sql
Normal file
185
models/gold/marinade/marinade__ez_native_staking_actions.sql
Normal file
@ -0,0 +1,185 @@
|
||||
{{
|
||||
config(
|
||||
materialized = 'table',
|
||||
cluster_by = ['block_timestamp::DATE'],
|
||||
post_hook = enable_search_optimization('{{this.schema}}', '{{this.identifier}}', 'ON EQUALITY(tx_id,stake_account,provider_address)'),
|
||||
tags = ['scheduled_non_core'],
|
||||
)
|
||||
}}
|
||||
|
||||
WITH marinade_native_stakers AS (
|
||||
SELECT DISTINCT
|
||||
stake_account
|
||||
FROM
|
||||
{{ ref('silver__staking_lp_actions_labeled_2') }}
|
||||
WHERE
|
||||
/* include older stake authority(ex9CfkBZZd6Nv9XdnoDmmB45ymbu4arXVk7g5pWnt3N) used by marinade native staking */
|
||||
stake_authority IN ('stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq', 'ex9CfkBZZd6Nv9XdnoDmmB45ymbu4arXVk7g5pWnt3N')
|
||||
AND succeeded
|
||||
),
|
||||
withdraw_authority_from_snapshot_tmp AS (
|
||||
SELECT
|
||||
m.stake_account,
|
||||
w.authorized_withdrawer AS withdraw_authority,
|
||||
w.epoch,
|
||||
e.start_block AS start_block_id,
|
||||
e.end_block AS end_block_id,
|
||||
min(w.epoch) over (partition by m.stake_account) AS min_epoch
|
||||
FROM
|
||||
marinade_native_stakers AS m
|
||||
JOIN
|
||||
{{ ref('gov__fact_stake_accounts') }} AS w
|
||||
ON m.stake_account = w.stake_pubkey
|
||||
LEFT JOIN
|
||||
{{ ref('silver__epoch') }} AS e
|
||||
ON w.epoch = e.epoch
|
||||
),
|
||||
withdraw_authority_from_snapshot AS (
|
||||
SELECT
|
||||
m.stake_account,
|
||||
m.withdraw_authority,
|
||||
coalesce(e.start_block,m.start_block_id) AS start_block_id,
|
||||
m.end_block_id
|
||||
FROM
|
||||
withdraw_authority_from_snapshot_tmp AS m
|
||||
LEFT JOIN
|
||||
{{ ref('silver__epoch') }} AS e
|
||||
ON m.epoch-1 = e.epoch
|
||||
AND m.epoch = m.min_epoch
|
||||
),
|
||||
reconcile_withdraw_authority_with_snapshot AS (
|
||||
SELECT
|
||||
s.* exclude(withdraw_authority),
|
||||
CASE
|
||||
WHEN s.withdraw_authority IN ('stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq', 'ex9CfkBZZd6Nv9XdnoDmmB45ymbu4arXVk7g5pWnt3N')
|
||||
THEN w.withdraw_authority
|
||||
ELSE s.withdraw_authority
|
||||
END AS withdraw_authority
|
||||
FROM
|
||||
marinade_native_stakers AS m
|
||||
JOIN
|
||||
{{ ref('silver__staking_lp_actions_labeled_2') }} AS s
|
||||
ON m.stake_account = s.stake_account
|
||||
AND s.succeeded
|
||||
LEFT JOIN
|
||||
withdraw_authority_from_snapshot AS w
|
||||
ON s.stake_account = w.stake_account
|
||||
AND s.block_id BETWEEN w.start_block_id AND w.end_block_id
|
||||
),
|
||||
reconcile_with_mapping AS (
|
||||
SELECT
|
||||
s.* exclude(withdraw_authority),
|
||||
CASE
|
||||
WHEN s.withdraw_authority IS NULL
|
||||
THEN w.withdraw_authority
|
||||
ELSE s.withdraw_authority
|
||||
END AS withdraw_authority
|
||||
FROM
|
||||
reconcile_withdraw_authority_with_snapshot AS s
|
||||
LEFT JOIN
|
||||
{{ ref('silver__marinade_native_staking_account_withdraw_authority_mapping') }} AS w
|
||||
ON s.stake_account = w.stake_account
|
||||
),
|
||||
get_withdraw_authority_by_parent AS (
|
||||
SELECT DISTINCT
|
||||
s.stake_account,
|
||||
w.withdraw_authority
|
||||
FROM
|
||||
reconcile_with_mapping AS s
|
||||
LEFT JOIN
|
||||
withdraw_authority_from_snapshot AS w
|
||||
ON s.parent_stake_account = w.stake_account
|
||||
WHERE
|
||||
s.withdraw_authority IS NULL
|
||||
AND w.withdraw_authority IS NOT NULL
|
||||
),
|
||||
reconcile_with_parent AS (
|
||||
SELECT
|
||||
s.* exclude(withdraw_authority),
|
||||
coalesce(s.withdraw_authority, w.withdraw_authority) AS withdraw_authority
|
||||
FROM
|
||||
reconcile_with_mapping AS s
|
||||
LEFT JOIN
|
||||
get_withdraw_authority_by_parent AS w
|
||||
ON s.stake_account = w.stake_account
|
||||
AND s.withdraw_authority IS NULL
|
||||
),
|
||||
get_withdraw_authority_with_window AS (
|
||||
SELECT
|
||||
*,
|
||||
last_value(withdraw_authority IGNORE NULLS) OVER (
|
||||
PARTITION BY stake_account
|
||||
ORDER BY block_timestamp, index
|
||||
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
|
||||
) AS withdraw_authority_last_value,
|
||||
first_value(withdraw_authority IGNORE NULLS) OVER (
|
||||
PARTITION BY stake_account
|
||||
ORDER BY block_timestamp, index
|
||||
ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING
|
||||
) AS withdraw_authority_first_value
|
||||
FROM
|
||||
reconcile_with_parent
|
||||
),
|
||||
reconcile_with_window AS (
|
||||
SELECT
|
||||
* exclude(withdraw_authority, withdraw_authority_last_value, withdraw_authority_first_value),
|
||||
coalesce(
|
||||
withdraw_authority,
|
||||
withdraw_authority_last_value,
|
||||
withdraw_authority_first_value
|
||||
) AS withdraw_authority
|
||||
FROM
|
||||
get_withdraw_authority_with_window
|
||||
),
|
||||
token_prices AS (
|
||||
SELECT
|
||||
HOUR,
|
||||
LOWER(token_address) AS token_address,
|
||||
price
|
||||
FROM
|
||||
{{ ref('price__ez_prices_hourly') }}
|
||||
WHERE
|
||||
HOUR :: DATE IN (
|
||||
SELECT
|
||||
DISTINCT block_timestamp :: DATE
|
||||
FROM
|
||||
reconcile_with_window
|
||||
)
|
||||
AND token_address = 'So11111111111111111111111111111111111111112'
|
||||
)
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
index,
|
||||
inner_index,
|
||||
succeeded,
|
||||
event_type,
|
||||
withdraw_authority AS provider_address,
|
||||
stake_account,
|
||||
stake_active,
|
||||
stake_authority,
|
||||
pre_tx_staked_balance / pow(10,9) AS pre_tx_staked_balance,
|
||||
((pre_tx_staked_balance / pow(10,9)) * tp.price)::numeric(38,2) AS pre_tx_staked_balance_usd,
|
||||
post_tx_staked_balance / pow(10,9) AS post_tx_staked_balance,
|
||||
((post_tx_staked_balance / pow(10,9)) * tp.price)::numeric(38,2) AS post_tx_staked_balance_usd,
|
||||
withdraw_destination,
|
||||
withdraw_amount / pow(10,9) AS withdraw_amount,
|
||||
validator_name,
|
||||
vote_account,
|
||||
node_pubkey,
|
||||
validator_rank,
|
||||
'Stake11111111111111111111111111111111111111' AS program_id,
|
||||
iff(stake_authority IN ('stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq', 'ex9CfkBZZd6Nv9XdnoDmmB45ymbu4arXVk7g5pWnt3N'), 'marinade native proxy', 'native') AS platform,
|
||||
(platform = 'marinade native proxy') AS is_using_marinade_native_staking,
|
||||
_inserted_timestamp,
|
||||
{{ dbt_utils.generate_surrogate_key(['tx_id','index','inner_index','event_type']) }} AS marinade_native_ez_staking_actions_id,
|
||||
sysdate() AS inserted_timestamp,
|
||||
sysdate() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
reconcile_with_window
|
||||
LEFT JOIN
|
||||
token_prices AS tp
|
||||
ON date_trunc('hour', reconcile_with_window.block_timestamp) = tp.HOUR
|
||||
|
||||
118
models/gold/marinade/marinade__ez_native_staking_actions.yml
Normal file
118
models/gold/marinade/marinade__ez_native_staking_actions.yml
Normal file
@ -0,0 +1,118 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: marinade__ez_native_staking_actions
|
||||
description: Table for staking actions for any account that has interacted with Marinade Native Staking at least once
|
||||
recent_date_filter: &recent_date_filter
|
||||
config:
|
||||
where: _inserted_timestamp >= current_date - 7
|
||||
data_tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- BLOCK_ID
|
||||
- TX_ID
|
||||
- INDEX
|
||||
- INNER_INDEX
|
||||
- EVENT_TYPE
|
||||
where: >
|
||||
block_timestamp::DATE > current_date - 30
|
||||
columns:
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- dbt_expectations.expect_row_values_to_have_recent_data:
|
||||
datepart: day
|
||||
interval: 1
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: INDEX
|
||||
description: "{{ doc('index') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: INNER_INDEX
|
||||
description: "{{ doc('inner_index') }}"
|
||||
- name: SUCCEEDED
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- accepted_values:
|
||||
values:
|
||||
- true
|
||||
quote: false
|
||||
<<: *recent_date_filter
|
||||
- name: EVENT_TYPE
|
||||
description: "{{ doc('event_type') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: STAKE_AUTHORITY
|
||||
description: "{{ doc('stake_authority') }}"
|
||||
- name: PROVIDER_ADDRESS
|
||||
description: "The provider address is the same as the withdraw authority which is defined as...{{ doc('withdraw_authority') }}"
|
||||
- name: STAKE_ACCOUNT
|
||||
description: "{{ doc('stake_account') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: STAKE_ACTIVE
|
||||
description: Whether the stake account is active.
|
||||
- name: WITHDRAW_DESTINATION
|
||||
description: The destination wallet address of the withdrawn SOL.
|
||||
- name: WITHDRAW_AMOUNT
|
||||
description: The amount of SOL withdrawn from the stake account.
|
||||
- name: PRE_TX_STAKED_BALANCE
|
||||
description: The amount of Solana belonging to the stake account before the transaction.
|
||||
- name: PRE_TX_STAKED_BALANCE_USD
|
||||
description: The amount of Solana belonging to the stake account before the transaction in USD.
|
||||
- name: POST_TX_STAKED_BALANCE
|
||||
description: The amount of Solana belonging to the stake account after the transaction.
|
||||
- name: POST_TX_STAKED_BALANCE_USD
|
||||
description: The amount of Solana belonging to the stake account after the transaction in USD.
|
||||
- name: VOTE_ACCOUNT
|
||||
description: A voting account belonging to the validator.
|
||||
- name: NODE_PUBKEY
|
||||
description: A unique key belonging to the validator node.
|
||||
- name: VALIDATOR_RANK
|
||||
description: The rank of the validator by amount of delegated SOL.
|
||||
- name: COMMISSION
|
||||
description: The percentage of staked earnings given to the validator.
|
||||
- name: VALIDATOR_NAME
|
||||
description: The name of the validator.
|
||||
- name: PROGRAM_ID
|
||||
description: The program id of the native stake program
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: PLATFORM
|
||||
description: The platform of the staking account either native or marinate native proxy
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: IS_USING_MARINADE_NATIVE_STAKING
|
||||
description: Whether the staking action is using Marinade Native Staking
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('_inserted_timestamp') }}"
|
||||
data_tests:
|
||||
- not_null
|
||||
- name: MARINADE_NATIVE_EZ_STAKING_ACTIONS_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
data_tests:
|
||||
- unique: *recent_date_filter
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: _INVOCATION_ID
|
||||
description: '{{ doc("_invocation_id") }}'
|
||||
data_tests:
|
||||
- not_null:
|
||||
name: test_marinade__not_null_ez_native_staking_actions_invocation_id
|
||||
<<: *recent_date_filter
|
||||
123
models/silver/non_core/silver__staking_lp_actions_2.sql
Normal file
123
models/silver/non_core/silver__staking_lp_actions_2.sql
Normal file
@ -0,0 +1,123 @@
|
||||
{{
|
||||
config(
|
||||
materialized = 'incremental',
|
||||
unique_key = ['block_timestamp::DATE','staking_lp_actions_2_id'],
|
||||
cluster_by = ['block_timestamp::DATE','event_type'],
|
||||
post_hook = enable_search_optimization('{{this.schema}}', '{{this.identifier}}', 'ON EQUALITY(tx_id, staking_lp_actions_2_id)'),
|
||||
tags = ['scheduled_non_core'],
|
||||
)
|
||||
}}
|
||||
|
||||
WITH base_e AS (
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
index,
|
||||
NULL AS inner_index,
|
||||
event_type,
|
||||
program_id,
|
||||
instruction,
|
||||
inner_instruction,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__events') }}
|
||||
WHERE
|
||||
program_id = 'Stake11111111111111111111111111111111111111'
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
max(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% else %}
|
||||
AND _inserted_timestamp BETWEEN '2022-08-12' AND '2023-01-01'
|
||||
{% endif %}
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
instruction_index AS index,
|
||||
inner_index,
|
||||
instruction:parsed:type::STRING AS event_type,
|
||||
instruction:programId::STRING AS program_id,
|
||||
instruction,
|
||||
NULL AS inner_instruction,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__events_inner') }}
|
||||
WHERE
|
||||
program_id = 'Stake11111111111111111111111111111111111111'
|
||||
AND instruction:parsed IS NOT NULL
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
max(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% else %}
|
||||
AND _inserted_timestamp BETWEEN '2022-08-12' AND '2023-01-01'
|
||||
{% endif %}
|
||||
),
|
||||
|
||||
base_t AS (
|
||||
SELECT
|
||||
block_id,
|
||||
tx_id,
|
||||
succeeded,
|
||||
signers,
|
||||
pre_balances,
|
||||
post_balances,
|
||||
pre_token_balances,
|
||||
post_token_balances,
|
||||
account_keys
|
||||
FROM
|
||||
{{ ref('silver__transactions') }}
|
||||
WHERE
|
||||
{% if is_incremental() %}
|
||||
_inserted_timestamp >= (
|
||||
SELECT
|
||||
max(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% else %}
|
||||
_inserted_timestamp BETWEEN '2022-08-12' AND '2023-01-01'
|
||||
{% endif %}
|
||||
)
|
||||
|
||||
SELECT
|
||||
e.block_id,
|
||||
e.block_timestamp,
|
||||
e.tx_id,
|
||||
t.succeeded,
|
||||
e.index,
|
||||
e.inner_index,
|
||||
e.event_type,
|
||||
e.program_id,
|
||||
t.signers,
|
||||
t.account_keys,
|
||||
e.instruction,
|
||||
e.inner_instruction,
|
||||
t.pre_balances,
|
||||
t.post_balances,
|
||||
t.pre_token_balances,
|
||||
t.post_token_balances,
|
||||
e._inserted_timestamp,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['e.block_id', 'e.tx_id', 'e.index', 'e.inner_index']
|
||||
) }} AS staking_lp_actions_2_id,
|
||||
sysdate() AS inserted_timestamp,
|
||||
sysdate() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
base_e e
|
||||
LEFT OUTER JOIN
|
||||
base_t AS t
|
||||
ON t.block_id = e.block_id
|
||||
AND t.tx_id = e.tx_id
|
||||
96
models/silver/non_core/silver__staking_lp_actions_2.yml
Normal file
96
models/silver/non_core/silver__staking_lp_actions_2.yml
Normal file
@ -0,0 +1,96 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__staking_lp_actions_2
|
||||
recent_date_filter: &recent_date_filter
|
||||
config:
|
||||
where: _inserted_timestamp >= current_date - 7
|
||||
data_tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- BLOCK_ID
|
||||
- TX_ID
|
||||
- INDEX
|
||||
- INNER_INDEX
|
||||
where: >
|
||||
block_timestamp::DATE > current_date - 30
|
||||
columns:
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
data_tests:
|
||||
- not_null:
|
||||
where: >
|
||||
block_id > 39824213
|
||||
AND _inserted_timestamp >= current_date - 7
|
||||
- dbt_expectations.expect_row_values_to_have_recent_data:
|
||||
datepart: day
|
||||
interval: 2
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: INDEX
|
||||
description: "{{ doc('index') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: INNER_INDEX
|
||||
description: "{{ doc('inner_index') }}"
|
||||
- name: SUCCEEDED
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: PROGRAM_ID
|
||||
description: "{{ doc('program_id') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: EVENT_TYPE
|
||||
description: "{{ doc('event_type') }}"
|
||||
data_tests:
|
||||
- not_null:
|
||||
where: >
|
||||
SUCCEEDED = TRUE
|
||||
AND block_id > 25706401
|
||||
AND _inserted_timestamp >= current_date - 7
|
||||
- name: SIGNERS
|
||||
description: List of accounts that signed the transaction
|
||||
- name: ACCOUNT_KEYS
|
||||
description: List of accounts that are referenced by pre/post sol/token balances objects
|
||||
- name: INSTRUCTION
|
||||
description: "{{ doc('instruction') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: INNER_INSTRUCTION
|
||||
description: "{{ doc('inner_instruction') }}"
|
||||
- name: PRE_BALANCES
|
||||
description: List of pre-transaction balances for different accounts
|
||||
- name: POST_BALANCES
|
||||
description: List of post-transaction balances for different accounts
|
||||
- name: PRE_TOKEN_BALANCES
|
||||
description: List of pre-transaction token balances for different token accounts
|
||||
- name: POST_TOKEN_BALANCES
|
||||
description: List of post-transaction token balances for different token accounts
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('_inserted_timestamp') }}"
|
||||
data_tests:
|
||||
- not_null
|
||||
- name: STAKING_LP_ACTIONS_2_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
data_tests:
|
||||
- unique: *recent_date_filter
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: _INVOCATION_ID
|
||||
description: '{{ doc("_invocation_id") }}'
|
||||
data_tests:
|
||||
- not_null:
|
||||
name: test_silver__not_null_staking_lp_actions_2_invocation_id
|
||||
<<: *recent_date_filter
|
||||
401
models/silver/non_core/silver__staking_lp_actions_labeled_2.sql
Normal file
401
models/silver/non_core/silver__staking_lp_actions_labeled_2.sql
Normal file
@ -0,0 +1,401 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
incremental_strategy = 'delete+insert',
|
||||
unique_key = ['block_id','tx_id','index'],
|
||||
cluster_by = ['block_timestamp::DATE','event_type'],
|
||||
post_hook = enable_search_optimization('{{this.schema}}', '{{this.identifier}}', 'ON EQUALITY(tx_id,stake_authority,withdraw_authority,stake_account)'),
|
||||
tags = ['scheduled_non_core']
|
||||
) }}
|
||||
|
||||
WITH base_staking_lp_actions AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__staking_lp_actions_2') }}
|
||||
{% if is_incremental() %}
|
||||
WHERE
|
||||
block_timestamp::date >= current_date - 1
|
||||
{% endif %}
|
||||
),
|
||||
|
||||
{% if is_incremental() %}
|
||||
latest_state AS (
|
||||
SELECT
|
||||
stake_account,
|
||||
stake_authority,
|
||||
withdraw_authority,
|
||||
stake_active,
|
||||
vote_account
|
||||
FROM
|
||||
{{ this }}
|
||||
WHERE
|
||||
block_timestamp::date < current_date - 1
|
||||
QUALIFY
|
||||
row_number() OVER (
|
||||
PARTITION BY stake_account
|
||||
ORDER BY block_id DESC, block_timestamp DESC, index DESC, inner_index DESC
|
||||
) = 1
|
||||
),
|
||||
{% else %}
|
||||
/*dummy cte so that downstream code can stay the same*/
|
||||
latest_state AS (
|
||||
SELECT
|
||||
'a' AS stake_account,
|
||||
'a' AS stake_authority,
|
||||
'a' AS withdraw_authority,
|
||||
'a' AS stake_active,
|
||||
'a' AS vote_account
|
||||
),
|
||||
{% endif %}
|
||||
merges_and_splits AS (
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
succeeded,
|
||||
index,
|
||||
inner_index,
|
||||
signers,
|
||||
instruction:parsed:info:stakeAccount::string AS stake_account,
|
||||
NULL AS parent_stake_account,
|
||||
'split_source' AS event_type,
|
||||
account_keys,
|
||||
pre_balances,
|
||||
post_balances,
|
||||
instruction,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
base_staking_lp_actions
|
||||
WHERE
|
||||
event_type = 'split'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
succeeded,
|
||||
index,
|
||||
inner_index,
|
||||
signers,
|
||||
instruction:parsed:info:newSplitAccount::string AS stake_account,
|
||||
instruction:parsed:info:stakeAccount::string AS parent_stake_account,
|
||||
'split_destination' AS event_type,
|
||||
account_keys,
|
||||
pre_balances,
|
||||
post_balances,
|
||||
instruction,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
base_staking_lp_actions
|
||||
WHERE
|
||||
event_type = 'split'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
succeeded,
|
||||
index,
|
||||
inner_index,
|
||||
signers,
|
||||
instruction:parsed:info:destination::string AS stake_account,
|
||||
NULL AS parent_stake_account,
|
||||
'merge_destination' AS event_type,
|
||||
account_keys,
|
||||
pre_balances,
|
||||
post_balances,
|
||||
instruction,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
base_staking_lp_actions
|
||||
WHERE
|
||||
event_type = 'merge'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
succeeded,
|
||||
index,
|
||||
inner_index,
|
||||
signers,
|
||||
instruction:parsed:info:source::string AS stake_account,
|
||||
NULL AS parent_stake_account,
|
||||
'merge_source' AS event_type,
|
||||
account_keys,
|
||||
pre_balances,
|
||||
post_balances,
|
||||
instruction,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
base_staking_lp_actions
|
||||
WHERE
|
||||
event_type = 'merge'
|
||||
),
|
||||
|
||||
all_actions AS (
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
succeeded,
|
||||
index,
|
||||
inner_index,
|
||||
signers,
|
||||
instruction:parsed:info:stakeAccount::string AS stake_account,
|
||||
NULL AS parent_stake_account,
|
||||
event_type,
|
||||
account_keys,
|
||||
pre_balances,
|
||||
post_balances,
|
||||
instruction,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
base_staking_lp_actions
|
||||
WHERE
|
||||
event_type NOT IN ('merge', 'split')
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
merges_and_splits
|
||||
),
|
||||
|
||||
tx_base AS (
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
succeeded,
|
||||
index,
|
||||
inner_index,
|
||||
event_type,
|
||||
lead(event_type, 1) OVER (
|
||||
PARTITION BY stake_account
|
||||
ORDER BY block_id, index, inner_index
|
||||
) AS next_event_type,
|
||||
signers,
|
||||
CASE
|
||||
WHEN event_type = 'initialize' THEN instruction:parsed:info:authorized:staker::string
|
||||
WHEN event_type = 'initializeChecked' THEN instruction:parsed:info:staker::string
|
||||
WHEN event_type = 'authorize' AND instruction:parsed:info:authorityType = 'Staker' THEN instruction:parsed:info:newAuthority::string
|
||||
ELSE instruction:parsed:info:stakeAuthority::string
|
||||
END AS stake_authority,
|
||||
CASE
|
||||
WHEN event_type = 'initialize' THEN instruction:parsed:info:authorized:withdrawer::string
|
||||
WHEN event_type = 'initializeChecked' THEN instruction:parsed:info:withdrawer::string
|
||||
WHEN event_type = 'authorize' AND instruction:parsed:info:authorityType = 'Withdrawer' THEN instruction:parsed:info:newAuthority::string
|
||||
WHEN event_type = 'split_destination' THEN stake_authority
|
||||
ELSE NULL
|
||||
END AS withdraw_authority,
|
||||
stake_account,
|
||||
parent_stake_account,
|
||||
CASE
|
||||
WHEN event_type = 'delegate' THEN TRUE
|
||||
WHEN next_event_type = 'delegate' THEN FALSE
|
||||
WHEN next_event_type = 'deactivate' THEN TRUE
|
||||
WHEN event_type IN ('deactivate', 'merge_source') THEN FALSE
|
||||
ELSE NULL
|
||||
END AS stake_active,
|
||||
silver.udf_get_account_balances_index(stake_account, account_keys) AS balance_index,
|
||||
pre_balances[balance_index]::integer AS pre_tx_staked_balance,
|
||||
post_balances[balance_index]::integer AS post_tx_staked_balance,
|
||||
instruction:parsed:info:voteAccount::string AS vote_acct,
|
||||
CASE
|
||||
WHEN event_type = 'withdraw' THEN instruction:parsed:info:lamports::number
|
||||
ELSE NULL
|
||||
END AS withdraw_amount,
|
||||
CASE
|
||||
WHEN event_type = 'withdraw' THEN instruction:parsed:info:destination::string
|
||||
ELSE NULL
|
||||
END AS withdraw_destination,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
all_actions
|
||||
),
|
||||
|
||||
validators AS (
|
||||
SELECT
|
||||
r.value:identity::string AS node_pubkey,
|
||||
r.value:commission::integer AS commission,
|
||||
r.value:vote_identity::string AS vote_pubkey,
|
||||
r.value:activated_stake::float AS stake,
|
||||
row_number() OVER (ORDER BY stake DESC) AS validator_rank
|
||||
FROM
|
||||
{{ ref('bronze__streamline_validator_metadata_2') }} AS v,
|
||||
table(flatten(data::array)) AS r
|
||||
QUALIFY
|
||||
row_number() OVER(ORDER BY v._partition_by_created_date DESC, v._inserted_timestamp DESC) = 1
|
||||
),
|
||||
|
||||
fill_vote_acct AS (
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
succeeded,
|
||||
index,
|
||||
inner_index,
|
||||
event_type,
|
||||
signers,
|
||||
coalesce(
|
||||
tx_base.stake_authority,
|
||||
last_value(tx_base.stake_authority) IGNORE NULLS OVER (
|
||||
PARTITION BY tx_base.stake_account
|
||||
ORDER BY block_id, index, inner_index
|
||||
ROWS UNBOUNDED PRECEDING
|
||||
),
|
||||
latest_state.stake_authority
|
||||
) AS stake_authority,
|
||||
coalesce(
|
||||
tx_base.withdraw_authority,
|
||||
last_value(tx_base.withdraw_authority) IGNORE NULLS OVER (
|
||||
PARTITION BY tx_base.stake_account
|
||||
ORDER BY block_id, index, inner_index
|
||||
ROWS UNBOUNDED PRECEDING
|
||||
),
|
||||
latest_state.withdraw_authority
|
||||
) AS withdraw_authority,
|
||||
tx_base.stake_account,
|
||||
tx_base.parent_stake_account,
|
||||
coalesce(
|
||||
tx_base.stake_active,
|
||||
last_value(tx_base.stake_active) IGNORE NULLS OVER (
|
||||
PARTITION BY tx_base.stake_account
|
||||
ORDER BY block_id, index, inner_index
|
||||
ROWS UNBOUNDED PRECEDING
|
||||
),
|
||||
latest_state.stake_active
|
||||
) AS stake_active,
|
||||
pre_tx_staked_balance,
|
||||
post_tx_staked_balance,
|
||||
withdraw_amount,
|
||||
withdraw_destination,
|
||||
coalesce(
|
||||
tx_base.vote_acct,
|
||||
last_value(tx_base.vote_acct) IGNORE NULLS OVER (
|
||||
PARTITION BY tx_base.stake_account
|
||||
ORDER BY block_id, index, inner_index
|
||||
ROWS UNBOUNDED PRECEDING
|
||||
),
|
||||
latest_state.vote_account
|
||||
) AS vote_account,
|
||||
tx_base._inserted_timestamp
|
||||
FROM
|
||||
tx_base
|
||||
LEFT OUTER JOIN
|
||||
latest_state
|
||||
ON latest_state.stake_account = tx_base.stake_account
|
||||
),
|
||||
|
||||
temp AS (
|
||||
SELECT
|
||||
b.block_id,
|
||||
b.block_timestamp,
|
||||
b.tx_id,
|
||||
b.succeeded,
|
||||
b.index,
|
||||
b.inner_index,
|
||||
b.event_type,
|
||||
b.signers,
|
||||
b.stake_authority,
|
||||
b.withdraw_authority,
|
||||
b.stake_account,
|
||||
b.parent_stake_account,
|
||||
b.stake_active,
|
||||
b.pre_tx_staked_balance,
|
||||
b.post_tx_staked_balance,
|
||||
b.withdraw_amount,
|
||||
b.withdraw_destination,
|
||||
coalesce(b.vote_account, A.vote_account) AS vote_account,
|
||||
b._inserted_timestamp
|
||||
FROM
|
||||
fill_vote_acct b
|
||||
LEFT OUTER JOIN
|
||||
fill_vote_acct A
|
||||
ON b.tx_id = A.tx_id
|
||||
AND b.index = A.index
|
||||
AND coalesce(b.inner_index, -1) = coalesce(A.inner_index, -1)
|
||||
AND b.event_type = 'split_destination'
|
||||
AND A.event_type = 'split_source'
|
||||
),
|
||||
|
||||
temp2 AS (
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
succeeded,
|
||||
index,
|
||||
inner_index,
|
||||
event_type,
|
||||
signers,
|
||||
stake_authority,
|
||||
withdraw_authority,
|
||||
stake_account,
|
||||
parent_stake_account,
|
||||
stake_active,
|
||||
pre_tx_staked_balance,
|
||||
post_tx_staked_balance,
|
||||
withdraw_amount,
|
||||
withdraw_destination,
|
||||
CASE
|
||||
WHEN vote_account IS NULL
|
||||
THEN last_value(vote_account) IGNORE NULLS OVER (
|
||||
PARTITION BY stake_account
|
||||
ORDER BY block_id, index, inner_index
|
||||
ROWS UNBOUNDED PRECEDING
|
||||
)
|
||||
ELSE vote_account
|
||||
END AS vote_account,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
temp
|
||||
)
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
succeeded,
|
||||
index,
|
||||
inner_index,
|
||||
event_type,
|
||||
signers,
|
||||
stake_authority,
|
||||
withdraw_authority,
|
||||
stake_account,
|
||||
parent_stake_account,
|
||||
stake_active,
|
||||
pre_tx_staked_balance,
|
||||
post_tx_staked_balance,
|
||||
withdraw_amount,
|
||||
withdraw_destination,
|
||||
vote_account,
|
||||
node_pubkey,
|
||||
validator_rank,
|
||||
commission,
|
||||
coalesce(address_name, vote_account) AS validator_name,
|
||||
_inserted_timestamp,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['block_id', 'tx_id', 'index', 'inner_index', 'event_type']
|
||||
) }} AS staking_lp_actions_labeled_2_id,
|
||||
sysdate() AS inserted_timestamp,
|
||||
sysdate() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
temp2
|
||||
LEFT OUTER JOIN
|
||||
validators v
|
||||
ON vote_account = vote_pubkey
|
||||
LEFT OUTER JOIN
|
||||
{{ ref('core__dim_labels') }}
|
||||
ON vote_account = address
|
||||
133
models/silver/non_core/silver__staking_lp_actions_labeled_2.yml
Normal file
133
models/silver/non_core/silver__staking_lp_actions_labeled_2.yml
Normal file
@ -0,0 +1,133 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__staking_lp_actions_labeled_2
|
||||
description: Table for staking & LP actions that contains additional information about the validator.
|
||||
recent_date_filter: &recent_date_filter
|
||||
config:
|
||||
where: _inserted_timestamp >= current_date - 7
|
||||
data_tests:
|
||||
- compare_model_subset:
|
||||
name: silver__staking_lp_actions_labeled_2_business_logic_test
|
||||
compare_model: ref('testing__staking_lp_actions_labeled_2')
|
||||
compare_columns:
|
||||
- stake_account
|
||||
- tx_id
|
||||
- index
|
||||
- inner_index
|
||||
- event_type
|
||||
- stake_authority
|
||||
- withdraw_authority
|
||||
- stake_active
|
||||
- vote_account
|
||||
- validator_name
|
||||
model_condition: "where
|
||||
(
|
||||
stake_account in ('HvqBJ9qJtbFWuTzMncqh7hgeUtHeh8zDsCPrrSPJbRvi',
|
||||
'35bXuoR23q2Rwn2g6o2kUThJRokxEVsbuYCyNt4Mr43H',
|
||||
'HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L',
|
||||
'H6M8LzYL6qKxqVZDQYAmCJfY6KF3MwqNVNijYmHQmLK7')
|
||||
or
|
||||
tx_id in ('WHHEQJ2hrUEnq429azYapvAFS3wccDd262BEVzPgp1JhFzwFBDzmW9MPfLXRLeTHpfj97nXx8k9sQTdUZ4fqJQt',
|
||||
'3WnXfFQtHeRrutF8BbgpUirBRBR5CjNNqKMdSv3bomRBHDTbn5gn3WQ5GHBhgZNH6KnxCdEwu76GL33axi3vMFWJ',
|
||||
'3jUYmgu4ASwGTPtkpDeLgSX3wY1DTLPhXNHf6xj4wTy881keCUKz2TBMEza3THnmKRL6imFM32sp6m8g4nX8v7Jd',
|
||||
'51UcpfRBPjzDa8BNuWtmd5RaMWYG2GoNpsvfFE2zr1VyTxqr62vvRnuwBGUunx3D4uxCpqgGJ5E9YssMoYw3F4Wz',
|
||||
'2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7',
|
||||
'63FGsSQ843DMkdVeQauNkrij3NYSTJHUBmF3VoE8qFCnkPpivSjrBk48rFtvgzvMrzDv88YiSzXV21JBp4XK3AwW',
|
||||
'3DwTtQRT8hKkcGgpT8wEuepwgRDZ8TAs1yD6kgPc6egwJZJ1H8Sw8VgXgTC3BC6NE5DpbsrMdtwcE8b81gt6oVcC',
|
||||
'3z6h9aooG6cPwQCAPur5HTT2vMxC3gGDzWCk3mc5AXkWRJ9yxzANXYBuYL68KwUa4zehgHFALGovGiXargMSzTEs',
|
||||
'apikDqVczz6jwvqxABJ81YHMXRaHSj4WAGyKTUQzvnV547oKDFgCVpa87oay8FqW9FrKJtedYyqXpi6uzkZGd3H',
|
||||
'3URQbmJCcSVLeLDJW9Dfkit8Y3jGxRofzk7GCXhSE7Aum1MgpcZzkSJBprX5SzGXDRaJA56ks9rFCZFZ7foNqSip',
|
||||
'6774K5Q6nYMBiX1bjwr14ScZHwJddcEWvx9NwRspN8yqHVvRkdgGhGfhd6zDJKQQCW3PbqqkbmETsFTq6ywBr1eV')
|
||||
)"
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- BLOCK_ID
|
||||
- TX_ID
|
||||
- INDEX
|
||||
- INNER_INDEX
|
||||
- EVENT_TYPE
|
||||
where: >
|
||||
block_timestamp::DATE > current_date - 30
|
||||
columns:
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: INDEX
|
||||
description: "{{ doc('index') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: INNER_INDEX
|
||||
description: "{{ doc('inner_index') }}"
|
||||
- name: SUCCEEDED
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: EVENT_TYPE
|
||||
description: "{{ doc('event_type') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: SIGNERS
|
||||
description: List of accounts that signed the transaction
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: STAKE_AUTHORITY
|
||||
description: "{{ doc('stake_authority') }}"
|
||||
- name: WITHDRAW_AUTHORITY
|
||||
description: "{{ doc('withdraw_authority') }}"
|
||||
- name: STAKE_ACCOUNT
|
||||
description: "{{ doc('stake_account') }}"
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: PARENT_STAKE_ACCOUNT
|
||||
description: The parent stake account of the stake account.
|
||||
- name: STAKE_ACTIVE
|
||||
description: Whether the stake account is active.
|
||||
- name: WITHDRAW_AMOUNT
|
||||
description: The amount of SOL being withdrawn from the stake account.
|
||||
- name: WITHDRAW_DESTINATION
|
||||
description: The destination wallet address of the withdrawn SOL.
|
||||
- name: PRE_TX_STAKED_BALANCE
|
||||
description: The amount of Solana belonging to the stake account before the transaction.
|
||||
- name: POST_TX_STAKED_BALANCE
|
||||
description: The amount of Solana belonging to the stake account after the transaction.
|
||||
- name: VOTE_ACCOUNT
|
||||
description: A voting account belonging to the validator.
|
||||
- name: NODE_PUBKEY
|
||||
description: A unique key belonging to the validator node.
|
||||
- name: VALIDATOR_RANK
|
||||
description: The rank of the validator by amount of delegated SOL.
|
||||
- name: COMMISSION
|
||||
description: The percentage of staked earnings given to the validator.
|
||||
- name: VALIDATOR_NAME
|
||||
description: The name of the validator.
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('_inserted_timestamp') }}"
|
||||
data_tests:
|
||||
- not_null
|
||||
- name: STAKING_LP_ACTIONS_LABELED_2_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
data_tests:
|
||||
- unique: *recent_date_filter
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
data_tests:
|
||||
- not_null: *recent_date_filter
|
||||
- name: _INVOCATION_ID
|
||||
description: '{{ doc("_invocation_id") }}'
|
||||
data_tests:
|
||||
- not_null:
|
||||
name: test_silver__not_null_staking_lp_actions_labeled_2_invocation_id
|
||||
<<: *recent_date_filter
|
||||
@ -0,0 +1,83 @@
|
||||
{{
|
||||
config(
|
||||
materialized = 'table',
|
||||
tags = ['scheduled_non_core'],
|
||||
)
|
||||
}}
|
||||
|
||||
/*
|
||||
remap withdraw authority using recursion to first parent
|
||||
if stake authority AND withdraw authorityis stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq
|
||||
*/
|
||||
with first_parents AS (
|
||||
select distinct
|
||||
stake_account AS child_stake_account,
|
||||
stake_account AS parent_stake_account,
|
||||
withdraw_authority,
|
||||
1 AS recursion_depth -- Start recursion depth from 1
|
||||
from
|
||||
{{ ref('silver__staking_lp_actions_labeled_2') }}
|
||||
where stake_authority = 'stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq'
|
||||
and withdraw_authority <> 'stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq'
|
||||
and withdraw_authority is not null
|
||||
and succeeded
|
||||
qualify
|
||||
row_number() over (partition by stake_account order by block_timestamp) = 1
|
||||
),
|
||||
children AS (
|
||||
select distinct
|
||||
children.stake_account,
|
||||
children.parent_stake_account
|
||||
from
|
||||
{{ ref('silver__staking_lp_actions_labeled_2') }} AS children
|
||||
left join
|
||||
first_parents
|
||||
on first_parents.parent_stake_account = children.stake_account
|
||||
where
|
||||
first_parents.parent_stake_account IS NULL
|
||||
AND children.parent_stake_account IS NOT NULL
|
||||
AND stake_authority = 'stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq'
|
||||
),
|
||||
ancestry AS (
|
||||
select
|
||||
child_stake_account,
|
||||
parent_stake_account,
|
||||
recursion_depth
|
||||
from first_parents
|
||||
union all
|
||||
select
|
||||
children.stake_account,
|
||||
ancestry.parent_stake_account,
|
||||
ancestry.recursion_depth + 1 AS recursion_depth
|
||||
from ancestry
|
||||
join
|
||||
children
|
||||
on children.parent_stake_account = ancestry.child_stake_account
|
||||
where
|
||||
ancestry.recursion_depth < 10
|
||||
),
|
||||
child_with_first_parent AS (
|
||||
select distinct
|
||||
child_stake_account AS stake_account,
|
||||
parent_stake_account
|
||||
from ancestry
|
||||
),
|
||||
child_with_withdraw_authority AS (
|
||||
select
|
||||
c.stake_account,
|
||||
fp.withdraw_authority
|
||||
from child_with_first_parent as c
|
||||
left join
|
||||
first_parents as fp
|
||||
ON fp.parent_stake_account = c.parent_stake_account
|
||||
group by 1,2
|
||||
)
|
||||
select
|
||||
stake_account,
|
||||
withdraw_authority,
|
||||
{{ dbt_utils.generate_surrogate_key(['stake_account']) }} AS marinade_native_staking_account_withdraw_authority_mapping_id,
|
||||
sysdate() AS inserted_timestamp,
|
||||
sysdate() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
from
|
||||
child_with_withdraw_authority
|
||||
@ -0,0 +1,35 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__marinade_native_staking_account_withdraw_authority_mapping
|
||||
description: Table for re-mapping withdraw authority of native staking accounts using recursive CTE. Strictly for use to model marinade native staking accounts.
|
||||
data_tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- STAKE_ACCOUNT
|
||||
- WITHDRAW_AUTHORITY
|
||||
columns:
|
||||
- name: STAKE_ACCOUNT
|
||||
description: "{{ doc('stake_account') }}"
|
||||
data_tests:
|
||||
- not_null
|
||||
- name: WITHDRAW_AUTHORITY
|
||||
description: "{{ doc('withdraw_authority') }}"
|
||||
data_tests:
|
||||
- not_null
|
||||
- name: MARINADE_NATIVE_STAKING_ACCOUNT_WITHDRAW_AUTHORITY_MAPPING_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
data_tests:
|
||||
- unique
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
data_tests:
|
||||
- not_null
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
data_tests:
|
||||
- not_null
|
||||
- name: _INVOCATION_ID
|
||||
description: '{{ doc("_invocation_id") }}'
|
||||
data_tests:
|
||||
- not_null:
|
||||
name: test_silver__not_null_marinade_native_staking_account_withdraw_authority_mapping_invocation_id
|
||||
Loading…
Reference in New Issue
Block a user