Skip to main content

Solidity self-notes

· One min read
Doko

Trong solidity, các hàm trong interface luôn phải có từ khoá external:

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

import "./Library.sol";

interface IAccountVault {
function deposit(address account, uint256 amount) external;

function withdraw(address account, uint256 amount) external;
}

cũng có thể có thêm view:

function deposit(address account, uint256 amount) external;

nhưng không có internal:

// Sẽ bị compiler báo lỗi
function deposit(address account, uint256 amount) internal;