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 Conditional Native Coin Deposits into ERC20 Contracts #12

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 sophisticated transaction mechanism into our ABCI agent's workflow, enabling conditional deposits of native coins into an ERC20 contract using Gnosis Safe. This update enriches our contract interactions by aligning native transactions with tokenomics, introducing decision-based transaction pathways that enhance our platform's financial operations.

Changes

  1. Contract Module Enhancement:

    • Updated the ERC20_NEW class within the contracts/erc20_new directory to include a deposit function, allowing for native coin deposits under specific conditions.
  2. Agent Behavior Adjustment:

    • Modified ConditionalNativeTransferBehaviour in the skill/learning_abci skill to incorporate new logic where the transaction type (transfer vs. deposit) is determined by the parity (even or odd) of a calculated single digit, derived from the total supply and the sender's balance.
  3. New Functional Implementations:

    • Introduced get_erc20_native_coin_deposite_safe_tx_hash to generate transaction hashes for deposit transactions.
    • Developed get_erc20_native_coin_deposite_data to prepare the data payload necessary for deposit transactions.

Detailed Modifications:

  • contract.py: Integrated a new deposit method in the ERC20_NEW class, enabling direct interaction with the blockchain for depositing tokens.
  • behaviours.py (skill/learning_abci): Enhanced the ConditionalNativeTransferBehaviour class to:
    • Fetch the current total supply and calculate a decisive single digit.
    • Conditionally execute native coin transfers or deposits based on the derived single digit's parity.
    • Ensure transaction completions are monitored and confirmed, signaling successful execution.

cpp-priyanshu added 8 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.
- Extend ConditionalNativeTransferBehaviour to handle conditional deposits into an ERC20 contract.
- Add logic to deposit native coins based on the parity of the calculated transaction value.
- Update contract.py in erc20_new and behaviours.py in skill/learning_abci with new deposit functionality.
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