DAI 컨트랙트에서 transferFrom 함수는 표준과는 조금 다르게 작동한다. DAI 컨트랙트의 transferFrom 에서는 제한이 없는 approval 을 허용한다.
push, pull 및 move 함수는 각각 transferFrom(msg.sender, usr, amount), transferFrom(usr, msg.sender, amount) 및 transferFrom(src, dst, amount) 형식의 transferFrom 함수에 대한 별칭이다.
permit 은 서명 기반의 승인 함수이다. 이것은 approval 을 제출하는 과정에서 다른 당사자들에 의해 릴레이되어 최종 사용자가 메시지에 서명하는 것을 허용한다. 최종 사용자가 Eth 를 보유할 필요가 없는 애플리케이션에서 유용할 수 있다.
이 기능을 사용하기 위해 사용자의 주소는 소유자, 소비자, nonce, 만료시간 및 허용된 금액과 함께 메시지에 서명해야 한다. 이후 사용자의 승인을 업데이트 하기 위해 Permit() 에 제출한다.
// SPDX-License-Identifier: AGPL-3.0-or-later
/// dai.sol -- Dai Stablecoin ERC-20 Token
// Copyright (C) 2017, 2018, 2019 dbrock, rain, mrchico
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
pragma solidity ^0.6.12;
// FIXME: This contract was altered compared to the production version.
// It doesn't use LibNote anymore.
// New deployments of this contract will need to include custom events (TO DO).