Implement Conditional Native Coin Deposits into ERC20 Contracts #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Contract Module Enhancement:
ERC20_NEW
class within thecontracts/erc20_new
directory to include a deposit function, allowing for native coin deposits under specific conditions.Agent Behavior Adjustment:
ConditionalNativeTransferBehaviour
in theskill/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.New Functional Implementations:
get_erc20_native_coin_deposite_safe_tx_hash
to generate transaction hashes for deposit transactions.get_erc20_native_coin_deposite_data
to prepare the data payload necessary for deposit transactions.Detailed Modifications:
contract.py
: Integrated a newdeposit
method in theERC20_NEW
class, enabling direct interaction with the blockchain for depositing tokens.behaviours.py
(skill/learning_abci): Enhanced theConditionalNativeTransferBehaviour
class to: