Skip to main content

Editing the Project

Steps

  • Now let’s edit some functionality of the contract

  • In this case, we’re going to rename the PancakeSwap Token to MyCakeToken

  • Now save the project again

  • Once it’s saved let’s navigate over to the MasterChef and add a custom function

  • In this example, we’re going to add a hello world function to our CakeToken

  • Let’s add a custom function from this list

  • In the name attribute, we’ll insert a string and make this function publically accessible

  • Lastly, we’ll set State Mutability to pure

  • The function has now been added to our contract and can be edited by selecting it in the visual diagram

  • We’ll edit this function to return hello world when called

  • Select a ReturnStatement type from the list and then set the expression type to StringLiteral

  • The value we want to return is Hello world and so we’ll add that in the value field and replace any existing value

  • Once the function is added you can see an additional diagram displaying the flow of the function

  • Once we’re done adding the function, let's save our project again

  • As simple as that, we’ve added a new function to the PancakeSwap contract

Watch the video