Created
January 30, 2019 01:04
-
-
Save ben-chain/c340081a0efb1cd548250231206cd01b to your computer and use it in GitHub Desktop.
Denomination Logic in PG Plasma
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
def depositETH(): | |
weiMuiltiplier: uint256 = 10**self.weiDecimalOffset | |
depositAmount: uint256 = as_unitless_number(msg.value) * weiMuiltiplier | |
... | |
def depositERC20(tokenAddress: address, depositSize: uint256): | |
... | |
tokenMultiplier: uint256 = 10**self.listings[tokenType].decimalOffset | |
depositInPlasmaCoins: uint256 = depositSize * tokenMultiplier | |
... | |
def finalizeExit(exitID: uint256, exitableEnd: uint256): | |
... | |
if tokenType == 0: # then we're exiting ETH | |
weiMiltiplier: uint256 = 10**self.weiDecimalOffset | |
exitValue: uint256 = (exitUntypedEnd - exitUntypedStart) / weiMiltiplier | |
send(exiter, as_wei_value(exitValue, "wei")) | |
else: #then we're exiting ERC | |
tokenMultiplier: uint256 = 10**self.listings[tokenType].decimalOffset | |
exitValue: uint256 = (exitUntypedEnd - exitUntypedStart) / tokenMultiplie |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment