Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • hackjealousy/thornode
  • thorchain/thornode
  • lpfloyd/thornode
  • balder7/thornode
  • Gaiieg/thornode
  • vivek.vardhan7/thornode
  • yairi.medinac/thornode
  • alessio/thornode
  • stjordanis/thornode
  • jtakalai1/thornode
  • ggulgun/thornode
  • pascaldekloe/thornode
  • n.huskisson1992/thornode
  • horacio.mlequo/thornode
  • blockx-labs/thornode
  • silverbackgodx/thornode
  • aleksbez/thornode
  • kushptl/thornode
  • difordcrypt/thornode
  • 5thdimension/thornode
  • edgarmanuelruizplasticos/thornode
  • DevLopME-Az/thornode
  • aswizzle/thornode
  • kiasaki/thornode
  • zhangliang041/thornode
  • cartersz/thornode
  • vikingshield/thornode
  • crzyazblue1/thornode
  • vkbdev/thornode
  • nathanaafo/thornode
  • bi23com_guard/thornode
  • crux25/thornode
  • TheArchitect108/thornode
  • zby121103/thornode
  • the_eridanus/thornode
  • halley9r/thornode
  • pendergrassjohn288/thornode
  • faisal1389/thornode
  • alexdcox/thornode
  • huginntc/thornode
  • guidovranken/thornode
  • thorCatStevens/thornode
  • mogarchy/thornode
  • blackprotocol/blacknode
  • pranav292gpt/thornode
  • dp49/thornode
  • Bevan96230395/thornode
  • JonathanLorimer/thornode
  • akil27/thornode
  • assafmo/thornode
  • Multipartite/thornode
  • george_s/thornode
  • thehuman/thornode
  • 0x-General/thornode
  • kaladinlight/thornode
  • oliver154/thornode
  • TreefeedXavier/thornode
  • veado/thornode
  • HooriRn/thornode
  • PaperNautilus/thornode
  • scorchedfire/thornode
  • KevinXdefi/thornode
  • canziclark24/thornode
  • GiMa-Maya/blacknode
  • ajabhishek759/thornode
  • akincibor/thornode
  • digitaldollarchain/digital-dollar-node
  • rufus.t.firefly/thornode
  • lends/thornode
  • mohs1n/thornode
  • SaifulJnU/thornode
  • SamusElderg/thornode
  • Hippocampus.web3/thornode
  • TxCorpi0x/thornode
  • ursa9r/thornode
  • mdanny1209/thornode
  • OxQuasar/thornode
  • justinvforvendetta/thornode
  • pluto_x1/thornode
  • cryptobuks/thornode
  • samyap/thornode
  • AsmundTHORSec/thornode
  • jiecut42/thornode
  • fishtail6993/thornode
  • koitsu/thornode
  • TheRagnarLodbrok/thornode
  • leonalistingservice/thornode
  • cosminl/thornode
  • zlyzol/thornode
  • inkthorchain/thornode
  • dyns/thornode
  • OKEAMAH/thornode
  • kirtixs/thornode
  • asamere/thornode
  • codehans/thornode
  • markfromdenmark/thornode
  • starsquid/thornode
  • danbryan1/thornode
  • jonreiter/thornode
  • beorn_9r/thornode
  • ahdzib/thornode
  • aper.cu/thornode
  • rekt0x/thornode
  • pharr117/thornode
  • gima-swapkit/thornode
  • proof.of.steve/thornode
  • proof.of.steve/thor-node-2
  • mayachain/thorchain/thornode
  • kocubinski/thornode
  • mattshields/thorchain/thornode
