Skip to content

Instantly share code, notes, and snippets.

@Arieg419
Last active January 17, 2018 21:03
Show Gist options
  • Save Arieg419/f4a968ee7a8d6a23fabac1d28a22963f to your computer and use it in GitHub Desktop.
Save Arieg419/f4a968ee7a8d6a23fabac1d28a22963f to your computer and use it in GitHub Desktop.
const MoveFundsAfterDateContract = {
balance: 400,
expirationDate: new Date("October 13, 2016 11:13:00"),
id: 2,
fromAddress: "Bob",
call: function() {
return { getBalance: this.balance, getFromAddress: this.fromAddress };
},
send: function() {
return { changeBalance: this.changeBalance };
},
abi: function() {
return { callables: this.call(), sendables: this.send() };
},
moveFunds: function() {
var currentDate = new Date();
if (currentDate > this.expirationDate) {
return {
senderNodeId: "B",
senderAddress: "Bob",
recipientNodeId: "A",
recipientAddress: "Alice",
value: 20,
action: "TRANSACTION_EXTERNAL_ACCOUNT"
};
}
return null;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment