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
16 changes: 16 additions & 0 deletions contracts/lending_pool/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,19 @@ pub fn admin_transferred(env: &Env, previous_admin: Address, new_admin: Address,
let topics = (Symbol::new(env, "AdminTransferred"), via);
env.events().publish(topics, (previous_admin, new_admin));
}

/// Emitted on every mutation of a token pool's share-pricing state
/// (`deposit`, `withdraw`/`emergency_withdraw`, `distribute_yield`) so that
/// off-chain indexers can reconcile quoted prices against the last settled
/// on-chain price and detect ledger skew (#1380).
pub fn price_updated(
env: &Env,
token: Address,
ledger_seq: u32,
total_managed_assets: i128,
total_shares: i128,
) {
let topics = (Symbol::new(env, "PriceUpdated"), token);
env.events()
.publish(topics, (ledger_seq, total_managed_assets, total_shares));
}
288 changes: 246 additions & 42 deletions contracts/lending_pool/src/lib.rs

Large diffs are not rendered by default.

637 changes: 496 additions & 141 deletions contracts/lending_pool/src/test.rs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@
"hi": 0,
"lo": 3000
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -166,6 +172,12 @@
"hi": 0,
"lo": 1000
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -219,6 +231,12 @@
"hi": 0,
"lo": 1000
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -659,6 +677,24 @@
}
}
},
{
"key": {
"vec": [
{
"symbol": "TotalManagedAssets"
},
{
"address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL"
}
]
},
"val": {
"i128": {
"hi": 0,
"lo": 3000
}
}
},
{
"key": {
"vec": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
"hi": 0,
"lo": 3000
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -450,6 +456,24 @@
}
}
},
{
"key": {
"vec": [
{
"symbol": "TotalManagedAssets"
},
{
"address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL"
}
]
},
"val": {
"i128": {
"hi": 0,
"lo": 3000
}
}
},
{
"key": {
"vec": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
"hi": 0,
"lo": 1
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -142,6 +148,12 @@
"hi": 0,
"lo": 1
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -369,6 +381,24 @@
}
}
},
{
"key": {
"vec": [
{
"symbol": "TotalManagedAssets"
},
{
"address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL"
}
]
},
"val": {
"i128": {
"hi": 0,
"lo": 0
}
}
},
{
"key": {
"vec": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
"hi": 0,
"lo": 100
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -142,6 +148,12 @@
"hi": 0,
"lo": 1
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -474,6 +486,24 @@
}
}
},
{
"key": {
"vec": [
{
"symbol": "TotalManagedAssets"
},
{
"address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL"
}
]
},
"val": {
"i128": {
"hi": 0,
"lo": 99
}
}
},
{
"key": {
"vec": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
"hi": 0,
"lo": 100
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -142,6 +148,12 @@
"hi": 0,
"lo": 50
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -474,6 +486,24 @@
}
}
},
{
"key": {
"vec": [
{
"symbol": "TotalManagedAssets"
},
{
"address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL"
}
]
},
"val": {
"i128": {
"hi": 0,
"lo": 50
}
}
},
{
"key": {
"vec": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
"hi": 0,
"lo": 100
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -142,6 +148,12 @@
"hi": 0,
"lo": 100
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -369,6 +381,24 @@
}
}
},
{
"key": {
"vec": [
{
"symbol": "TotalManagedAssets"
},
{
"address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL"
}
]
},
"val": {
"i128": {
"hi": 0,
"lo": 0
}
}
},
{
"key": {
"vec": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
"hi": 0,
"lo": 3000
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -142,6 +148,12 @@
"hi": 0,
"lo": 1000
}
},
{
"i128": {
"hi": 0,
"lo": 0
}
}
]
}
Expand Down Expand Up @@ -474,6 +486,24 @@
}
}
},
{
"key": {
"vec": [
{
"symbol": "TotalManagedAssets"
},
{
"address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL"
}
]
},
"val": {
"i128": {
"hi": 0,
"lo": 2000
}
}
},
{
"key": {
"vec": [
Expand Down
Loading
Loading