Skip to content

Add TR.ENERGY yield adapter (TRON) #1896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed

Conversation

trxadm
Copy link

@trxadm trxadm commented Jun 2, 2025

TR.ENERGY is a non-custodial platform on TRON that automates energy delegation.
Users stake TRX on their own wallets and delegate energy rights to our hotspot to save on transaction costs.

This adapter returns estimated APY and TVL for the TRX staking via TR.ENERGY based on on-chain balances and TRX price.

Hotspot: TMP3f4UtGBc3dMAj7eA2afzyULaehN3uhZ
Website: https://tr.energy
Explorer: https://tronscan.org/#/address/TMP3f4UtGBc3dMAj7eA2afzyULaehN3uhZ

@llamatester
Copy link

Error while running trenergy.js adapter:

Test Suites: 2 failed, 2 total
Tests: 0 total
Snapshots: 0 total
Time: 0.764 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬────────────────┬────────┬────────────┬────────┬────────────┬─────────┐
│ (index) │ pool           │ chain  │ project    │ symbol │ tvlUsd     │ apyBase │
├─────────┼────────────────┼────────┼────────────┼────────┼────────────┼─────────┤
│ 0       │ 'trenergy-trx' │ 'Tron' │ 'trenergy' │ 'TRX'  │ 43719907.4 │ 18.36   │
└─────────┴────────────────┴────────┴────────────┴────────┴────────────┴─────────┘
}

@slasher125
Copy link
Collaborator

slasher125 commented Jun 4, 2025

@trxadm i think there is a misunderstanding about how the yield server works. pls check the readme (no need to add test scripts, we have these!)

hardcoded staking values and apr??

trxadm added 3 commits June 13, 2025 14:00
Add dynamic TRX price from core.tr.energy and calculate TVL from total_energy.
Fetch TRX/USDT rate from core.tr.energy instead of hardcoding
Delete test.js
@trxadm
Copy link
Author

trxadm commented Jun 13, 2025

thanks for the comments!

We’ve removed the test script and replaced the hardcoded values with live data:

TRX/USDT rate is now fetched from https://core.tr.energy/api/config

TVL is dynamically calculated from total_energy in https://core.tr.energy/api/energy-stats

Final TVL = total_energy / 10.52 × TRX price from the config API

All logic is now based on live API data, no hardcoded values remain

@slasher125
Copy link
Collaborator

@trxadm pls remove the tests files, also, pls check the readme again what needs to be exported (and shouldn't be exported from the adapter!) yield server is slightly different compared to the tvl server

@llamatester
Copy link

Error while running trenergy.js adapter:

Test Suites: 2 failed, 2 total
Tests: 0 total
Snapshots: 0 total
Time: 0.762 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬────────────────┬────────┬────────────┬────────┬───────────────────┬────────────────────┬──────────────────┬─────────────────────┐
│ (index) │ pool           │ chain  │ project    │ symbol │ tvlUsd            │ apyBase            │ underlyingTokens │ url                 │
├─────────┼────────────────┼────────┼────────────┼────────┼───────────────────┼────────────────────┼──────────────────┼─────────────────────┤
│ 0       │ 'trenergy-trx' │ 'Tron' │ 'trenergy' │ 'TRX'  │ 47558140.99460076 │ 14.156269999999996 │ [ 'TRX' ]        │ 'https://tr.energy' │
└─────────┴────────────────┴────────┴────────────┴────────┴───────────────────┴────────────────────┴──────────────────┴─────────────────────┘
}

@llamatester
Copy link

Error while running trenergy.js adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.29 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬────────────────┬────────┬────────────┬────────┬───────────────────┬────────────────────┬──────────────────┬─────────────────────┐
│ (index) │ pool           │ chain  │ project    │ symbol │ tvlUsd            │ apyBase            │ underlyingTokens │ url                 │
├─────────┼────────────────┼────────┼────────────┼────────┼───────────────────┼────────────────────┼──────────────────┼─────────────────────┤
│ 0       │ 'trenergy-trx' │ 'Tron' │ 'trenergy' │ 'TRX'  │ 47558140.99460076 │ 14.156269999999996 │ [ 'TRX' ]        │ 'https://tr.energy' │
└─────────┴────────────────┴────────┴────────────┴────────┴───────────────────┴────────────────────┴──────────────────┴─────────────────────┘
}

@llamatester
Copy link

Error while running trenergy.js adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.283 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬────────────────┬────────┬────────────┬────────┬───────────────────┬────────────────────┬──────────────────┬─────────────────────┐
│ (index) │ pool           │ chain  │ project    │ symbol │ tvlUsd            │ apyBase            │ underlyingTokens │ url                 │
├─────────┼────────────────┼────────┼────────────┼────────┼───────────────────┼────────────────────┼──────────────────┼─────────────────────┤
│ 0       │ 'trenergy-trx' │ 'Tron' │ 'trenergy' │ 'TRX'  │ 47764301.56629468 │ 15.755689999999998 │ [ 'TRX' ]        │ 'https://tr.energy' │
└─────────┴────────────────┴────────┴────────────┴────────┴───────────────────┴────────────────────┴──────────────────┴─────────────────────┘
}

@slasher125
Copy link
Collaborator

@trxadm project=tr-energy, dont forget to update the folder name too

Changed  project: "trenergy" to project: "tr-energy"
@llamatester
Copy link

Error while running trenergy.js adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.284 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬────────────────┬────────┬─────────────┬────────┬───────────────────┬────────────────────┬──────────────────┬─────────────────────┐
│ (index) │ pool           │ chain  │ project     │ symbol │ tvlUsd            │ apyBase            │ underlyingTokens │ url                 │
├─────────┼────────────────┼────────┼─────────────┼────────┼───────────────────┼────────────────────┼──────────────────┼─────────────────────┤
│ 0       │ 'trenergy-trx' │ 'Tron' │ 'tr-energy' │ 'TRX'  │ 47714495.71391635 │ 14.128209999999996 │ [ 'TRX' ]        │ 'https://tr.energy' │
└─────────┴────────────────┴────────┴─────────────┴────────┴───────────────────┴────────────────────┴──────────────────┴─────────────────────┘
}

edited index.js
@llamatester
Copy link

Error while running trenergy.js adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.281 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬────────────────┬────────┬─────────────┬────────┬────────────────────┬────────────────────┬──────────────────┬─────────────────────┐
│ (index) │ pool           │ chain  │ project     │ symbol │ tvlUsd             │ apyBase            │ underlyingTokens │ url                 │
├─────────┼────────────────┼────────┼─────────────┼────────┼────────────────────┼────────────────────┼──────────────────┼─────────────────────┤
│ 0       │ 'trenergy-trx' │ 'Tron' │ 'tr-energy' │ 'TRX'  │ 47714471.498070344 │ 14.128209999999996 │ [ 'TRX' ]        │ 'https://tr.energy' │
└─────────┴────────────────┴────────┴─────────────┴────────┴────────────────────┴────────────────────┴──────────────────┴─────────────────────┘
}

@slasher125
Copy link
Collaborator

@trxadm the structure is still wrong, u need to create a folder tr-energy and put the index file in there. and pls delete the utils file which u created

@slasher125
Copy link
Collaborator

user created new PR here #1948
closing this one

@slasher125 slasher125 closed this Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants