Welcome to the tBTC API Documentation. The primary contracts involved in tBTC are listed below, along with their public methods.

TBTCSystem

approvedToLog(address)

Checks if an address is an allowed logger

Developers

Calls the system to check if the caller is a Deposit We don’t require this, so deposits are not bricked if the system borks

_caller

The address of the calling contract

Returns

True if approved, otherwise false

createNewDepositFeeEstimate()

Gets a fee estimate for creating a new Deposit.

Developers

Returns

Uint256 estimate.

emergencyPauseNewDeposits()

One-time-use emergency function to disallow future deposit creation for 10 days.

fetchBitcoinPrice()

Get the price of one satoshi in wei.

Developers

Reverts if the price of one satoshi is 0 wei, or if the price of one satoshi is 1 ether.

Returns

The price of one satoshi in wei.

getAllowNewDeposits()

gets whether new deposits are allowed.

getAllowedLotSizes()

Gets the allowed lot sizes

Developers

Returns

Uint256 array of allowed lot sizes

getInitialCollateralizedPercent()

Get the system initial collateralized level for new deposits.

getSeverelyUndercollateralizedThresholdPercent()

Get the system severe undercollateralization level for new deposits

getSignerFeeDivisor()

Gets the system signer fee divisor.

Developers

Returns

The signer fee divisor.

getUndercollateralizedThresholdPercent()

Get the system undercollateralization level for new deposits

initialize(address,address,address,address,address,address,address,uint256,uint256)

Initialize contracts

Developers

Only the Deposit factory should call this, and only once.

_depositFactory

Deposit Factory address. More info in DepositFactory.

_feeRebateToken

FeeRebateToken (FRT) address. More info in FeeRebateToken.

_keepSize

Signing group size.

_keepThreshold

Signing group honesty threshold.

_keepVendor

ECDSA keep vendor address.

_masterDepositAddress

Master Deposit address. More info in Deposit.

_tbtcDepositToken

TBTCDepositToken (TDT) address. More info in TBTCDepositToken.

_tbtcToken

TBTCToken address. More info in TBTCToken.

_vendingMachine

Vending Machine address. More info in VendingMachine.

isAllowedLotSize(uint256)

Check if a lot size is allowed.

Developers

_lotSizeSatoshis

Lot size to check.

Returns

True if lot size is allowed, false otherwise.

logCourtesyCalled()

Fires a CourtesyCalled event

Developers

We append the sender, which is the deposit contract that called returns false if not approved, to prevent accidentally halting Deposit

Returns

True if successful, else false

logCreated(address)

Fires a Created event

Developers

We append the sender, which is the deposit contract that called

_keepAddress

The address of the associated keep

Returns

True if successful, else revert

logExitedCourtesyCall()

Fires a ExitedCourtesyCall event

Developers

We append the sender, which is the deposit contract that called returns false if not approved, to prevent accidentally halting Deposit

Returns

True if successful, else false

logFraudDuringSetup()

Fires a FraudDuringSetup event

Developers

We append the sender, which is the deposit contract that called returns false if not approved, to prevent accidentally halting Deposit

Returns

True if successful, else false

logFunded()

Fires a Funded event

Developers

We append the sender, which is the deposit contract that called returns false if not approved, to prevent accidentally halting Deposit

Returns

True if successful, else false

logGotRedemptionSignature(bytes32,bytes32,bytes32)

Fires a GotRedemptionSignature event

Developers

We append the sender, which is the deposit contract that called

_digest

signed digest

_r

signature r value

_s

signature s value

Returns

True if successful, else revert

logLiquidated()

Fires a Liquidated event

Developers

We append the sender, which is the deposit contract that called returns false if not approved, to prevent accidentally halting Deposit

Returns

True if successful, else false

logRedeemed(bytes32)

Fires a Redeemed event

Developers

We append the sender, which is the deposit contract that called returns false if not approved, to prevent accidentally halting Deposit

Returns

True if successful, else false

logRedemptionRequested(address,bytes32,uint256,bytes,uint256,bytes)

Fires a RedemptionRequested event

Developers

This is the only event without an explicit timestamp

_digest

The calculated sighash digest

_outpoint

The 36 byte outpoint

_redeemerOutputScript

The redeemer’s length-prefixed output script.

_requestedFee

The requester or bump-system specified fee

_requester

The ethereum address of the requester

_utxoSize

The size of the utxo in sat

Returns

True if successful, else revert

logRegisteredPubkey(bytes32,bytes32)

Fires a RegisteredPubkey event

Developers

We append the sender, which is the deposit contract that called returns false if not approved, to prevent accidentally halting Deposit

Returns

True if successful, else false

logSetupFailed()

Fires a SetupFailed event

Developers

We append the sender, which is the deposit contract that called returns false if not approved, to prevent accidentally halting Deposit

Returns

True if successful, else false

logStartedLiquidation(bool)

Fires a StartedLiquidation event

Developers

We append the sender, which is the deposit contract that called

_wasFraud

True if liquidating for fraud

Returns

True if successful, else revert

requestNewKeep(uint256,uint256,uint256)

Request a new keep opening.

Developers

_m

Minimum number of honest keep members required to sign.

_n

Number of members in the keep.

Returns

Address of a new keep.

resumeNewDeposits()

Anyone can reactivate deposit creations after the pause duration is over.

setCollateralizationThresholds(uint128,uint128,uint128)

Set the system collateralization levels

Developers

_initialCollateralizedPercent

default signing bond percent for new deposits

_severelyUndercollateralizedThresholdPercent

second undercollateralization trigger

_undercollateralizedThresholdPercent

first undercollateralization trigger

setLotSizes(uint256[])

Set the allowed deposit lot sizes.

Developers

Lot size array should always contain 10**8 satoshis (1BTC value)

_lotSizes

Array of allowed lot sizes.

setSignerFeeDivisor(uint256)

Set the system signer fee divisor.

Developers

_signerFeeDivisor

The signer fee divisor.

Deposit

createNewDeposit(address,address,address,address,address,uint256,uint256,uint256)

The Deposit Factory can spin up a new deposit.

Developers

Only the Deposit factory can call this.

_FeeRebateToken

FeeRebateToken (FRT) address. More info in FeeRebateToken.

_TBTCDepositToken

TBTCDepositToken (TDT) address. More info in TBTCDepositToken.

_TBTCSystem

TBTCSystem address. More info in VendingMachine.

_TBTCToken

TBTCToken address. More info in TBTCToken`.

_VendingMachine

VendingMachine address. More info in VendingMachine.

_lotSizeSatoshis

The minimum amount of satoshi the funder is required to send. This is also the amount of TBTC the TDT holder will receive: (10**7 satoshi == 0.1 BTC == 0.1 TBTC).

_m

Signing group honesty threshold.

_n

Signing group size.

Returns

True if successful, otherwise revert.

exitCourtesyCall()

Goes from courtesy call to active.

Developers

Only callable if collateral is sufficient and the deposit is not expiring.

Returns

True if successful, otherwise revert.

getCurrentState()

Get the integer representing the current state.

Developers

We implement this because contracts don’t handle foreign enums well. see DepositStates for more info on states.

Returns

The 0-indexed state from the DepositStates enum.

getOwnerRedemptionTbtcRequirement(address)

Get TBTC amount required for redemption assuming _redeemer is this deposit’s owner (TDT holder).

Developers

_redeemer

The assumed owner of the deposit’s TDT .

Returns

The amount in TBTC needed to redeem the deposit.

getRedemptionTbtcRequirement(address)

Get TBTC amount required for redemption by a specified _redeemer.

Developers

Will revert if redemption is not possible by _redeemer.

_redeemer

The deposit redeemer.

Returns

The amount in TBTC needed to redeem the deposit.

inActive()

Check if the Deposit is in ACTIVE state.

Developers

Returns

True if state is ACTIVE, fale otherwise.

increaseRedemptionFee(bytes8,bytes8)

Anyone may notify the contract that a fee bump is needed.

Developers

This sends us back to AWAITING_WITHDRAWAL_SIGNATURE.

_newOutputValueBytes

The new output’s value.

_previousOutputValueBytes

The previous output’s value.

Returns

True if successful, False if prevented by timeout, otherwise revert.

initialize(address)

Set the address of the System contract on contract initialization.

lotSizeSatoshis()

Get the deposit’s BTC lot size in satoshi.

Developers

Returns

uint256 lot size in satoshi.

lotSizeTbtc()

Get the Deposit ERC20 lot size.

Developers

This is the same as lotSizeSatoshis(), but is multiplied to scale to ERC20 decimal.

Returns

uint256 lot size in erc20 decimal (max 18 decimal places).

notifyCourtesyCall()

Notify the contract that the signers are undercollateralized.

Developers

Calls out to the system for oracle info.

Returns

True if successful, otherwise revert.

notifyCourtesyTimeout()

Notifies the contract that the courtesy period has elapsed.

Developers

This is treated as an abort, rather than fraud.

Returns

True if successful, otherwise revert.

notifyFraudFundingTimeout()

Anyone may notify the contract no funding proof was submitted during funding fraud.

Developers

This is not a funder fault. The signers have faulted, so the funder shouldn’t fund.

Returns

True if successful, otherwise revert.

notifyFundingTimeout()

Anyone may notify the contract that the funder has failed to send BTC.

Developers

This is considered a funder fault, and we revoke their bond.

Returns

True if successful, otherwise revert.

notifyRedemptionProofTimeout()

Anyone may notify the contract that the signers have failed to produce a redemption proof.

Developers

This is considered fraud, and is punished.

Returns

True if successful, otherwise revert.

notifySignatureTimeout()

Anyone may notify the contract that the signers have failed to produce a signature.

Developers

This is considered fraud, and is punished.

Returns

True if successful, otherwise revert.

notifySignerSetupFailure()

Anyone may notify the contract that signing group setup has timed out.

Developers

We rely on the keep system punishes the signers in this case.

Returns

True if successful, otherwise revert.

notifyUndercollateralizedLiquidation()

Notify the contract that the signers are undercollateralized.

Developers

Calls out to the system for oracle info.

Returns

True if successful, otherwise revert.

provideBTCFundingProof(bytes4,bytes,bytes,bytes4,uint8,bytes,uint256,bytes)

Anyone may notify the deposit of a funding proof to activate the deposit. This is the happy-path of the funding flow. It means that we have succeeded.

Developers

Takes a pre-parsed transaction and calculates values needed to verify funding.

_bitcoinHeaders

Single bytestring of 80-byte bitcoin headers, lowest height first.

_fundingOutputIndex

Index of funding output in _txOutputVector (0-indexed).

_merkleProof

The merkle proof of transaction inclusion in a block.

_txIndexInBlock

Transaction index in the block (0-indexed).

_txInputVector

All transaction inputs prepended by the number of inputs encoded as a VarInt, max 0xFC(252) inputs.

_txLocktime

Final 4 bytes of the transaction.

_txOutputVector

All transaction outputs prepended by the number of outputs encoded as a VarInt, max 0xFC(252) outputs.

_txVersion

Transaction version number (4-byte LE).

Returns

True if no errors are thrown.

provideECDSAFraudProof(uint8,bytes32,bytes32,bytes32,bytes)

Anyone can provide a signature that was not requested to prove fraud.

Developers

Calls out to the keep to verify if there was fraud.

_preimage

The sha256 preimage of the digest.

_r

Signature R value.

_s

Signature S value.

_signedDigest

The digest signed by the signature vrs tuple.

_v

Signature recovery value.

Returns

True if successful, otherwise revert.

provideFundingECDSAFraudProof(uint8,bytes32,bytes32,bytes32,bytes)

Anyone can provide a signature that was not requested to prove fraud during funding.

Developers

Calls out to the keep to verify if there was fraud.

_preimage

The sha256 preimage of the digest.

_r

Signature R value.

_s

Signature S value.

_signedDigest

The digest signed by the signature vrs tuple.

_v

Signature recovery value.

Returns

True if successful, otherwise revert.

provideRedemptionProof(bytes4,bytes,bytes,bytes4,bytes,uint256,bytes)

Anyone may provide a withdrawal proof to prove redemption.

Developers

The signers will be penalized if this is not called.

_bitcoinHeaders

An array of tightly-packed bitcoin headers.

_merkleProof

The merkle proof of inclusion of the tx in the bitcoin block.

_txIndexInBlock

The index of the tx in the Bitcoin block (0-indexed).

_txInputVector

All transaction inputs prepended by the number of inputs encoded as a VarInt, max 0xFC(252) inputs.

_txLocktime

Final 4 bytes of the transaction.

_txOutputVector

All transaction outputs prepended by the number of outputs encoded as a VarInt, max 0xFC(252) outputs.

_txVersion

Transaction version number (4-byte Little Endian).

provideRedemptionSignature(uint8,bytes32,bytes32)

Anyone may provide a withdrawal signature if it was requested.

Developers

The signers will be penalized if this (or provideRedemptionProof) is not called.

_r

Signature R value.

_s

Signature S value. Should be in the low half of secp256k1 curve’s order.

_v

Signature recovery value.

Returns

True if successful, False if prevented by timeout, otherwise revert.

provideSPVFraudProof(bytes4,bytes,bytes,bytes4,bytes,uint256,uint8,bytes)

Anyone may notify the deposit of fraud via an SPV proof.

Developers

We strong prefer ECDSA fraud proofs.

_bitcoinHeaders

An array of tightly-packed bitcoin headers.

_merkleProof

The merkle proof of inclusion of the tx in the bitcoin block.

_targetInputIndex

Index of the input that spends the custodied UTXO.

_txIndexInBlock

The index of the tx in the Bitcoin block (0-indexed).

_txInputVector

All transaction inputs prepended by the number of inputs encoded as a VarInt, max 0xFC(252) inputs.

_txLocktime

Final 4 bytes of the transaction.

_txOutputVector

All transaction outputs prepended by the number of outputs encoded as a VarInt, max 0xFC(252) outputs.

_txVersion

Transaction version number (4-byte LE).

Returns

True if successful, otherwise revert.

purchaseSignerBondsAtAuction()

Closes an auction and purchases the signer bonds. Payout to buyer, funder, then signers if not fraud.

Developers

For interface, reading auctionValue will give a past value. the current is better.

Returns

True if successful, revert otherwise.

remainingTerm()

Retrieve the remaining term of the deposit in seconds.

Developers

The value accuracy is not guaranteed since block.timestmap can be lightly manipulated by miners.

Returns

The remaining term of the deposit in seconds. 0 if already at term.

requestRedemption(bytes8,bytes)

Deposit owner (TDT holder) can request redemption. Once redemption is requested a proof with sufficient accumulated difficulty is required to complete redemption.

Developers

The redeemer specifies details about the Bitcoin redemption tx.

_outputValueBytes

The 8-byte Little Endian output size.

_redeemerOutputScript

The redeemer’s length-prefixed output script.

Returns

True if successful, otherwise revert.

retrieveSignerPubkey()

Poll the Keep contract to retrieve our pubkey.

Developers

Store the pubkey as 2 bytestrings, X and Y.

Returns

True if successful, otherwise revert.

signerFee()

Get the signer fee for the Deposit.

Developers

This is the one-time fee required by the signers to perform . the tasks needed to maintain a decentralized and trustless model for tBTC. It is a percentage of the lotSize (deposit size).

Returns

Fee amount in tBTC.

transferAndRequestRedemption(bytes8,bytes,address)

Deposit owner (TDT holder) can request redemption. Once redemption is requested a proof with sufficient accumulated difficulty is required to complete redemption.

Developers

The caller specifies details about the Bitcoin redemption tx and pays for the redemption. The TDT (deposit ownership) is transfered to _finalRecipient, and _finalRecipient is marked as the deposit redeemer.

_finalRecipient

The address to receive the TDT and later be recorded as deposit redeemer.

_outputValueBytes

The 8-byte LE output size.

_redeemerOutputScript

The redeemer’s length-prefixed output script.

utxoSize()

Get the size of the funding UTXO.

Developers

This will only return 0 unless the funding transaction has been confirmed on-chain. See provideBTCFundingProof for more info on the funding proof.

Returns

Uint256 UTXO size in satoshi. 0 if no funding proof has been provided.

DepositStates

inEndState(DepositUtils.Deposit storage)

Check if the contract has halted.

Developers

This checks on any halt state, regardless of triggering circumstances.

_d

Deposit storage pointer.

Returns

True if contract has halted permanently.

inFunding(DepositUtils.Deposit storage)

Check if the contract is currently in the funding flow.

Developers

This checks on the funding flow happy path, not the fraud path.

_d

Deposit storage pointer.

Returns

True if contract is currently in the funding flow else False.

inFundingFailure(DepositUtils.Deposit storage)

Check if the contract is currently in the funding faud flow.

Developers

This checks for the flow, not the SETUP_FAILED termination state.

_d

Deposit storage pointer.

Returns

True if contract is currently in the funding fraud flow else False.

inRedeemableState(DepositUtils.Deposit storage)

Check if the contract is available for a redemption request.

Developers

Redemption is available from active and courtesy call.

_d

Deposit storage pointer.

Returns

True if available, False otherwise.

inRedemption(DepositUtils.Deposit storage)

Check if the contract is currently in the redepmtion flow.

Developers

This checks on the redemption flow, not the REDEEMED termination state.

_d

Deposit storage pointer.

Returns

True if contract is currently in the redemption flow else False.

inSignerLiquidation(DepositUtils.Deposit storage)

Check if the contract is currently in the signer liquidation flow.

Developers

This could be caused by fraud, or by an unfilled margin call.

_d

Deposit storage pointer.

Returns

True if contract is currently in the liquidaton flow else False.

inStart(DepositUtils.Deposit storage)

Check if the contract is currently in the start state (awaiting setup).

Developers

This checks on the funding flow happy path, not the fraud path.

_d

Deposit storage pointer.

Returns

True if contract is currently in the start state else False.

DepositFunding

createNewDeposit(DepositUtils.Deposit storage,uint256,uint256,uint256)

Internally called function to set up a newly created Deposit instance. This should not be called by developers, use DepositFactory.createNewDeposit to create a new deposit.

Developers

If called directly, the transaction will revert since the call will be executed on an already set-up instance.

_d

Deposit storage pointer.

_m

Signing group honesty threshold.

_n

Signing group size.

Returns

True if successful, otherwise revert.

notifyFraudFundingTimeout(DepositUtils.Deposit storage)

Anyone may notify the contract no funding proof was submitted during funding fraud.

Developers

This is not a funder fault. The signers have faulted, so the funder shouldn’t fund.

_d

Deposit storage pointer.

notifyFundingTimeout(DepositUtils.Deposit storage)

Anyone may notify the contract that the funder has failed to send BTC.

Developers

This is considered a funder fault, and we revoke their bond.

_d

Deposit storage pointer.

notifySignerSetupFailure(DepositUtils.Deposit storage)

Anyone may notify the contract that signing group setup has timed out.

Developers

We rely on the keep system to punish the signers in this case.

_d

Deposit storage pointer.

provideBTCFundingProof(DepositUtils.Deposit storage,bytes4,bytes,bytes,bytes4,uint8,bytes,uint256,bytes)

Anyone may notify the deposit of a funding proof to activate the deposit. This is the happy-path of the funding flow. It means that we have succeeded.

Developers

Takes a pre-parsed transaction and calculates values needed to verify funding.

_bitcoinHeaders

Single bytestring of 80-byte bitcoin headers, lowest height first.

_d

Deposit storage pointer.

_fundingOutputIndex

Index of funding output in _txOutputVector (0-indexed).

_merkleProof

The merkle proof of transaction inclusion in a block.

_txIndexInBlock

Transaction index in the block (0-indexed).

_txInputVector

All transaction inputs prepended by the number of inputs encoded as a VarInt, max 0xFC(252) inputs.

_txLocktime

Final 4 bytes of the transaction.

_txOutputVector

All transaction outputs prepended by the number of outputs encoded as a VarInt, max 0xFC(252) outputs.

_txVersion

Transaction version number (4-byte LE).

Returns

True if no errors are thrown.

provideFundingECDSAFraudProof(DepositUtils.Deposit storage,uint8,bytes32,bytes32,bytes32,bytes)

Anyone can provide a signature that was not requested to prove fraud during funding.

Developers

Calls out to the keep to verify if there was fraud.

_d

Deposit storage pointer.

_preimage

The sha256 preimage of the digest.

_r

Signature R value.

_s

Signature S value.

_signedDigest

The digest signed by the signature vrs tuple.

_v

Signature recovery value.

Returns

True if successful, otherwise revert.

retrieveSignerPubkey(DepositUtils.Deposit storage)

we poll the Keep contract to retrieve our pubkey.

Developers

We store the pubkey as 2 bytestrings, X and Y.

_d

Deposit storage pointer.

Returns

True if successful, otherwise revert.

DepositRedemption

increaseRedemptionFee(DepositUtils.Deposit storage,bytes8,bytes8)

Anyone may notify the contract that a fee bump is needed.

Developers

This sends us back to AWAITING_WITHDRAWAL_SIGNATURE.

_d

Deposit storage pointer.

_newOutputValueBytes

The new output’s value.

_previousOutputValueBytes

The previous output’s value.

Returns

True if successful, False if prevented by timeout, otherwise revert.

notifyRedemptionProofTimeout(DepositUtils.Deposit storage)

Anyone may notify the contract that the signers have failed to produce a redemption proof.

Developers

This is considered fraud, and is punished.

_d

Deposit storage pointer.

notifySignatureTimeout(DepositUtils.Deposit storage)

Anyone may notify the contract that the signers have failed to produce a signature.

Developers

This is considered fraud, and is punished.

_d

Deposit storage pointer.

provideRedemptionProof(DepositUtils.Deposit storage,bytes4,bytes,bytes,bytes4,bytes,uint256,bytes)

Anyone may provide a withdrawal proof to prove redemption.

Developers

The signers will be penalized if this is not called.

_bitcoinHeaders

An array of tightly-packed bitcoin headers.

_d

Deposit storage pointer.

_merkleProof

The merkle proof of inclusion of the tx in the bitcoin block.

_txIndexInBlock

The index of the tx in the Bitcoin block (0-indexed).

_txInputVector

All transaction inputs prepended by the number of inputs encoded as a VarInt, max 0xFC(252) inputs.

_txLocktime

Final 4 bytes of the transaction.

_txOutputVector

All transaction outputs prepended by the number of outputs encoded as a VarInt, max 0xFC(252) outputs.

_txVersion

Transaction version number (4-byte LE).

provideRedemptionSignature(DepositUtils.Deposit storage,uint8,bytes32,bytes32)

Anyone may provide a withdrawal signature if it was requested.

Developers

The signers will be penalized if this (or provideRedemptionProof) is not called.

_d

Deposit storage pointer.

_r

Signature R value.

_s

Signature S value. Should be in the low half of secp256k1 curve’s order.

_v

Signature recovery value.

redemptionTransactionChecks(DepositUtils.Deposit storage,bytes,bytes)

Check the redemption transaction input and output vector to ensure the transaction spends the correct UTXO and sends value to the appropriate public key hash.

Developers

We only look at the first input and first output. Revert if we find the wrong UTXO or value recipient. It’s safe to look at only the first input/output as anything that breaks this can be considered fraud and can be caught by ECDSAFraudProof.

_d

Deposit storage pointer.

_txInputVector

All transaction inputs prepended by the number of inputs encoded as a VarInt, max 0xFC(252) inputs.

_txOutputVector

All transaction outputs prepended by the number of outputs encoded as a VarInt, max 0xFC(252) outputs.

Returns

The value sent to the redeemer’s public key hash.

requestRedemption(DepositUtils.Deposit storage,bytes8,bytes)

Only TDT owner can request redemption, unless Deposit is expired or in COURTESY_CALL.

Developers

The redeemer specifies details about the Bitcoin redemption transaction.

_d

Deposit storage pointer.

_outputValueBytes

The 8-byte LE output size.

_redeemerOutputScript

The redeemer’s length-prefixed output script.

transferAndRequestRedemption(DepositUtils.Deposit storage,bytes8,bytes,address)

Anyone can request redemption as long as they can. approve the TDT transfer to the final recipient.

Developers

The redeemer specifies details about the Bitcoin redemption tx and pays for the redemption on behalf of _finalRecipient.

_d

Deposit storage pointer.

_finalRecipient

The address to receive the TDT and later be recorded as deposit redeemer.

_outputValueBytes

The 8-byte LE output size.

_redeemerOutputScript

The redeemer’s length-prefixed output script.

DepositLiquidation

exitCourtesyCall(DepositUtils.Deposit storage)

Goes from courtesy call to active.

Developers

Only callable if collateral is sufficient and the deposit is not expiring.

_d

Deposit storage pointer.

getCollateralizationPercentage(DepositUtils.Deposit storage)

Determines the collateralization percentage of the signing group.

Developers

Compares the bond value and lot value.

_d

Deposit storage pointer.

Returns

Collateralization percentage as uint.

notifyCourtesyCall(DepositUtils.Deposit storage)

Notify the contract that the signers are undercollateralized.

Developers

Calls out to the system for oracle info.

_d

Deposit storage pointer.

notifyCourtesyTimeout(DepositUtils.Deposit storage)

Notifies the contract that the courtesy period has elapsed.

Developers

This is treated as an abort, rather than fraud.

_d

Deposit storage pointer.

notifyUndercollateralizedLiquidation(DepositUtils.Deposit storage)

Notify the contract that the signers are undercollateralized.

Developers

Calls out to the system for oracle info.

_d

Deposit storage pointer.

provideECDSAFraudProof(DepositUtils.Deposit storage,uint8,bytes32,bytes32,bytes32,bytes)

Anyone can provide a signature that was not requested to prove fraud.

Developers

Calls out to the keep to verify if there was fraud.

_d

Deposit storage pointer.

_preimage

The sha256 preimage of the digest.

_r

Signature R value.

_s

Signature S value.

_signedDigest

The digest signed by the signature vrs tuple.

_v

Signature recovery value.

provideSPVFraudProof(DepositUtils.Deposit storage,bytes4,bytes,bytes,bytes4,bytes,uint256,uint8,bytes)

Anyone may notify the deposit of fraud via an SPV proof.

Developers

We strong prefer ECDSA fraud proofs.

_bitcoinHeaders

An array of tightly-packed bitcoin headers.

_d

Deposit storage pointer.

_merkleProof

The merkle proof of inclusion of the tx in the bitcoin block.

_targetInputIndex

Index of the input that spends the custodied UTXO.

_txIndexInBlock

Transaction index in the block (0-indexed).

_txInputVector

All transaction inputs prepended by the number of inputs encoded as a VarInt, max 0xFC(252) inputs.

_txLocktime

Final 4 bytes of the transaction.

_txOutputVector

All transaction outputs prepended by the number of outputs encoded as a VarInt, max 0xFC(252) outputs.

_txVersion

Transaction version number (4-byte LE).

purchaseSignerBondsAtAuction(DepositUtils.Deposit storage)

Closes an auction and purchases the signer bonds. Payout to buyer, funder, then signers if not fraud.

Developers

For interface, reading auctionValue will give a past value. the current is better.

_d

Deposit storage pointer.

submitSignatureFraud(DepositUtils.Deposit storage,uint8,bytes32,bytes32,bytes32,bytes)

Notifies the keep contract of fraud.

Developers

Calls out to the keep contract. this could get expensive if preimage is large.

_d

Deposit storage pointer.

_preimage

The sha256 preimage of the digest.

_r

Signature R value.

_s

Signature S value.

_signedDigest

The digest signed by the signature vrs tuple.

_v

Signature recovery value.

Returns

True if fraud, otherwise revert.

IBTCETHPriceFeed

getPrice()

Get the current price of bitcoin in ether.

Developers

This does not account for any 'Flippening' event.

Returns

The price of one satoshi in wei.

IBondedECDSAKeep

checkBondAmount()

Returns the amount of the keep’s ETH bond in wei.

Developers

Returns

The amount of the keep’s ETH bond in wei.

distributeERC20ToMembers(address,uint256)

Distributes ERC20 token evenly across all keep members.

Developers

This works with any ERC20 token that implements a transferFrom function. This function only has authority over pre-approved token amount. We don’t explicitly check for allowance, SafeMath subtraction overflow is enough protection.

_tokenAddress

Address of the ERC20 token to distribute.

_value

Amount of ERC20 token to distribute.

distributeETHToMembers()

Distributes ETH evenly across all keep members.

Developers

Only the value passed to this function will be distributed.

getPublicKey()

Returns the keep signer’s public key.

Developers

Returns

Signer’s public key.

seizeSignerBonds()

Seizes the signer’s ETH bond.

sign(bytes32)

Calculates a signature over provided digest by the keep. Note that signatures from the keep not explicitly requested by calling sign will be provable as fraud via submitSignatureFraud.

Developers

_digest

Digest to be signed.

submitSignatureFraud(uint8,bytes32,bytes32,bytes32,bytes)

Submits a fraud proof for a valid signature from this keep that was not first approved via a call to sign.

Developers

The function expects the signed digest to be calculated as a double sha256 hash (hash256) of the preimage: sha256(sha256(_preimage)).

_preimage

Preimage of the hashed message.

_r

R part of ECDSA signature.

_s

S part of ECDSA signature.

_signedDigest

Digest for the provided signature. Result of hashing the preimage.

_v

Signature’s header byte: 27 + recoveryID.

Returns

True if fraud, error otherwise.