From 8640781050e2288967555986b64a4d401b5d4bff Mon Sep 17 00:00:00 2001 From: iamoracle <38940247+iamoracle@users.noreply.github.com> Date: Wed, 23 Mar 2022 18:40:06 +0800 Subject: [PATCH] Added Modifier Added the external and private modifier to prevent modification of contract by external contract. --- .../2-7-transactions-and-erc20-interface/marketplace.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/celo101-code-chapter_2/2-7-transactions-and-erc20-interface/marketplace.sol b/code/celo101-code-chapter_2/2-7-transactions-and-erc20-interface/marketplace.sol index 9f95960..109837b 100644 --- a/code/celo101-code-chapter_2/2-7-transactions-and-erc20-interface/marketplace.sol +++ b/code/celo101-code-chapter_2/2-7-transactions-and-erc20-interface/marketplace.sol @@ -29,7 +29,7 @@ contract Marketplace { uint sold; } - mapping (uint => Product) internal products; + mapping (uint => Product) private products; function writeProduct( string memory _name, @@ -37,7 +37,7 @@ contract Marketplace { string memory _description, string memory _location, uint _price - ) public { + ) public external { uint _sold = 0; products[productsLength] = Product( payable(msg.sender), @@ -71,7 +71,7 @@ contract Marketplace { ); } - function buyProduct(uint _index) public payable { + function buyProduct(uint _index) public external payable { require( IERC20Token(cUsdTokenAddress).transferFrom( msg.sender, @@ -86,4 +86,4 @@ contract Marketplace { function getProductsLength() public view returns (uint) { return (productsLength); } -} \ No newline at end of file +}