Skip to content
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

Implement ERC20 Total Supply Interaction for Native Transaction Calculation #8

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

PriyanshuVijay-S
Copy link

Overview

This pull request introduces a new feature in the ERC20 contract class to utilize the total supply of ERC20 tokens for calculating native transaction amounts within our ABCI learning agents. By deriving transaction values from token economics, this enhancement aims to link the agent's transactional behavior with the underlying ERC20 token metrics, ensuring that the native transactions are informed by real-time token supply data.

Changes

Detailed changes include updates to the ERC20 contract interface and agent behaviors to facilitate the calculation and execution of native transactions based on ERC20 token supply metrics:

Modified Files

  • ERC20 Contracts:

    • Added totalSupply function to retrieve the total supply of tokens.
  • behaviours.py:

    • Introduced get_erc20_totalSupply to fetch the total supply from the blockchain.
    • Added get_erc20_balance to determine the balance of tokens held by the safe.
    • Implemented reduce_to_single_digit and sum_of_digits functions to compute the transaction amount.

ERC20 Token Metrics Integration

  • Data Retrieval: The total supply and balance of ERC20 tokens are retrieved to compute the base transaction value.
  • Calculation Logic: The quotient of the total supply divided by the safe's balance is processed to extract a single-digit value through digit summation and reduction techniques.
  • Transaction Execution: This single-digit value is then used as the amount for executing native transactions, directly linking the transactional activity to the ERC20 token's overall distribution and availability.

Impact

This integration enhances the transactional intelligence of our agents by:

  • Aligning Transactions with Token Economics: Ensures that native transactions reflect the current state of token distribution and supply dynamics.
  • Increasing Transaction Relevance: Utilizes up-to-date token metrics to inform transaction values, making each transaction more meaningful and contextually appropriate.
  • Improving Decision-Making Processes: By embedding token supply data into transaction logic, agents can make more informed decisions that are consistent with broader economic indicators.

cpp-priyanshu added 6 commits December 1, 2024 04:05
…nents

This commit introduces the ERC20_NEW contract package into the contracts folder, featuring the new class ERC20_NEW designed to enhance our ABCI learning agents with updated token handling capabilities. Changes span across several components to ensure comprehensive integration:

1. **Contracts:**
   - Added ERC20_NEW class in the erc20_new package to manage interactions with ERC20 tokens more effectively.

2. **Agent Configuration:**
   - Updated �ea-config.yaml to reference the new ERC20_NEW contract, ensuring that the agent recognizes and utilizes this new contract class.

3. **Service Configuration:**
   - Modified service.yaml to include configurations that align with the changes in the ERC20_NEW contract operations.

4. **Skill Updates:**
   - Updated skill.yaml in both skill/learning_abci and skill/learning_chained_abci to ensure skills are compatible with the new contract functionalities.
   - Revised behaviors in �ehaviours.py to incorporate methods from ERC20_NEW for enhanced token transactions.

These updates ensure that our learning agents are well-equipped to handle ERC20 token transactions with the latest contract logic, reflecting improved efficiency and compliance with current blockchain standards.
@PriyanshuVijay-S
Copy link
Author

I've pushed new changes to this pull request that include the implementation of the ERC20_NEW contract package and related updates across various components. Please review the latest commits. Thanks!

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.

1 participant