Last active
September 2, 2023 08:39
-
-
Save BedrosovaYulia/4c0c7eaa56ac51c0a79c5f2032123c36 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.9; | |
contract StorageToStorage { | |
struct Transcoder { | |
uint256 cumulativeRewards; | |
uint256 cumulativeFees; | |
} | |
mapping(address => Transcoder) public transcoders; | |
Transcoder public s; | |
function setTranscoder(address a, uint256 r, uint256 f) public{ | |
Transcoder memory t; | |
t.cumulativeFees = f; | |
t.cumulativeRewards = r; | |
transcoders[a] = t; | |
} | |
function clearTranscoder(address a) public{ | |
Transcoder storage t = transcoders[a]; | |
t.cumulativeFees = 0; | |
t.cumulativeRewards = 0; | |
} | |
function setS(uint256 r, uint256 f) public{ | |
Transcoder memory t; | |
t.cumulativeFees = f; | |
t.cumulativeRewards = r; | |
s = t; | |
} | |
function clearS() public { | |
Transcoder storage t = s; | |
t.cumulativeFees = 0; | |
t.cumulativeRewards = 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment