Skip to content

Change OCEAN token to USDC#1751

Closed
trizin wants to merge 42 commits intomainfrom
rename-ocean-token-to-prediction-token
Closed

Change OCEAN token to USDC#1751
trizin wants to merge 42 commits intomainfrom
rename-ocean-token-to-prediction-token

Conversation

@trizin
Copy link
Copy Markdown
Contributor

@trizin trizin commented Nov 3, 2025

This pull request refactors the codebase to generalize the staking and payout token from a hardcoded "OCEAN" token to a hardcoded "USDC" token

CLI and Documentation Updates

  • Renamed the payout claim CLI command and related code from claim_OCEAN to claim_payouts, and updated documentation and argument parsing to reflect the new naming.

Testing Refactor

  • Updated all tests to use the USDC fixture and address, and ensured mocks and test logic are compatible with the new token abstraction.

Code Improvements

  • Added a cached token_symbol property to FeedContract for improved logging clarity and reduced redundant contract calls.

These changes collectively make the codebase more flexible, maintainable, and ready for supporting USDC

trizin added 26 commits November 3, 2025 10:27
…for consistency across tests and implementations
…istency in check_network and predictoor_stats modules
@trizin trizin requested a review from KatunaNorbert November 6, 2025 12:07
@trizin trizin marked this pull request as ready for review November 6, 2025 12:07
Comment thread pdr_backend/dfbuyer/dfbuyer_agent.py Outdated
@KatunaNorbert
Copy link
Copy Markdown
Member

Doing a quick search in the code base I can see there are still multiple places where OCEAN token is mentioned, why aren't those updates as well?

Comment thread pdr_backend/analytics/check_network.py Outdated
" LOW OCEAN BALANCE!"
if ocean_bal < Eth(10).to_wei() and name != "trueval"
" LOW PREDICTION TOKEN BALANCE!"
if prediction_bal < Eth(10).to_wei() and name != "trueval"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we refere to the stake token as prediction token here? I suggest we keep it consistent with the rest and name is to stake_token_bal

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I first changed it to that then made it prediction token, missed this one.

Fixed now!

Comment thread README.md Outdated
- `trader` - buy aggregated predictions, then trade
- `sim` - experiments / simulation flow
- `payout` - OCEAN & ROSE payout
- `payout` - prediction & ROSE payout
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing left, I think here it should say staked_token or USDC

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@trizin trizin requested a review from trentmc November 7, 2025 12:31
@trentmc
Copy link
Copy Markdown
Member

trentmc commented Nov 7, 2025

What is the github issue for this? Please link to it in the PR title, and the PR description. (And that issue should link to the overall epic.) If these github issue(s) do not exist, then please create them.

@trentmc trentmc changed the title Change OCEAN token to prediction token Change OCEAN token to stake token Nov 7, 2025
@trentmc
Copy link
Copy Markdown
Member

trentmc commented Nov 7, 2025

(I just renamed this PR to be in line with the naming in the code changes itself. Prediction token -> stake token.)

Copy link
Copy Markdown
Member

@trentmc trentmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought more about this. I don't think we should make it more general to stake_token.

Rather, just make it a hardcoded change from OCEAN to USDC.

Why: because the extra layer of indirection adds complexity & risk.

  • Complexity in code changes. Eg munging "address.json" for stake_token. Instead, "address.json" itself should simply hold the addresses for USDC. Way way cleaner.
  • Complexity in review. If hardcoded OCEAN -> USDC, most changes would be trivial. But with stake_token there's a bunch more logic. Also in general it makes the code harder to read.
  • Complexity in usage. READMEs should be saying USDC not stake_token. Etc etc.
  • This additional complexity increases risk. Predictoor is not the main focus right now. I don't want to accidentally break, and then lose weeks fixing it. KISS, get the thing done, move on.

Once this change is made, ping me, and I will do a more thorough review.

@KatunaNorbert changes elsewhere (webapp etc) should also be hardcoded USDC, not stake_token. Please update as needed.

Comment thread README.md Outdated
@trizin trizin linked an issue Nov 8, 2025 that may be closed by this pull request
@trizin trizin changed the title Change OCEAN token to stake token Change OCEAN token to USDC Nov 8, 2025
@trizin trizin requested a review from trentmc November 8, 2025 13:37
Copy link
Copy Markdown
Member

@trentmc trentmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting close! My comments are all about minimizing the changes to minimize risk, so that it's just nearly only a character-for-character change of OCEAN -> USDC.

stake_token = feed_contract1.get_stake_token()
assert stake_token == web3_pp.OCEAN_address
def test_get_USDC(feed_contract1, web3_pp):
USDC = feed_contract1.get_USDC()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the contract previously had the function get_stake_token() then why change it here? Let's minimize the changes.

Comment thread pdr_backend/dfbuyer/dfbuyer_agent.py

mock_get_opf_addresses.return_value = {
"dfbuyer": "0xdfBuyerAddress",
"dfbuyer": "0x0000000000000000000000000000000000000000",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep it as 0xdfBuyerAddress if possible. It makes it more obvious.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0xdfBuyerAddress throws an error in tests because the address is not valid

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Then go ahead with the 0x00.. address I guess.

Comment thread pdr_backend/cli/cli_arguments.py
Comment thread pdr_backend/contract/feed_contract.py Outdated
def set_token(self, web3_pp):
stake_token = self.get_stake_token()
self.token = Token(web3_pp, stake_token)
USDC = self.get_USDC()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, if the smart contract already has get_stake_token() then let's leave it as that. Minimize rocking the boat.

Comment thread pdr_backend/contract/feed_contract.py Outdated

# approve
logger.info("Approve spend OCEAN: begin")
logger.info("Approve spend %s: begin", self.token_symbol)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the extra layer of indirection. Then: does it need self.token_symbol attribute at all? I want to minimize rocking the boat here.

Comment thread pdr_backend/contract/feed_contract.py Outdated
@arguments
predicted_value: The predicted value (True or False)
stake_amt: The amount of OCEAN to stake in prediction (in ETH, not wei)
stake_amt: The amount of tokens to stake in prediction (in ETH, not wei)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokens -> USDC

Comment thread pdr_backend/contract/fixed_rate.py Outdated
@description
Given an exact target # datatokens, calculates # basetokens
(OCEAN) needed to get it, and fee amounts too.
(tokens) needed to get it, and fee amounts too.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokens -> USDC

Comment thread pdr_backend/contract/fixed_rate.py Outdated

@return
baseTokenAmt_wei - # OCEAN needed, in wei
baseTokenAmt_wei - # tokens needed, in wei
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokens -> USDC.

Comment thread pdr_backend/analytics/check_network.py Outdated
logger.info("Checking account balances")

OCEAN = web3_pp.OCEAN_Token
USDC = web3_pp.USDC
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

USDC -> `USDC_token'. Minimize rocking the boat.

Copy link
Copy Markdown
Member

@trentmc trentmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for responding to my earlier comments.

@trizin trizin closed this Feb 17, 2026
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.

Change web3_pp OCEAN address and token to USDC

3 participants