concordium-rust-smart-contracts
concordium-rust-smart-contracts copied to clipboard
Feedback/Improvements on the smart-contract-wallet implementation
Task description
kudos to @soerenbf for his great input.
Sub-tasks "Naming improvements to shorten/simplify the terminology"
- [x]
nativeCurrency
rename toCCD
. - [x]
internalTransfer
rename totransfer
. - [x] view functions for hashes rename to
getCis2TransferMessageHash/getCCDTransferMessageHash/getCis2WithdrawMessageHash/getCCDWithdrawMessageHash
. - [x]
balanceOfCis2Tokens
rename toCis2BalanceOf/CCDBalanceOf
.
Sub-tasks "Adding serde feature to simplify parsing the type as JSON value between front end and back end"
- [x] Smart contract wallet: add serde to all parameter types of the
internalTransfer/withdraw/deposit
functions. - [x] CIS2-library: add serde to the
TokenAmount
andTokenID
types, and all parameter types oftransfer/updateOperator
functions. - [x] wherever this type lives: add serde to type
PublicKeyEd25519
.
Using transfer
instead of internalTransfer
makes the CIS-5 standard incompatible with CIS-2, so I would suggest using some other name.
Using
transfer
instead ofinternalTransfer
makes the CIS-5 standard incompatible with CIS-2, so I would suggest using some other name.
Ah, right.. didn't think of that! Good point 👍
If the purpose is that these can be mixed, then maybe the transfer function should be prefixed with something that identifies this as a sc-wallet transfer? Can't figure out the best name just off the top of my head
Suggestion: cis5Transfer
for the name.
update: After a discussion, we realized that there is no function name overlap between CIS-2
and CIS-5
. CIS-5 will use as function names transferCCD /transferCIS2Token
.
It seems that the tests rely on cis2-multi
being compiled into ../cis2-multi/concordium-out/module.wasm.v1
. Maybe this should be added as a step in a build.rs
file when building tests? I don't know how well this plays with cargo-concordium
though.
It seems that the tests rely on
cis2-multi
being compiled into../cis2-multi/concordium-out/module.wasm.v1
. Maybe this should be added as a step in abuild.rs
file when building tests? I don't know how well this plays withcargo-concordium
though.
Let's discuss and create a separate issue for it. There are 3 contracts that have tests that depend on other contracts currently:
- sponsored-tx-enabled-auction
- cis5-smart-contract-wallet
- smart-contract-upgrade V1
The 'sponsored-tx-enabled-auction' and 'cis5-smart-contract-wallet' examples need the wasm module cis2-multi
for its tests.
https://github.com/Concordium/concordium-rust-smart-contracts/blob/main/.github/workflows/linter.yml#L901
The 'smart-contract-upgrade' example has a v1 and v2 contract and the tests in v1 needs the wasm module from v2 for upgrading. https://github.com/Concordium/concordium-rust-smart-contracts/blob/main/.github/workflows/linter.yml#L896