110 results
Show changes
Commits on Source (3)
......@@ -587,6 +587,8 @@ func (c *Client) SignTx(tx stypes.TxOutItem, height int64) ([]byte, []byte, *sty
if scheduledMaxFee.Cmp(estimatedFee) < 0 {
c.logger.Warn().
Stringer("in_hash", tx.InHash).
Stringer("rate", gasRate).
Uint64("estimated_gas", estimatedGas).
Str("estimated_fee", estimatedFee.String()).
Str("scheduled_max_fee", scheduledMaxFee.String()).
Msg("max gas exceeded, aborting to let thornode reschedule")
......
......@@ -568,6 +568,8 @@ func (c *EVMClient) buildOutboundTx(txOutItem stypes.TxOutItem, memo mem.Memo, n
if scheduledMaxFee.Cmp(estimatedFee) < 0 {
c.logger.Warn().
Stringer("in_hash", txOutItem.InHash).
Stringer("rate", gasRate).
Uint64("estimated_gas", estimatedGas).
Str("estimated_fee", estimatedFee.String()).
Str("scheduled_max_fee", scheduledMaxFee.String()).
Msg("max gas exceeded, aborting to let thornode reschedule")
......
......@@ -158,6 +158,11 @@ services:
BIFROST_CHAINS_GAIA_BLOCK_SCANNER_OBSERVATION_FLEXIBILITY_BLOCKS: "5"
BIFROST_CHAINS_LTC_BLOCK_SCANNER_OBSERVATION_FLEXIBILITY_BLOCKS: "5"
# maintain historical gas limits for hard-coded smoke test values
BIFROST_CHAINS_ETH_BLOCK_SCANNER_MAX_GAS_LIMIT: 80000
BIFROST_CHAINS_AVAX_BLOCK_SCANNER_MAX_GAS_LIMIT: 80000
BIFROST_CHAINS_BSC_BLOCK_SCANNER_MAX_GAS_LIMIT: 80000
# enable bsc
BIFROST_CHAINS_BSC_DISABLED: "false"
BIFROST_CHAINS_BSC_RPC_HOST: ${BSC_HOST:-http://binance-smart:8545}
......
......@@ -149,7 +149,7 @@ bifrost:
concurrency: 1
chain_id: ETH
observation_flexibility_blocks: 20
max_gas_limit: 80000
max_gas_limit: 100000
mempool_tx_id_cache_size: 0
scanner_leveldb: *default-leveldb
avax:
......@@ -164,7 +164,7 @@ bifrost:
gas_cache_blocks: 40
gas_price_resolution: 50_000_000_000 # 50 navax
observation_flexibility_blocks: 80
max_gas_limit: 80000
max_gas_limit: 100000
whitelist_tokens:
- 0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7 # USDT
- 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E # USDC
......@@ -185,7 +185,7 @@ bifrost:
gas_cache_blocks: 40
gas_price_resolution: 50_000_000_000 # 50 gwei
observation_flexibility_blocks: 80
max_gas_limit: 80000
max_gas_limit: 100000
whitelist_tokens: # stable coins only
- 0x55d398326f99059fF775485246999027B3197955 # Binance Pegged USDT
- 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d # Binance Pegged USDC
......
# ADR 012: Scale Lending
## Changelog
- 2021-01-30: Proposed
## Context
### Lending
Lending was launched in Q3 2023. As of writing:
1. 1.3k loans opened with $24m in collateral from ~700 borrowers, to issue $7m in debt
2. 3.68m RUNE burnt from collateral, with 2m RUNE minted to create debt
3. 88% percent "full" based on the lending lever
4. System Risk extremely low, with Full Closure Scenario resulting in 700k RUNE burnt forever (safe)
5. No observed attacks on the Lending Lever and/or TOR Anchor pool prices
Lending has been shown to be safe, controlled and has almost reached caps. It is time to Scale Lending.
https://flipsidecrypto.xyz/banbannard/⚡-thor-chain-lending-thorchain-lending-fOAKej
https://dashboards.ninerealms.com/#lending
### Standby Reserve
The Standby Reserve has 60,000,000 RUNE held in idle, waiting to be deployed. This was allocated since Genesis to be used by the protocol when it was ready for it.
https://runescan.io/address/thor1lj62pg6ryxv2htekqx04nv7wd3g98qf9gfvamy
## Current Params
```text
"MAXCR": 50000, //500%
"MINCR": 20000, //200%
```
## Proposal
To scale Lending, reduce risk and increase Lending Lever safely the following is proposed:
1. Set `"MAXCR": 20000` (200%)
2. Burn the 60,000,000 Standby Reserve
### MAXCR
Currently the CR for BTC is at maximum (500%) whilst the CR for ETH is at ~300%.
By reducing the Max Collaterisation Ratio down to 200% the following is achieved
1. More loans will be opened since terms are favourable
2. Full Closure Scenario is less likely to net-mint RUNE because the debt-collateral ratio is 2x, not 5x
3. More loans are unlikely to be closed in bear markets because $collateral is likely to be less than $debt (since only has to fall 2x instead of 5x)
### Burn Reserve
By burning the 60m Standby Reserve, the Lending Lever is:
1. Scaled by 5x (15m to 75m)
2. Safer for current borrowers since there is more buffer to fill before the RUNE supply circuit breaker is hit at 500m supply
3. Safer for the protocol by taking the 60m RESERVE out of possible circulation (if it was added to MAIN Reserve)
## Other Considerations
The Standby Reserve has always been a "Plan B" for the protocol, a joker up its sleeve to play. It's time to play it. By burning it, it makes all outstanding RUNE notionally more valuable.
Burning it also frees up space for the protocol to Scale Lending (which is a successful feature), as well as space to launch future features:
1. Stablecoin (will require space under the cap to mint)
2. Perpetuals (will use derived assets, so needs space)
## References
- [ADR-011](https://gitlab.com/thorchain/thornode/-/blob/develop/docs/architecture/adr-011-lending.md)
......@@ -26,6 +26,25 @@ import (
"gopkg.in/yaml.v3"
)
////////////////////////////////////////////////////////////////////////////////////////
// Template
////////////////////////////////////////////////////////////////////////////////////////
// opFuncMap returns a routine-scoped function map used to render template expressions
// passed through from the outer rendering - variables dependent on execution state.
func opFuncMap(routine int) template.FuncMap {
return template.FuncMap{
"native_txid": func(i int) string {
nativeTxIDsMu.Lock()
defer nativeTxIDsMu.Unlock()
if i < 0 {
i += len(nativeTxIDs[routine]) + 1
}
return nativeTxIDs[routine][i-1]
},
}
}
////////////////////////////////////////////////////////////////////////////////////////
// Operation
////////////////////////////////////////////////////////////////////////////////////////
......@@ -237,6 +256,14 @@ func (op *OpCheck) Execute(out io.Writer, routine int, _ *os.Process, logs chan
return fmt.Errorf("check")
}
tmpl := template.Must(template.Must(templates.Clone()).Funcs(opFuncMap(routine)).Parse(op.Endpoint))
expr := bytes.NewBuffer(nil)
err := tmpl.Execute(expr, nil)
if err != nil {
log.Fatal().Err(err).Msg("failed to render assert expression")
}
op.Endpoint = expr.String()
// build request
req, err := http.NewRequest("GET", op.Endpoint, nil)
if err != nil {
......@@ -301,19 +328,8 @@ func (op *OpCheck) Execute(out io.Writer, routine int, _ *os.Process, logs chan
// pipe response to jq for assertions
for _, a := range op.Asserts {
// render the assert expression (used for native_txid)
funcMap := template.FuncMap{
"native_txid": func(i int) string {
// allow reverse indexing
nativeTxIDsMu.Lock()
defer nativeTxIDsMu.Unlock()
if i < 0 {
i += len(nativeTxIDs[routine]) + 1
}
return nativeTxIDs[routine][i-1]
},
}
tmpl := template.Must(template.Must(templates.Clone()).Funcs(funcMap).Parse(a))
expr := bytes.NewBuffer(nil)
tmpl = template.Must(template.Must(templates.Clone()).Funcs(opFuncMap(routine)).Parse(a))
expr = bytes.NewBuffer(nil)
err = tmpl.Execute(expr, nil)
if err != nil {
log.Fatal().Err(err).Msg("failed to render assert expression")
......@@ -565,20 +581,9 @@ type OpTxObservedOut struct {
func (op *OpTxObservedOut) Execute(out io.Writer, routine int, _ *os.Process, logs chan string) error {
// render the memos (used for native_txid)
funcMap := template.FuncMap{
"native_txid": func(i int) string {
// allow reverse indexing
nativeTxIDsMu.Lock()
defer nativeTxIDsMu.Unlock()
if i < 0 {
i += len(nativeTxIDs[routine]) + 1
}
return nativeTxIDs[routine][i-1]
},
}
for i := range op.Txs {
tx := &op.Txs[i]
tmpl := template.Must(template.Must(templates.Clone()).Funcs(funcMap).Parse(tx.Tx.Memo))
tmpl := template.Must(template.Must(templates.Clone()).Funcs(opFuncMap(routine)).Parse(tx.Tx.Memo))
memo := bytes.NewBuffer(nil)
err := tmpl.Execute(memo, nil)
if err != nil {
......
......@@ -28,6 +28,11 @@ endpoint: http://localhost:1317/cosmos/bank/v1beta1/balances/{{ addr_thor_fox }}
asserts:
- .balances[]|select(.denom=="rune")|.amount|tonumber == 2500100000000
---
type: check
endpoint: http://localhost:1317/cosmos/tx/v1beta1/txs/{{ native_txid -1 }}
asserts:
- .tx_response.code == 0
---
########################################################################################
# send twice with distinct sequence numbers
########################################################################################
......