# Deploy a contract

By [boater](https://paragraph.com/@boater) · 2023-01-31

---

1、open this website with chrome.

2、accept and then click next, done.

![](https://storage.googleapis.com/papyrus_images/a946fefa81d1f6605d0c683324194102aa032c68d8099cde72a9b284962d64ad.png)

3、click the small button（create new file),name new file with Function.sol

![](https://storage.googleapis.com/papyrus_images/3e6fdd0b6f3a435012d067ddd0ef507a4acc93cb5f2e66260607ca80c227cbfa.png)

You can get:

![](https://storage.googleapis.com/papyrus_images/8ca98469c7feda17b1a538467654921076e74062d05fd0aa093c17ebcad21f0c.png)

4、copy this code to Function.sol

    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.4;
    contract FunctionTypes{
        uint256 public number = 5;
        
        constructor() payable {}
    
        // 函数类型
        // function (<parameter types>) {internal|external} [pure|view|payable] [returns (<return types>)]
        // 默认function
        function add() external{
            number = number + 1;
        }
    
        // pure: 纯纯牛马
        function addPure(uint256 _number) external pure returns(uint256 new_number){
            new_number = _number+1;
        }
        
        // view: 看客
        function addView() external view returns(uint256 new_number) {
            new_number = number + 1;
        }
    
        // internal: 内部
        function minus() internal {
            number = number - 1;
        }
    
        // 合约内的函数可以调用内部函数
        function minusCall() external {
            minus();
        }
    
        // payable: 递钱，能给合约支付eth的函数
        function minusPayable() external payable returns(uint256 balance) {
            minus();    
            balance = address(this).balance;
        }
    }
    

5、click the red “1” and then click “2” to compile the file

     use a high level compiler , such as 0.8.8
    

![](https://storage.googleapis.com/papyrus_images/0e62f12c3601965c7a0dc275317d3f427b4e44ad89091ca226346cba057355db.png)

6、Turn the metamsk network to scroll alpha testnet, click “red 1”，

then choose injected provider-metamsk,

and then click deploy

![](https://storage.googleapis.com/papyrus_images/261f7d0f6a239d9c536dcf9ba64a9bb25d28452d8fb00fda4b8fef748fea25d0.png)

---

*Originally published on [boater](https://paragraph.com/@boater/deploy-a-contract)*
