Skip to content

Commit

Permalink
add contract field deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Apr 9, 2019
1 parent 2cf27a9 commit 3e0ad1d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 4 deletions.
14 changes: 14 additions & 0 deletions contracts/GOFSPinner.abi
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@
"stateMutability": "payable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "deployed",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down
2 changes: 1 addition & 1 deletion contracts/GOFSPinner.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0x608060405234801561001057600080fd5b506040516020806104cc8339810180604052602081101561003057600080fd5b505160008054600160a060020a03191633179055600155610476806100566000396000f3fe608060405260043610610050577c010000000000000000000000000000000000000000000000000000000060003504632c4e722e811461005557806334fcf4371461007c57806393b862fe146100ba575b600080fd5b34801561006157600080fd5b5061006a610162565b60408051918252519081900360200190f35b34801561008857600080fd5b506100a66004803603602081101561009f57600080fd5b5035610168565b604080519115158252519081900360200190f35b6100a6600480360360408110156100d057600080fd5b8101906020810181356401000000008111156100eb57600080fd5b8201836020820111156100fd57600080fd5b8035906020019184600183028401116401000000008311171561011f57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506101e2915050565b60015481565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146101d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806104296022913960400191505060405180910390fd5b60019190915590565b60008260008151811015156101f357fe5b90602001015160f860020a900460f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916601260f860020a02148015610286575082600181518110151561024757fe5b90602001015160f860020a900460f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916602060f860020a02145b156102f257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f56657273696f6e203020434944206e6f7420616c6c6f77656400000000000000604482015290519081900360640190fd5b60015482023481111561036657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f56616c756520746f6f206c6f772e000000000000000000000000000000000000604482015290519081900360640190fd5b60405133903483900380156108fc02916000818181858888f19350505050158015610395573d6000803e3d6000fd5b50836040518082805190602001908083835b602083106103c65780518252601f1990920191602091820191016103a7565b51815160209384036101000a60001901801990921691161790526040805192909401829003822089835293519395507fa0d90cefad6d4f81c3b726e011627beb8a079c24c0215d178fcb1225ae9ea6d494509083900301919050a2509291505056fe4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e2ea165627a7a72305820c6d199375800fc101d4fd433c816f468330b871e139be1d830ec0f6488f7f8000029
0x608060405234801561001057600080fd5b506040516020806104f68339810180604052602081101561003057600080fd5b505160008054600160a060020a031916331790556001554360025561049c8061005a6000396000f3fe60806040526004361061005b577c010000000000000000000000000000000000000000000000000000000060003504632c4e722e811461006057806334fcf4371461008757806393b862fe146100c5578063f905c15a1461016d575b600080fd5b34801561006c57600080fd5b50610075610182565b60408051918252519081900360200190f35b34801561009357600080fd5b506100b1600480360360208110156100aa57600080fd5b5035610188565b604080519115158252519081900360200190f35b6100b1600480360360408110156100db57600080fd5b8101906020810181356401000000008111156100f657600080fd5b82018360208201111561010857600080fd5b8035906020019184600183028401116401000000008311171561012a57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610202915050565b34801561017957600080fd5b50610075610448565b60015481565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146101f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061044f6022913960400191505060405180910390fd5b60019190915590565b600082600081518110151561021357fe5b90602001015160f860020a900460f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916601260f860020a021480156102a6575082600181518110151561026757fe5b90602001015160f860020a900460f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916602060f860020a02145b1561031257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f56657273696f6e203020434944206e6f7420616c6c6f77656400000000000000604482015290519081900360640190fd5b60015482023481111561038657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f56616c756520746f6f206c6f772e000000000000000000000000000000000000604482015290519081900360640190fd5b60405133903483900380156108fc02916000818181858888f193505050501580156103b5573d6000803e3d6000fd5b50836040518082805190602001908083835b602083106103e65780518252601f1990920191602091820191016103c7565b51815160209384036101000a60001901801990921691161790526040805192909401829003822089835293519395507fa0d90cefad6d4f81c3b726e011627beb8a079c24c0215d178fcb1225ae9ea6d494509083900301919050a25092915050565b6002548156fe4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e2ea165627a7a723058207a5287ec447ab30a8698bdce3c3de8e185810bc67160feaa3358e3cd7a64fc440029
14 changes: 14 additions & 0 deletions contracts/Pinner.abi
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@
"stateMutability": "payable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "deployed",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"anonymous": false,
"inputs": [
Expand Down
2 changes: 1 addition & 1 deletion contracts/owned.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0x6080604052348015600f57600080fd5b5060008054600160a060020a03191633179055603580602f6000396000f3fe6080604052600080fdfea165627a7a72305820dfbd1b8db7bc849bc5a5977282e315280530860c5c7460ff8fd9751d7573ae0d0029
0x6080604052348015600f57600080fd5b5060008054600160a060020a03191633179055603580602f6000396000f3fe6080604052600080fdfea165627a7a72305820a6fa1b62fd9ec4ba497c37301a5aaeab61ce4d2737fb1accec68c74bfb832a8c0029
7 changes: 6 additions & 1 deletion contracts/pinner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ interface Pinner {
// Returns the current rate in wei per GigaByteHour.
function rate() external view returns (uint);

// Returns the number of the block when this contract was deployed.
function deployed() external view returns (uint);

function pin(bytes calldata cid, uint gbh) external payable returns (bool);

event Pinned(bytes indexed cid, uint gbh);
Expand Down Expand Up @@ -32,10 +35,12 @@ contract owned {

contract GOFSPinner is Pinner, owned {
// Rate in wei per GigaByteHour.
uint public rate; //TODO initial rate? static? constructor?
uint public rate;
uint public deployed;

constructor(uint _rate) public {
rate = _rate;
deployed = block.number;
}

function setRate(uint _rate) public onlyOwner returns (bool) {
Expand Down
28 changes: 27 additions & 1 deletion pinner.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3e0ad1d

Please sign in to comment.