Tico4Chain-Coders / Trustless-Work

Trustless Work provides permissionles escrow infrastructure. By using Trustless Work, any platform can integrate escrows in their user flow, it leverages Stellar Soroban Smart Contracts and USDC, a digital version of the dollar.
https://www.trustlesswork.com
5 stars 6 forks source link

smart contracts: Create function to modify escrow properties. #23

Open JoelVR17 opened 1 day ago

JoelVR17 commented 1 day ago

You must apply through OnlyDust. If not, you'll be ignored

Description:

Create a function within the contract to modify the values of an already initialized escrow in the file named contract.rs.

Requirements:

  1. The function must receive by parameters all the necessary properties of an escrow. These properties will contain the new values for that escrow.
  2. The escrow whose properties are going to be modified must be identified by its engagement id.
  3. The new properties must be stored correctly within the contract.
  4. The function must be called “change_escrow_properties”.
  5. The milestones that this function will receive must overwrite the milestones initially defined in the escrow.

Validations:

  1. Verify that the escrow has been defined by means of its engagement_id. Otherwise, this means that the escrow has not been initialized.
  2. Only the “plataform_address” should be able to execute this function.

Errors:

We currently have a number of custom errors which we throw when executing some of the contract functions. An example of the above would be the following:

if escrow.balance != escrow.amount {
      return Err(ContractError::EscrowBalanceNotSufficienteToSendEarnings);
}

You only need to worry about throwing the error message, you don't need to handle custom errors. So if you need to return an error within the flow due to one of the validations, you can do it as follows:

if escrow.balance != escrow.amount {
      return Err("Your error message");
}

You must make sure that the message you are sending as an error is very clear and makes sense as to why the error is being sent.

Test:

In the test.rs file you must develop the following test to check that the contract flow works correctly together with the function you have just built:

  1. The escrow must be initialized (intialize_escrow).
  2. Verify by means of the “engagement_id” property that the escrow has already been initialized.
  3. Verify that the function can only be executed by the “platform_address”.
  4. Verify that each of the new properties in the escrow have been correctly saved in the contract.
  5. Verify by means of this test that the validations mentioned above are working correctly.

You can rely on the previously created tests to complete your test. The important thing is that you succeed in testing your code and that it works well in conjunction with the entire contract flow which is explained in the list above. Also, please note that you should not create a test for each of the items in the above list. This list indicates with each of its items the flow that must contain the only test that you must create to verify that the code you made works. You can also create more than 1 test if necessary, but if you do, you must justify why.

⚠️ Important: Please define a clear name for the test so that the purpose of the test is clearly understood.

To run the test you have just created you can use the command cargo test.

Recommendation:

Stellar people have in their discord a channel called “stella-help”, in that channel you can ask your technical questions about Stellar and its libraries (including the “soroban_sdk” library we use in the contract). This bot can help you a lot to solve your issues. Just remember that before submitting your query you must add the word “stella” at the beginning of the query. Otherwise the bot will not answer you. The Stellar discord where you can find this channel is the following: Stellar Discord

⚠️ Please follow the guidelines for requesting an issue, launching commits and describing PR's. Otherwise they will be ignored. ⚠️

mexes20 commented 22 hours ago

Could I take over this issue? I'm a Software developer with three years of experience.

CollinsC1O commented 21 hours ago

Hello I'm a front-end and a blockchain developer and I will love to take on this and it done.

Kom02 commented 21 hours ago

Hi, My name is Kevin Obando, a full stack junior developer with 2 years of experience from Costa Rica. I am starting in this community and I want to help in this project.

Gerson2102 commented 21 hours ago

Hey! I'm Gerson. 👋

Member of Dojo Coding. I have contributed before to other projects like:

Can I work on this issue?

Check my OnlyDust profile, I've contributed to many projects: Profile


Plan to Solve the Issue:

  1. Study the codebase to understand the current structure and functionality.
  2. Understand the problem that needs to be solved by thoroughly reading the issue details.
  3. Leverage all provided resources within the issue to get a better grasp of the task at hand.
  4. If I encounter roadblocks, I will ask questions ASAP in the Telegram group to move forward effectively.
  5. I will open a PR and wait for ur feedback

MrRoudyk commented 20 hours ago

Mind if I take this issue?

ooochoche commented 20 hours ago

I have gone through the description and the requirements to take on this issue and would like to resolve the pending issue by:

first - adding a new function to the smart contract that allows changes to escrow properties.

secondly - include the function will take inputs for the specific properties that need to be updated.

following - making sure the function only lets authorized users make changes.

lastly - update the escrow properties with the new values.

KoxyG commented 18 hours ago

Hi, my name is Koxy. I am a stellar ecosystem contributor.

I am applying through OnlyDust to contribute to this project. I am a dedicated contributor to the Stellar ecosystem, where I run a video series called Let's Get Soroban, educating developers on Soroban smart contracts. You can find my work here: Let's Get Soroban - YouTube.

I have extensive experience working on smart contracts and am confident in my ability to implement the required change_escrow_properties function. I will ensure that:

Additionally, I will write comprehensive tests to verify that:

I look forward to contributing to this project and ensuring high-quality implementation and testing.


Let me know if you’d like further edits!

ryzen-xp commented 17 hours ago

Hi, I am proficient Blockchain developer expert in Cairo , Rust and Solidity and also in web development. please /assign this issue . Thank You

zkCaleb-dev commented 14 hours ago

This issue is for you @Gerson2102 ! 🚀 Remember to follow all the guidelines, both the ones inside the repository and the guideline to perform the PR.

Many thanks to all the other dev's who sent in their application. 🔥