templates.bridge
uint8 public minimumRequiredQuorum;
// paymentAmount is how much each oracle is paid per request uint256 public paymentAmount;
// dailyCap is the maximum amount that can be either unlocked or deposited within a 24 hour period uint256 public dailyCap; // unlockedThisPeriod is the running tally of how much LINK has been unlocked within // this period uint256 public unlockedThisPeriod; // Depositedthisperiod is the running tally of how much LINK has been deposited within // this period uint256 public depositedThisPeriod;
// startPeriod marks the time that the current period started uint256 public startPeriod;
struct NodeResponses { bool unlocked; uint256 count; mapping(address => bool) responded; }
mapping(bytes32 => NodeResponses) private nodeResponses;
// Writer addresses are allowed to confirm a transaction on the foreign source // chain in order to release LINK on this, the destination chain. // There should be the same number of these as there are oracles on the foreign source chain. // Note that these are node external adapter public keys, NOT oracle addresses! mapping(address => bool) public registeredWriters;
// Only whitelisted addresses are allowed to send or receive LINK to this contract mapping(address => bool) public whitelisted;
struct Node { bytes32 jobId; address writer; uint256 oracleIdx; }
1# https://github.com/smartcontractkit/LockDeposit/blob/master/contracts/MultiNodeLockDeposit.sol 2 3""" 4 uint8 public minimumRequiredQuorum; 5 6 // paymentAmount is how much each oracle is paid per request 7 uint256 public paymentAmount; 8 9 // dailyCap is the maximum amount that can be either unlocked or deposited within a 24 hour period 10 uint256 public dailyCap; 11 // unlockedThisPeriod is the running tally of how much LINK has been unlocked within 12 // this period 13 uint256 public unlockedThisPeriod; 14 // Depositedthisperiod is the running tally of how much LINK has been deposited within 15 // this period 16 uint256 public depositedThisPeriod; 17 18 // startPeriod marks the time that the current period started 19 uint256 public startPeriod; 20 21 struct NodeResponses { 22 bool unlocked; 23 uint256 count; 24 mapping(address => bool) responded; 25 } 26 27 mapping(bytes32 => NodeResponses) private nodeResponses; 28 29 // Writer addresses are allowed to confirm a transaction on the foreign source 30 // chain in order to release LINK on this, the destination chain. 31 // There should be the same number of these as there are oracles on the foreign source chain. 32 // Note that these are node external adapter public keys, NOT oracle addresses! 33 mapping(address => bool) public registeredWriters; 34 35 // Only whitelisted addresses are allowed to send or receive LINK to this contract 36 mapping(address => bool) public whitelisted; 37 38 struct Node { 39 bytes32 jobId; 40 address writer; 41 uint256 oracleIdx; 42 } 43""" 44 45import smartpy as sp 46 47 48@sp.module 49def main(): 50 class MyContract(sp.Contract): 51 def __init__(self): 52 self.data.minimumRequiredQuorum = 0 53 self.data.dailyCap = 0 54 self.data.unlockedThisPeriod = 0 55 self.data.depositedThisPeriod = 0 56 self.data.startPeriod = 0 # timestamp? 57 self.data.nodes = sp.big_map() 58 59 @sp.entrypoint 60 def addNode(self, oracle, jobId, writer): 61 ## verify owner 62 assert not self.data.nodes.contains(oracle) 63 64 @sp.entrypoint 65 def registerForeignChainDeposit( 66 self, _foreignChainTxHash, _blockHash, _recipient, _amount 67 ): 68 ## verify owner 69 pass 70 71 @sp.entrypoint 72 def unlockLink(self, _to, _amount): 73 pass 74 75 76# @sp.add_test(name="Minimal") 77# def test(): 78# scenario = sp.test_scenario(main) 79# scenario.h1("Minimal") 80# c1 = main.MyContract() 81# scenario += c1