Skip to content

Instantly share code, notes, and snippets.

@ukstv
Created March 30, 2018 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ukstv/97b70749546e832093c9370e3aa6794a to your computer and use it in GitHub Desktop.
Save ukstv/97b70749546e832093c9370e3aa6794a to your computer and use it in GitHub Desktop.
// 3: Prepare counterfactual deployment of Bidirectional, and update Lineup
let bidirectionalB = bytecodeManager.constructBytecode(Bidirectional, multisig.address, bidirectionalSettlementPeriod)
let bidirectionalA = await registry.counterfactualAddress(bidirectionalB, REGISTRY_NONCE)
let bidirectionalDeployment = registry.deploy.request(bidirectionalB, REGISTRY_NONCE).params[0].data
let bidirectionalCodehash = await conditional.callHash(registry.address, new BigNumber.BigNumber(0), bidirectionalDeployment)
// 4. Prepare counterfactual transfer, and update Lineup
let transferB = proxy.doCall.request(registry.address, bidirectionalA, depositA, '0x').params[0].data
let transferCodehash = await conditional.callHash(proxy.address, depositA, transferB)
// 5: Conditionally counterfactually deploy Bidirectional
let conditionalBidirectionalB = conditional.doCall.request(registry.address, lineupA, proof(lineupU, bidirectionalCodehash), registry.address, new BigNumber.BigNumber(0), bidirectionalDeployment)
let conditionalBidirectionalI = await counterFactory.call(conditionalBidirectionalB, 1)
// 5. Conditionally counterfactually move money to deployed Bidirectional
let conditionalTransferB = conditional.doDelegate.request(registry.address, lineupA, proof(lineupU, transferCodehash), proxy.address, depositA, transferB)
let conditionalTransferI = await counterFactory.delegatecall(conditionalTransferB, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment