-
Notifications
You must be signed in to change notification settings - Fork 11
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
refactor: replace builders with evm #134
refactor: replace builders with evm #134
Conversation
…osystem/php-crypto into refactor/replace-builders-with-evm
@ItsANameToo for now updated the docs consider the changes of this PR https://github.com/ArdentHQ/docs-poc-protocol/pull/72 |
@@ -22,6 +22,5 @@ class Fees | |||
|
|||
public const USERNAME_RESIGNATION = '2500000000'; | |||
|
|||
// @TODO: review this fee | |||
public const EVM = '0'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EVM fees will be based on network usage, similar to ethereum. In that case we will need a method to define a given fee, and the client (most likely) should get a method to retrieve network based fees (slow/avg/fast) that can then be passed to the crypto library after the user selects one of them
'asset' => [ | ||
'evmCall' => [ | ||
'gasLimit' => 1000000, // Default gas limit | ||
'payload' => '', // EVM code in hex format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's discuss this part, as the payload is what decides the underlying logic that the transaction will apply.
The way this currently works is that the user has to create the payload, then pass the payload to the builder to get it executed on chain. Although that works, it means that the user first has to figure out the required payload and construct it manually, while that should be the job of the SDK (to make it easier for the user to work with the network).
Therefore I'd suggest that we still add transaction builders, but underneath they all make use of the EVM call transaction type. The builders will however make it easier to pass the usual parameters for each of the supported transaction "types". For example:
- transfer: here you'd call
->amount()
and->recipient()
on to set these in addition to the payload (which is empty for a transfer) - vote: this would have a parameter to define the vote/unvote/swap vote. All the payload logic would be handled internally as those things are known to use (recipient contract, abi, function name, args)
- other types (later, but similar idea)
The builders would also keep their usual methods ( ->nonce()
, etc) but having these abstractions will make it easier for the user to work with the evm calls without having to construct raw payloads. Of course they can still provide raw payloads by using the EVM Call builder directly and passing it through the ->payload()
method whenever they need to make a call to a contract that's not one of ours.
I think this will make the SDK easier to work with as all the contracts that we deploy and know about can be included without putting the burden on the user to figure out the right method and contract address to use.
…osystem/php-crypto into refactor/replace-builders-with-evm
…osystem/php-crypto into refactor/replace-builders-with-evm
@ItsANameToo updated |
Summary
https://app.clickup.com/t/86duz94j3
Tester script https://github.com/ArdentHQ/sdk-tester-scripts/pull/4
Things to keep in mind when reviewing this PR:
Checklist