Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
contracts/contracts/defi/utils/FeeAdmin.sol
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35 lines (28 sloc)
864 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pragma solidity >=0.8.0 <0.9.0; | |
| //Copyright of DataX Protocol contributors | |
| //SPDX-License-Identifier: BSU-1.1 | |
| import "./Admin.sol"; | |
| contract FeeAdmin is Admin { | |
| mapping(bytes32 => uint256) public fees; | |
| function getFees(string memory key) public view returns (uint256) { | |
| bytes32 _key = _stringToBytes32(key); | |
| return fees[_key]; | |
| } | |
| function updateFees(string memory key, uint256 value) external adminOnly { | |
| bytes32 _key = _stringToBytes32(key); | |
| fees[_key] = value; | |
| } | |
| function _stringToBytes32(string memory source) | |
| private | |
| pure | |
| returns (bytes32 result) | |
| { | |
| bytes memory tempEmptyStringTest = bytes(source); | |
| if (tempEmptyStringTest.length == 0) { | |
| return 0x0; | |
| } | |
| assembly { | |
| result := mload(add(source, 32)) | |
| } | |
| } | |
| } |