Skip to content

Instantly share code, notes, and snippets.

@ben-chain
Created January 30, 2019 01:04
Show Gist options
  • Save ben-chain/c340081a0efb1cd548250231206cd01b to your computer and use it in GitHub Desktop.
Save ben-chain/c340081a0efb1cd548250231206cd01b to your computer and use it in GitHub Desktop.
Denomination Logic in PG Plasma
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